Commit ca7a3739 by Peter Holmberg Committed by GitHub

Fix: Propagate unhandled errors when saving Dashboard (#24081)

* only handle error for cases we handle

* added missing case

* remove not used import
parent dda8caf4
...@@ -25,7 +25,7 @@ export const SaveDashboardErrorProxy: React.FC<SaveDashboardErrorProxyProps> = ( ...@@ -25,7 +25,7 @@ export const SaveDashboardErrorProxy: React.FC<SaveDashboardErrorProxyProps> = (
const { onDashboardSave } = useDashboardSave(dashboard); const { onDashboardSave } = useDashboardSave(dashboard);
useEffect(() => { useEffect(() => {
if (error.data) { if (error.data && isHandledError(error.data.status)) {
error.isHandled = true; error.isHandled = true;
} }
}, []); }, []);
...@@ -106,6 +106,18 @@ const ConfirmPluginDashboardSaveModal: React.FC<SaveDashboardModalProps> = ({ on ...@@ -106,6 +106,18 @@ const ConfirmPluginDashboardSaveModal: React.FC<SaveDashboardModalProps> = ({ 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) => ({ const getConfirmPluginDashboardSaveModalStyles = stylesFactory((theme: GrafanaTheme) => ({
modal: css` modal: css`
width: 500px; width: 500px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment