From fd7d8ddf2d2b3b4c82e96e77a187193331fc73c1 Mon Sep 17 00:00:00 2001 From: Meet Date: Mon, 23 Sep 2024 20:59:05 +0530 Subject: [PATCH] fix: group selection on create policy --- .../components/AccessPolicyModal.tsx | 125 +++++++++--------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/frontend/src/views/SecretApprovalPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx b/frontend/src/views/SecretApprovalPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx index f2da726034..b0ec53accf 100644 --- a/frontend/src/views/SecretApprovalPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx +++ b/frontend/src/views/SecretApprovalPage/components/ApprovalPolicyList/components/AccessPolicyModal.tsx @@ -255,20 +255,76 @@ export const AccessPolicyForm = ({ name="secretPath" render={({ field, fieldState: { error } }) => ( + + + )} + /> + ( + - + field.onChange(parseInt(el.target.value, 10))} + /> )} /> + ( + + + + )} + /> +

Approvers

( @@ -276,7 +332,7 @@ export const AccessPolicyForm = ({ e.type=== ApproverType.User).length ? `${value.filter((e) => e.type=== ApproverType.User).length} selected` : "None"} className="text-left" /> @@ -318,7 +374,7 @@ export const AccessPolicyForm = ({ name="approvers" render={({ field: { value, onChange }, fieldState: { error } }) => ( @@ -326,7 +382,7 @@ export const AccessPolicyForm = ({ e.type=== ApproverType.Group).length ? `${value?.filter((e) => e.type=== ApproverType.Group).length} selected` : "None"} className="text-left" /> @@ -339,7 +395,7 @@ export const AccessPolicyForm = ({ {groups && groups.map(({ group }) => { const { id } = group; - const isChecked = value?.includes({id, type: ApproverType.Group}); + const isChecked = value?.filter((el: {id: string, type: ApproverType}) => el.id === id && el.type === ApproverType.Group).length > 0; return ( )} /> - ( - - field.onChange(parseInt(el.target.value, 10))} - /> - - )} - /> - ( - - - - )} - />