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

* only handle error for cases we handle

* added missing case

* remove not used import
This commit is contained in:
Peter Holmberg
2020-04-30 14:08:43 +02:00
committed by GitHub
parent dda8caf48c
commit ca7a373983

View File

@@ -25,7 +25,7 @@ export const SaveDashboardErrorProxy: React.FC<SaveDashboardErrorProxyProps> = (
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<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) => ({
modal: css`
width: 500px;