Make dashboard JSON editable

This commit is contained in:
Andrzej Ressel 2018-04-08 20:00:18 +02:00
parent ce787b88bf
commit dc11f1da81
2 changed files with 12 additions and 2 deletions

View File

@ -100,7 +100,7 @@ export class DashboardSrv {
.catch(this.handleSaveDashboardError.bind(this, clone, options));
}
saveDashboard(options, clone) {
saveDashboard(options?, clone?) {
if (clone) {
this.setCurrent(this.create(clone, this.dash.meta));
}
@ -120,6 +120,10 @@ export class DashboardSrv {
return this.save(this.dash.getSaveModelClone(), options);
}
saveJSONDashboard(json: string) {
return this.save(JSON.parse(json), {});
}
showSaveAsModal() {
this.$rootScope.appEvent('show-modal', {
templateHtml: '<save-dashboard-as-modal dismiss="dismiss()"></save-dashboard-as-modal>',

View File

@ -134,7 +134,13 @@ export class SettingsCtrl {
}
saveDashboard() {
this.dashboardSrv.saveDashboard();
if (this.viewId === 'view_json') {
this.dashboardSrv.saveJSONDashboard(this.json).then(() => {
window.location.reload();
});
} else {
this.dashboardSrv.saveDashboard();
}
}
onPostSave() {