mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user