mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardSave: Correctly overwrite dashboard when saving (#22650)
This commit is contained in:
@@ -8,12 +8,20 @@ import { SaveDashboardModalProps } from './types';
|
||||
import { SaveDashboardAsButton } from './SaveDashboardButton';
|
||||
|
||||
interface SaveDashboardErrorProxyProps {
|
||||
/** original dashboard */
|
||||
dashboard: DashboardModel;
|
||||
/** dashboard save model with applied modifications, i.e. title */
|
||||
dashboardSaveModel: any;
|
||||
error: any;
|
||||
onDismiss: () => void;
|
||||
}
|
||||
|
||||
export const SaveDashboardErrorProxy: React.FC<SaveDashboardErrorProxyProps> = ({ dashboard, error, onDismiss }) => {
|
||||
export const SaveDashboardErrorProxy: React.FC<SaveDashboardErrorProxyProps> = ({
|
||||
dashboard,
|
||||
dashboardSaveModel,
|
||||
error,
|
||||
onDismiss,
|
||||
}) => {
|
||||
const { onDashboardSave } = useDashboardSave(dashboard);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -35,7 +43,7 @@ export const SaveDashboardErrorProxy: React.FC<SaveDashboardErrorProxyProps> = (
|
||||
}
|
||||
confirmText="Save & Overwrite"
|
||||
onConfirm={async () => {
|
||||
await onDashboardSave(dashboard.getSaveModelClone(), { overwrite: true }, dashboard);
|
||||
await onDashboardSave(dashboardSaveModel, { overwrite: true }, dashboard);
|
||||
onDismiss();
|
||||
}}
|
||||
onDismiss={onDismiss}
|
||||
@@ -53,7 +61,7 @@ export const SaveDashboardErrorProxy: React.FC<SaveDashboardErrorProxyProps> = (
|
||||
}
|
||||
confirmText="Save & Overwrite"
|
||||
onConfirm={async () => {
|
||||
await onDashboardSave(dashboard.getSaveModelClone(), { overwrite: true }, dashboard);
|
||||
await onDashboardSave(dashboardSaveModel, { overwrite: true }, dashboard);
|
||||
onDismiss();
|
||||
}}
|
||||
onDismiss={onDismiss}
|
||||
|
||||
Reference in New Issue
Block a user