mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
MoveDashboard: Fix for moving dashboard caused all variables to be lost (#25005)
* MoveDashboard: Fix moving caused all variables to be lost * fix typescript issue
This commit is contained in:
parent
60e7b63c33
commit
3a469f6ca2
@ -6,10 +6,9 @@ import { AppEvents } from '@grafana/data';
|
||||
|
||||
import appEvents from 'app/core/app_events';
|
||||
import config from 'app/core/config';
|
||||
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||
import { DataSourceResponse } from 'app/types/events';
|
||||
import { DashboardSearchHit } from 'app/features/search/types';
|
||||
import { CoreEvents, DashboardDTO, FolderInfo } from 'app/types';
|
||||
import { CoreEvents, DashboardDTO, FolderInfo, DashboardDataDTO } from 'app/types';
|
||||
import { coreModule } from 'app/core/core_module';
|
||||
import { ContextSrv, contextSrv } from './context_srv';
|
||||
import { Emitter } from '../utils/emitter';
|
||||
@ -260,11 +259,11 @@ export class BackendSrv implements BackendService {
|
||||
}
|
||||
|
||||
saveDashboard(
|
||||
dash: DashboardModel,
|
||||
dashboard: DashboardDataDTO,
|
||||
{ message = '', folderId, overwrite = false }: { message?: string; folderId?: number; overwrite?: boolean } = {}
|
||||
) {
|
||||
return this.post('/api/dashboards/db/', {
|
||||
dashboard: dash,
|
||||
dashboard,
|
||||
folderId,
|
||||
overwrite,
|
||||
message,
|
||||
@ -319,13 +318,12 @@ export class BackendSrv implements BackendService {
|
||||
|
||||
private async moveDashboard(uid: string, toFolder: FolderInfo) {
|
||||
const fullDash: DashboardDTO = await this.getDashboardByUid(uid);
|
||||
const model = new DashboardModel(fullDash.dashboard, fullDash.meta);
|
||||
|
||||
if ((!fullDash.meta.folderId && toFolder.id === 0) || fullDash.meta.folderId === toFolder.id) {
|
||||
return { alreadyInFolder: true };
|
||||
}
|
||||
|
||||
const clone = model.getSaveModelClone();
|
||||
const clone = fullDash.dashboard;
|
||||
const options = {
|
||||
folderId: toFolder.id,
|
||||
overwrite: false,
|
||||
|
Loading…
Reference in New Issue
Block a user