From 9a98192b9b26c10e23274c8e1e7f6506317cfe48 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Mon, 25 Aug 2025 17:26:41 +0200 Subject: [PATCH] fix: requested changes --- .../components/ReviewAccessModal.tsx | 40 ++++++++----- .../components/AccessPolicyModal.tsx | 7 +-- .../components/ApprovalPolicyRow.tsx | 34 ++++++----- .../components/PolicyBypasserMemberOption.tsx | 39 ------------- .../components/PolicyMemberOption.tsx | 5 +- .../SecretApprovalRequestChanges.tsx | 57 +++++++++---------- 6 files changed, 77 insertions(+), 105 deletions(-) delete mode 100644 frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/PolicyBypasserMemberOption.tsx diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/ReviewAccessModal.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/ReviewAccessModal.tsx index c54237503..c5e1e5cf0 100644 --- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/ReviewAccessModal.tsx +++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/ReviewAccessModal.tsx @@ -4,7 +4,6 @@ import { faCheck, faEdit, faHourglass, - faQuestionCircle, faTriangleExclamation, faUser, faUserSlash @@ -58,8 +57,9 @@ const getReviewedStatusSymbol = (status?: ApprovalStatus, isOrgMembershipActive? return ( // Can't do a tooltip here because nested tooltips doesn't work properly as of yet. // TODO(daniel): Fix nested tooltips in the future. - - + + + ); } @@ -206,6 +206,7 @@ export const ReviewAccessRequestModal = ({ (acc, curr) => { if (acc.length && acc[acc.length - 1].sequence === curr.sequence) { acc[acc.length - 1][curr.type]?.push(curr); + return acc; } @@ -217,6 +218,7 @@ export const ReviewAccessRequestModal = ({ ? { user: [curr], group: [], sequence, approvals } : { group: [curr], user: [], sequence, approvals } ); + return acc; }, [] as { @@ -430,24 +432,32 @@ export const ReviewAccessRequestModal = ({ {Boolean(approver.user.length) && (
- {approver?.user?.map((el) => { + {approver?.user?.map((el, index) => { const member = approverSequence?.membersGroupById?.[el.id]?.[0]; if (!member) return null; return member.user.isOrgMembershipActive ? ( - {member.user.username} +
+ {member.user.username} + {index < approver.user.length - 1 && ","} +
) : ( - - {member.user.username}{" "} - - -
- (Inactive){" "} - -
-
+
+ + {member.user.username} + + +
+ + + Inactive + +
+
+
- + {index < approver.user.length - 1 && ","} +
); })}
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx index 268dba4a9..856c16ee1 100644 --- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx +++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx @@ -44,7 +44,6 @@ import { EnforcementLevel, PolicyType } from "@app/hooks/api/policies/enums"; import { TWorkspaceUser } from "@app/hooks/api/users/types"; import { PolicyMemberOption } from "./PolicyMemberOption"; -import { PolicyBypasserMemberOption } from "./PolicyBypasserMemberOption"; type Props = { isOpen?: boolean; @@ -144,7 +143,7 @@ const Form = ({ handleSubmit, watch, resetField, - formState: { isSubmitting, errors } + formState: { isSubmitting } } = useForm({ resolver: zodResolver(formSchema), values: editValues @@ -415,8 +414,6 @@ const Form = ({ setDragOverItem(null); }; - console.log("error", errors); - return (
@@ -812,7 +809,7 @@ const Form = ({ menuPlacement="top" isMulti placeholder="Select members..." - components={{ Option: PolicyBypasserMemberOption }} + components={{ Option: PolicyMemberOption }} options={bypasserMemberOptions} getOptionValue={(option) => option.id} getOptionLabel={(option) => { diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/ApprovalPolicyRow.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/ApprovalPolicyRow.tsx index 410593f12..d1c54d85f 100644 --- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/ApprovalPolicyRow.tsx +++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/ApprovalPolicyRow.tsx @@ -1,9 +1,9 @@ import { useMemo } from "react"; import { + faBan, faClipboardCheck, faEdit, faEllipsisV, - faQuestionCircle, faTrash, faUser, faUserGroup @@ -215,21 +215,29 @@ export const ApprovalPolicyRow = ({ {Boolean(el.users.length) && (
- {el.users.map((u) => { + {el.users.map((u, index) => { return u.user.isOrgMembershipActive ? ( - {getMemberLabel(u)} +
+ {getMemberLabel(u)} + {index < el.users.length - 1 && ","} +
) : ( - - {getMemberLabel(u)}{" "} - - -
- (Inactive){" "} - -
-
+
+ + {getMemberLabel(u)} + + +
+ + + Inactive + +
+
+
- + {index < el.users.length - 1 && ","} +
); })}
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/PolicyBypasserMemberOption.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/PolicyBypasserMemberOption.tsx deleted file mode 100644 index ed572bdba..000000000 --- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/PolicyBypasserMemberOption.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { components, OptionProps } from "react-select"; -import { faCheckCircle } from "@fortawesome/free-regular-svg-icons"; -import { faBan } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { twMerge } from "tailwind-merge"; - -import { Badge } from "@app/components/v2"; -import { BypasserType } from "@app/hooks/api/accessApproval/types"; - -export const PolicyBypasserMemberOption = ({ - isSelected, - children, - ...props -}: OptionProps<{ - id: string; - type: BypasserType; - isOrgMembershipActive?: boolean; -}>) => { - return ( - -
-

- {children} -

- {!props.data.isOrgMembershipActive && ( - - - Inactive - - )} - {isSelected && ( - - )} -
-
- ); -}; diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/PolicyMemberOption.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/PolicyMemberOption.tsx index 24284d690..50376521c 100644 --- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/PolicyMemberOption.tsx +++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/components/PolicyMemberOption.tsx @@ -5,7 +5,8 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { twMerge } from "tailwind-merge"; import { Badge } from "@app/components/v2"; -import { ApproverType } from "@app/hooks/api/accessApproval/types"; +import { BypasserType } from "@app/hooks/api/accessApproval/types"; +import { ApproverType } from "@app/hooks/api/secretApproval/types"; export const PolicyMemberOption = ({ isSelected, @@ -13,8 +14,8 @@ export const PolicyMemberOption = ({ ...props }: OptionProps<{ id: string; + type: BypasserType | ApproverType; isOrgMembershipActive?: boolean; - type: ApproverType; }>) => { return ( diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx index 3736dd649..1f4d708f9 100644 --- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx +++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/SecretApprovalRequest/components/SecretApprovalRequestChanges.tsx @@ -554,31 +554,27 @@ export const SecretApprovalRequestChanges = ({ > -
+
{requiredApprover?.email}
* + {!isOrgMembershipActive && ( + + )}
- - {!isOrgMembershipActive && ( - - - - )}
{reviewer?.comment && ( @@ -632,24 +628,23 @@ export const SecretApprovalRequestChanges = ({ > -
+
{reviewer?.email} + {!isOrgMembershipActive && ( + + )}
- {!isOrgMembershipActive && ( - - - - )}