From a17d36a90b6f38b3e1135f8206a01889afdfca66 Mon Sep 17 00:00:00 2001 From: EthanHealy01 Date: Wed, 17 Dec 2025 16:24:44 +0000 Subject: [PATCH] frontend validation --- .../shared/NavigationWarningModal.tsx | 21 ++++++++++++++++++- .../hooks/tools/redact/useRedactParameters.ts | 4 ++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/frontend/src/core/components/shared/NavigationWarningModal.tsx b/frontend/src/core/components/shared/NavigationWarningModal.tsx index dff9dd957..ad061c1ca 100644 --- a/frontend/src/core/components/shared/NavigationWarningModal.tsx +++ b/frontend/src/core/components/shared/NavigationWarningModal.tsx @@ -7,9 +7,10 @@ import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline"; interface NavigationWarningModalProps { onApplyAndContinue?: () => Promise; + onExportAndContinue?: () => Promise; } -const NavigationWarningModal = ({ onApplyAndContinue }: NavigationWarningModalProps) => { +const NavigationWarningModal = ({ onApplyAndContinue, onExportAndContinue }: NavigationWarningModalProps) => { const { t } = useTranslation(); const { showNavigationWarning, hasUnsavedChanges, pendingNavigation, cancelNavigation, confirmNavigation, setHasUnsavedChanges } = useNavigationGuard(); @@ -31,6 +32,14 @@ const NavigationWarningModal = ({ onApplyAndContinue }: NavigationWarningModalPr confirmNavigation(); }; + const handleExportAndContinue = async () => { + if (onExportAndContinue) { + await onExportAndContinue(); + } + setHasUnsavedChanges(false); + confirmNavigation(); + }; + const BUTTON_WIDTH = "12rem"; // Only show modal if there are unsaved changes AND there's an actual pending navigation @@ -75,6 +84,11 @@ const NavigationWarningModal = ({ onApplyAndContinue }: NavigationWarningModalPr {t("applyAndContinue", "Apply & Leave")} )} + {onExportAndContinue && ( + + )} @@ -91,6 +105,11 @@ const NavigationWarningModal = ({ onApplyAndContinue }: NavigationWarningModalPr {t("applyAndContinue", "Apply & Leave")} )} + {onExportAndContinue && ( + + )} diff --git a/frontend/src/core/hooks/tools/redact/useRedactParameters.ts b/frontend/src/core/hooks/tools/redact/useRedactParameters.ts index b91cd2b72..89884d558 100644 --- a/frontend/src/core/hooks/tools/redact/useRedactParameters.ts +++ b/frontend/src/core/hooks/tools/redact/useRedactParameters.ts @@ -34,8 +34,8 @@ export const useRedactParameters = (): RedactParametersHook => { if (params.mode === 'automatic') { return '/api/v1/security/auto-redact'; } - // Manual redaction is handled in the viewer; no endpoint - return null; + // Manual redaction handled client-side + return ''; }, validateFn: (params) => { if (params.mode === 'automatic') {