From 459af3823c1c5b4ba8cbdc860e1a9fb731975fcc Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Tue, 12 Jul 2022 17:11:58 +0800 Subject: [PATCH] fix(console): should not display unsaved alert on item deleted (#1507) --- .../components/ConfirmModal/index.module.scss | 2 +- .../src/components/ConfirmModal/index.tsx | 12 ++- .../components/DeleteConfirmModal/index.tsx | 55 +++++++++++++ .../UnsavedChangesAlertModal/index.tsx | 4 +- .../components/DeleteForm/index.module.scss | 15 ---- .../components/DeleteForm/index.tsx | 81 ------------------- .../ApiResourceDetails/index.module.scss | 14 ++++ .../src/pages/ApiResourceDetails/index.tsx | 60 +++++++++----- .../components/AdvancedSettings.tsx | 5 +- .../components/DeleteForm/index.module.scss | 15 ---- .../components/DeleteForm/index.tsx | 81 ------------------- .../components/Settings.tsx | 5 +- .../ApplicationDetails/index.module.scss | 14 ++++ .../src/pages/ApplicationDetails/index.tsx | 61 ++++++++++---- .../UserDetails/components/DeleteForm.tsx | 52 ------------ .../UserDetails/components/UserConnectors.tsx | 7 +- .../UserDetails/components/UserSettings.tsx | 5 +- .../console/src/pages/UserDetails/index.tsx | 49 ++++++++--- 18 files changed, 231 insertions(+), 306 deletions(-) create mode 100644 packages/console/src/components/DeleteConfirmModal/index.tsx delete mode 100644 packages/console/src/pages/ApiResourceDetails/components/DeleteForm/index.module.scss delete mode 100644 packages/console/src/pages/ApiResourceDetails/components/DeleteForm/index.tsx delete mode 100644 packages/console/src/pages/ApplicationDetails/components/DeleteForm/index.module.scss delete mode 100644 packages/console/src/pages/ApplicationDetails/components/DeleteForm/index.tsx delete mode 100644 packages/console/src/pages/UserDetails/components/DeleteForm.tsx diff --git a/packages/console/src/components/ConfirmModal/index.module.scss b/packages/console/src/components/ConfirmModal/index.module.scss index ede9f85d8..1c460fb58 100644 --- a/packages/console/src/components/ConfirmModal/index.module.scss +++ b/packages/console/src/components/ConfirmModal/index.module.scss @@ -4,6 +4,6 @@ font: var(--font-body-medium); > :not(:first-child) { - margin: _.unit(6) 0; + margin: _.unit(6) 0 0; } } diff --git a/packages/console/src/components/ConfirmModal/index.tsx b/packages/console/src/components/ConfirmModal/index.tsx index 40f3c1551..d373b2d2b 100644 --- a/packages/console/src/components/ConfirmModal/index.tsx +++ b/packages/console/src/components/ConfirmModal/index.tsx @@ -17,6 +17,8 @@ export type ConfirmModalProps = { confirmButtonText?: AdminConsoleKey; cancelButtonText?: AdminConsoleKey; isOpen: boolean; + isConfirmButtonDisabled?: boolean; + isLoading?: boolean; onCancel: () => void; onConfirm: () => void; }; @@ -29,6 +31,8 @@ const ConfirmModal = ({ confirmButtonText = 'general.confirm', cancelButtonText = 'general.cancel', isOpen, + isConfirmButtonDisabled = false, + isLoading = false, onCancel, onConfirm, }: ConfirmModalProps) => { @@ -43,7 +47,13 @@ const ConfirmModal = ({ footer={ <>