From ca7a373983f75ca92f4e8eca4f93a7d959c74459 Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Thu, 30 Apr 2020 14:08:43 +0200 Subject: [PATCH] Fix: Propagate unhandled errors when saving Dashboard (#24081) * only handle error for cases we handle * added missing case * remove not used import --- .../SaveDashboard/SaveDashboardErrorProxy.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx b/public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx index 0ec5cfee301..bc909e593eb 100644 --- a/public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx @@ -25,7 +25,7 @@ export const SaveDashboardErrorProxy: React.FC = ( const { onDashboardSave } = useDashboardSave(dashboard); useEffect(() => { - if (error.data) { + if (error.data && isHandledError(error.data.status)) { error.isHandled = true; } }, []); @@ -106,6 +106,18 @@ const ConfirmPluginDashboardSaveModal: React.FC = ({ on ); }; +const isHandledError = (errorStatus: string) => { + switch (errorStatus) { + case 'version-mismatch': + case 'name-exists': + case 'plugin-dashboard': + return true; + + default: + return false; + } +}; + const getConfirmPluginDashboardSaveModalStyles = stylesFactory((theme: GrafanaTheme) => ({ modal: css` width: 500px;