diff --git a/CHANGELOG.md b/CHANGELOG.md index 375490f27..bce88f2bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- Add end-user confirmation before sending policy sign notification + ### Fixed - Fix not aligned button on policy list view diff --git a/apps/console/src/pages/organizations/policies/PolicyListView.tsx b/apps/console/src/pages/organizations/policies/PolicyListView.tsx index dde0f71ab..a30e6c05d 100644 --- a/apps/console/src/pages/organizations/policies/PolicyListView.tsx +++ b/apps/console/src/pages/organizations/policies/PolicyListView.tsx @@ -472,8 +472,10 @@ function PolicyListViewContent({ data.organization?.policies?.edges.map((edge) => edge?.node) ?? []; const [createModalOpen, setCreateModalOpen] = useState(false); + const [confirmSigningModalOpen, setConfirmSigningModalOpen] = useState(false); - const [sendSigningNotifications, _] = useMutation(sendSigningNotificationsMutation); + const [sendSigningNotifications, isSendingNotifications] = useMutation(sendSigningNotificationsMutation); + const { toast } = useToast(); const handleOpenModal = () => { setCreateModalOpen(true); @@ -490,6 +492,31 @@ function PolicyListViewContent({ organizationId: organizationId!, }, }, + onCompleted: (response, errors) => { + if (errors) { + console.error("Error sending signing notifications:", errors); + toast({ + title: "Error", + description: "Failed to send signing notifications. Please try again.", + variant: "destructive", + }); + return; + } + + toast({ + title: "Success", + description: "Signing notifications sent successfully!", + }); + setConfirmSigningModalOpen(false); + }, + onError: (error) => { + console.error("Error sending signing notifications:", error); + toast({ + title: "Error", + description: "Failed to send signing notifications. Please try again.", + variant: "destructive", + }); + }, }); }; @@ -502,7 +529,7 @@ function PolicyListViewContent({ New policy - @@ -569,6 +596,30 @@ function PolicyListViewContent({ organizationId={organizationId!} organizationRef={data.organization} /> + + {/* Confirmation Modal for Sending Signing Notifications */} + + + Send Signing Notifications + + This will send signing notifications to all users who have pending policies to sign. Are you sure you want to continue? + + + + + + + ); }