From 52a26b51af0b726d9579600036f60fc1713cb5c7 Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Sat, 31 May 2025 17:46:01 -0700 Subject: [PATCH 1/2] revamp UI for access requests --- .../SpecificPrivilegeSection.tsx | 459 ++++++++++-------- .../components/RolePermissionsSection.tsx | 4 +- .../components/RequestAccessModal.tsx | 4 +- 3 files changed, 257 insertions(+), 210 deletions(-) diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx index e8bc03698..8eaf05fe7 100644 --- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx +++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx @@ -6,6 +6,8 @@ import { faCheck, faClock, faLockOpen, + faPencil, + faPlus, faTrash } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -50,6 +52,7 @@ import { useDeleteProjectUserAdditionalPrivilege } from "@app/hooks/api"; import { TAccessApprovalPolicy } from "@app/hooks/api/types"; +import { faEye, faTrashCan } from "@fortawesome/free-regular-svg-icons"; const secretPermissionSchema = z.object({ secretPath: z.string().optional(), @@ -205,7 +208,7 @@ export const SpecificPrivilegeSecretForm = ({ if (!data.secretPath) { createNotification({ type: "error", - text: "Please select a secret path", + text: "Please select a secret path...", title: "Error" }); return; @@ -264,18 +267,18 @@ export const SpecificPrivilegeSecretForm = ({ }; return ( -
+
-
+
( - + field.onChange(e)} > {selectablePaths.map((path) => ( @@ -328,222 +332,265 @@ export const SpecificPrivilegeSecretForm = ({ ); }} /> -
- ( -
- - field.onChange(isChecked)} - /> -
- )} - /> - ( -
- - field.onChange(isChecked)} - /> -
- )} - /> - ( -
- - field.onChange(isChecked)} - /> -
- )} - /> - ( -
- - field.onChange(isChecked)} - /> -
- )} - /> -
-
- - -
- - - -
-
- -
-
- Configure timed access -
- {isExpired && Expired} - ( - } - isError={Boolean(error?.message)} - errorText={error?.message} + field.onChange(isChecked)} + /> +
+
+ + +
+

Read secret values

+
+ + )} + /> + ( + + )} + /> +
+
+ ( + + )} + /> + ( + + )} + /> +
+
+
+ +
+ + +
+ + - - {temporaryAccessField.isTemporary && ( + {getAccessLabel(false)} + + +
+
+ +
+
+ Configure timed access +
+ {isExpired && Expired} + ( + } + isError={Boolean(error?.message)} + errorText={error?.message} + > + + + )} + /> +
- )} + + {temporaryAccessField.isTemporary && ( + + )} +
-
- - - {/* eslint-disable-next-line no-nested-ternary */} - {privilegeForm.formState.isDirty && privilege ? ( - <> - - privilegeForm.reset()} + + + {/* eslint-disable-next-line no-nested-ternary */} + {privilegeForm.formState.isDirty && privilege ? ( + <> + + privilegeForm.reset()} + > + + + + - - - + + {privilegeForm.formState.isSubmitting ? ( + + ) : ( + + )} + + + + ) : // eslint-disable-next-line no-nested-ternary + privilege ? ( handlePopUpOpen("deletePrivilege")} > - {privilegeForm.formState.isSubmitting ? ( - - ) : ( - - )} + - - ) : // eslint-disable-next-line no-nested-ternary - privilege ? ( - - handlePopUpOpen("deletePrivilege")} - > - - - - ) : ( -
- )} -
+ ) : ( +
+ )} +
+
(
- +
)} /> diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx index a1bbe3d54..382cb0b55 100644 --- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx +++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx @@ -158,8 +158,8 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => { variant="outline_bg" type="submit" className={twMerge( - "mr-4 h-10 border border-primary", - isDirty && "bg-primary text-black" + "mr-4 h-10 border", + isDirty && "bg-primary text-black hover:bg-primary hover:opacity-80" )} isDisabled={isSubmitting || !isDirty} isLoading={isSubmitting} diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/RequestAccessModal.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/RequestAccessModal.tsx index 8b3561bf6..b337f4e69 100644 --- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/RequestAccessModal.tsx +++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/RequestAccessModal.tsx @@ -14,9 +14,9 @@ export const RequestAccessModal = ({ return ( onOpenChange(false)} policies={policies} /> From f3d5790e2cc5e1da122570e0e62f3fd188615d97 Mon Sep 17 00:00:00 2001 From: carlosmonastyrski Date: Mon, 2 Jun 2025 13:10:50 -0300 Subject: [PATCH 2/2] Fix lint issues --- .../SpecificPrivilegeSection.tsx | 101 +++++++++++------- 1 file changed, 65 insertions(+), 36 deletions(-) diff --git a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx index 8eaf05fe7..e8d2ef77f 100644 --- a/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx +++ b/frontend/src/pages/project/AccessControlPage/components/MembersTab/components/MemberRoleForm/SpecificPrivilegeSection.tsx @@ -1,5 +1,7 @@ +/* eslint-disable jsx-a11y/label-has-associated-control */ import { useMemo } from "react"; import { Controller, useForm } from "react-hook-form"; +import { faEye, faTrashCan } from "@fortawesome/free-regular-svg-icons"; import { faArrowRotateLeft, faCaretDown, @@ -52,7 +54,6 @@ import { useDeleteProjectUserAdditionalPrivilege } from "@app/hooks/api"; import { TAccessApprovalPolicy } from "@app/hooks/api/types"; -import { faEye, faTrashCan } from "@fortawesome/free-regular-svg-icons"; const secretPermissionSchema = z.object({ secretPath: z.string().optional(), @@ -278,7 +279,7 @@ export const SpecificPrivilegeSecretForm = ({ +
)} />