mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Make dashboard JSON editable
This commit is contained in:
parent
ce787b88bf
commit
dc11f1da81
@ -100,7 +100,7 @@ export class DashboardSrv {
|
|||||||
.catch(this.handleSaveDashboardError.bind(this, clone, options));
|
.catch(this.handleSaveDashboardError.bind(this, clone, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
saveDashboard(options, clone) {
|
saveDashboard(options?, clone?) {
|
||||||
if (clone) {
|
if (clone) {
|
||||||
this.setCurrent(this.create(clone, this.dash.meta));
|
this.setCurrent(this.create(clone, this.dash.meta));
|
||||||
}
|
}
|
||||||
@ -120,6 +120,10 @@ export class DashboardSrv {
|
|||||||
return this.save(this.dash.getSaveModelClone(), options);
|
return this.save(this.dash.getSaveModelClone(), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveJSONDashboard(json: string) {
|
||||||
|
return this.save(JSON.parse(json), {});
|
||||||
|
}
|
||||||
|
|
||||||
showSaveAsModal() {
|
showSaveAsModal() {
|
||||||
this.$rootScope.appEvent('show-modal', {
|
this.$rootScope.appEvent('show-modal', {
|
||||||
templateHtml: '<save-dashboard-as-modal dismiss="dismiss()"></save-dashboard-as-modal>',
|
templateHtml: '<save-dashboard-as-modal dismiss="dismiss()"></save-dashboard-as-modal>',
|
||||||
|
@ -134,7 +134,13 @@ export class SettingsCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveDashboard() {
|
saveDashboard() {
|
||||||
this.dashboardSrv.saveDashboard();
|
if (this.viewId === 'view_json') {
|
||||||
|
this.dashboardSrv.saveJSONDashboard(this.json).then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.dashboardSrv.saveDashboard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onPostSave() {
|
onPostSave() {
|
||||||
|
Loading…
Reference in New Issue
Block a user