From cbf0bbc8ecfc5b1536d7bd46b467d42c4ca2354e Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Fri, 11 Apr 2025 17:10:34 +0000 Subject: [PATCH] Enhance API token management and role display. Improved token expiration options and made role cards collapsible. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/ce8616db-dc72-462d-9d34-1ac938bbce4c.jpg --- client/src/pages/api-tokens.tsx | 2 + client/src/pages/roles.tsx | 140 +++++++++++++++++++------------- 2 files changed, 85 insertions(+), 57 deletions(-) diff --git a/client/src/pages/api-tokens.tsx b/client/src/pages/api-tokens.tsx index e014de6..602a383 100644 --- a/client/src/pages/api-tokens.tsx +++ b/client/src/pages/api-tokens.tsx @@ -76,6 +76,8 @@ const tokenFormSchema = z.object({ name: z.string().min(1, "Token name is required"), role: z.string().min(1, "Role is required"), expiresIn: z.string().optional(), + customDate: z.date().optional(), + customTime: z.string().optional(), }); export default function ApiTokensPage() { diff --git a/client/src/pages/roles.tsx b/client/src/pages/roles.tsx index 420772f..e0fac52 100644 --- a/client/src/pages/roles.tsx +++ b/client/src/pages/roles.tsx @@ -18,6 +18,11 @@ import { CardHeader, CardTitle, } from "@/components/ui/card"; +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "@/components/ui/collapsible"; import { Dialog, DialogContent, @@ -141,30 +146,38 @@ type RoleFormValues = z.infer; // System role card component const SystemRoleCard = ({ roleName }: { roleName: SystemRole }) => { + const [isOpen, setIsOpen] = useState(false); + return ( - - - - {roleName.charAt(0).toUpperCase() + roleName.slice(1)} - System - - - {roleName === "admin" && "Full access to all system features and settings"} - {roleName === "manager" && "Manage domains, records, and access to organizational resources"} - {roleName === "user" && "Standard user with ability to view and modify specific resources"} - {roleName === "readonly" && "View-only access to resources without modification permissions"} - - - -
- {systemRolePermissions[roleName].map((permission) => ( - - {availablePermissions.find(p => p.id === permission)?.label || permission} - - ))} -
-
+ + + + + + {roleName.charAt(0).toUpperCase() + roleName.slice(1)} + System + + + {roleName === "admin" && "Full access to all system features and settings"} + {roleName === "manager" && "Manage domains, records, and access to organizational resources"} + {roleName === "user" && "Standard user with ability to view and modify specific resources"} + {roleName === "readonly" && "View-only access to resources without modification permissions"} + + + + + +
+ {systemRolePermissions[roleName].map((permission) => ( + + {availablePermissions.find(p => p.id === permission)?.label || permission} + + ))} +
+
+
+
); }; @@ -350,41 +363,54 @@ export default function RolesPage() { ) : (
- {customRoles.map((role: CustomRole) => ( - - -
-
- - - {role.name} - Custom - - {role.description && ( - {role.description} - )} -
-
- - -
-
-
- -
- {role.permissions.map((permission) => ( - - {availablePermissions.find(p => p.id === permission)?.label || permission} - - ))} -
-
-
- ))} + {customRoles.map((role: CustomRole) => { + const [isOpen, setIsOpen] = useState(false); + return ( + + + +
+ + + + {role.name} + Custom + + {role.description && ( + {role.description} + )} + +
+ + +
+
+
+ + +
+ {role.permissions.map((permission) => ( + + {availablePermissions.find(p => p.id === permission)?.label || permission} + + ))} +
+
+
+
+
+ ); + })}
)}