Commit 77843623 by Alexander Zobnin Committed by Torkel Ödegaard

don't save dashboard on make editable, #10236

parent d4ff603e
...@@ -80,6 +80,8 @@ export class DashboardSrv { ...@@ -80,6 +80,8 @@ export class DashboardSrv {
this.$rootScope.appEvent('dashboard-saved', this.dash); this.$rootScope.appEvent('dashboard-saved', this.dash);
this.$rootScope.appEvent('alert-success', ['Dashboard saved']); this.$rootScope.appEvent('alert-success', ['Dashboard saved']);
return this.dash;
} }
save(clone, options) { save(clone, options) {
......
...@@ -4,47 +4,47 @@ import coreModule from 'app/core/core_module'; ...@@ -4,47 +4,47 @@ import coreModule from 'app/core/core_module';
const template = ` const template = `
<div class="modal-body"> <div class="modal-body">
<div class="modal-header"> <div class="modal-header">
<h2 class="modal-header-title"> <h2 class="modal-header-title">
<i class="fa fa-save"></i> <i class="fa fa-save"></i>
<span class="p-l-1">Save changes</span> <span class="p-l-1">Save changes</span>
</h2> </h2>
<a class="modal-header-close" ng-click="ctrl.dismiss();"> <a class="modal-header-close" ng-click="ctrl.dismiss();">
<i class="fa fa-remove"></i> <i class="fa fa-remove"></i>
</a> </a>
</div> </div>
<form name="ctrl.saveForm" ng-submit="ctrl.save()" class="modal-content" novalidate> <form name="ctrl.saveForm" ng-submit="ctrl.save()" class="modal-content" novalidate>
<h6 class="text-center">Add a note to describe your changes</h6> <h6 class="text-center">Add a note to describe your changes</h6>
<div class="p-t-2"> <div class="p-t-2">
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-hint"> <label class="gf-form-hint">
<input <input
type="text" type="text"
name="message" name="message"
class="gf-form-input" class="gf-form-input"
placeholder="Updates to &hellip;" placeholder="Updates to &hellip;"
give-focus="true" give-focus="true"
ng-model="ctrl.message" ng-model="ctrl.message"
ng-model-options="{allowInvalid: true}" ng-model-options="{allowInvalid: true}"
ng-maxlength="this.max" ng-maxlength="this.max"
autocomplete="off" /> autocomplete="off" />
<small class="gf-form-hint-text muted" ng-cloak> <small class="gf-form-hint-text muted" ng-cloak>
<span ng-class="{'text-error': ctrl.saveForm.message.$invalid && ctrl.saveForm.message.$dirty }"> <span ng-class="{'text-error': ctrl.saveForm.message.$invalid && ctrl.saveForm.message.$dirty }">
{{ctrl.message.length || 0}} {{ctrl.message.length || 0}}
</span> </span>
/ {{ctrl.max}} characters / {{ctrl.max}} characters
</small> </small>
</label> </label>
</div> </div>
</div> </div>
<div class="gf-form-button-row text-center"> <div class="gf-form-button-row text-center">
<button type="submit" class="btn btn-success" ng-disabled="ctrl.saveForm.$invalid">Save</button> <button type="submit" class="btn btn-success" ng-disabled="ctrl.saveForm.$invalid">Save</button>
<button class="btn btn-inverse" ng-click="ctrl.dismiss();">Cancel</button> <button class="btn btn-inverse" ng-click="ctrl.dismiss();">Cancel</button>
</div> </div>
</form> </form>
</div> </div>
`; `;
......
...@@ -128,9 +128,19 @@ export class SettingsCtrl { ...@@ -128,9 +128,19 @@ export class SettingsCtrl {
makeEditable() { makeEditable() {
this.dashboard.editable = true; this.dashboard.editable = true;
this.dashboard.meta.canMakeEditable = false;
this.dashboard.meta.canEdit = true;
this.dashboard.meta.canSave = true;
this.canDelete = true;
this.viewId = 'settings';
this.buildSectionList();
const currentSection = _.find(this.sections, { id: this.viewId });
this.$location.url(currentSection.url);
this.onRouteUpdated();
return this.dashboardSrv.saveDashboard({ makeEditable: true, overwrite: false }).then(() => { // Force dashboard reload after saving to update view
// force refresh whole page appEvents.on('dashboard-saved', () => {
window.location.href = window.location.href; window.location.href = window.location.href;
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment