mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Library Panels: Add "Discard" button to panel save modal (#31647)
* Library Panels: Add "Discard" button to panel save modal
This commit is contained in:
@@ -171,6 +171,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
|
||||
// the user exits the panel editor they aren't prompted to save again
|
||||
this.props.updateSourcePanel(this.props.panel);
|
||||
},
|
||||
onDiscard: this.onDiscard,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
PanelEditorUIState,
|
||||
setPanelEditorUIState,
|
||||
updateEditorInitState,
|
||||
setDiscardChanges,
|
||||
} from './reducers';
|
||||
import { updateLocation } from 'app/core/actions';
|
||||
import { cleanUpEditPanel, panelModelAndPluginReady } from '../../../state/reducers';
|
||||
@@ -52,6 +53,11 @@ export function exitPanelEditor(): ThunkResult<void> {
|
||||
})
|
||||
);
|
||||
|
||||
const onDiscard = () => {
|
||||
dispatch(setDiscardChanges(true));
|
||||
onConfirm();
|
||||
};
|
||||
|
||||
const panel = getPanel();
|
||||
|
||||
if (shouldDiscardChanges || !panel.libraryPanel) {
|
||||
@@ -71,6 +77,7 @@ export function exitPanelEditor(): ThunkResult<void> {
|
||||
folderId: dashboard!.meta.folderId,
|
||||
isOpen: true,
|
||||
onConfirm,
|
||||
onDiscard,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user