Role: {role.roleName}
-Priority: {role.priority}
-Or run this in console:
-
-const acs = localStorage.getItem('acs');
-console.log('Your permissions:', acs);
-console.log('As array:', acs ? acs.split(',').map(Number) : []);
-console.log('Has VIEW_AGENT (171)?', acs ? acs.split(',').includes('171') : false);
-
-
-
diff --git a/src/components/buttons/command-action-buttons.tsx b/src/components/buttons/command-action-buttons.tsx
index c865080..569c4b7 100644
--- a/src/components/buttons/command-action-buttons.tsx
+++ b/src/components/buttons/command-action-buttons.tsx
@@ -14,8 +14,7 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
-import { useGetCommandsByTypes } from "@/hooks/queries/useCommandQueries";
-import { useSendCommand } from "@/hooks/queries";
+import { useGetSensitiveCommands, useExecuteSensitiveCommand } from "@/hooks/queries/useCommandQueries";
import { CommandType } from "@/types/command-registry";
import {
Power,
@@ -58,6 +57,12 @@ const COMMAND_TYPE_CONFIG = {
color: "text-purple-600",
bgColor: "bg-purple-50 hover:bg-purple-100",
},
+ [CommandType.RESET]: {
+ label : "Reset",
+ icon: Loader2,
+ color: "text-green-600",
+ bgColor: "bg-green-50 hover:bg-green-100",
+ }
};
export function CommandActionButtons({ roomName, selectedDevices = [] }: CommandActionButtonsProps) {
@@ -65,55 +70,52 @@ export function CommandActionButtons({ roomName, selectedDevices = [] }: Command
open: boolean;
command: any;
commandType: CommandType;
+ isSensitive?: boolean;
}>({
open: false,
command: null,
commandType: CommandType.RESTART,
});
const [isExecuting, setIsExecuting] = useState(false);
+ const [sensitivePassword, setSensitivePassword] = useState("");
// Query commands for each type
- const { data: restartCommands = [] } = useGetCommandsByTypes(CommandType.RESTART.toString());
- const { data: shutdownCommands = [] } = useGetCommandsByTypes(CommandType.SHUTDOWN.toString());
- const { data: taskkillCommands = [] } = useGetCommandsByTypes(CommandType.TASKKILL.toString());
- const { data: blockCommands = [] } = useGetCommandsByTypes(CommandType.BLOCK.toString());
+ const { data: sensitiveCommands = [] } = useGetSensitiveCommands();
- // Send command mutation
- const sendCommandMutation = useSendCommand();
+ // Send command mutation (sensitive)
+ const executeSensitiveMutation = useExecuteSensitiveCommand();
- const commandsByType = {
- [CommandType.RESTART]: restartCommands,
- [CommandType.SHUTDOWN]: shutdownCommands,
- [CommandType.TASKKILL]: taskkillCommands,
- [CommandType.BLOCK]: blockCommands,
- };
+ // Build commands mapped by CommandType using the `command` field from sensitive data
+ const commandsByType: Record