Commit 0bb30b14 by Patrick O'Carroll Committed by Marcus Efraimsson

save-modal save button (#12047)

Disable save dashboard button when saving
parent dbaa45e5
...@@ -50,8 +50,17 @@ const template = ` ...@@ -50,8 +50,17 @@ const template = `
</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
<a class="btn btn-link" ng-click="ctrl.dismiss();">Cancel</a> id="saveBtn"
type="submit"
class="btn btn-success"
ng-class="{'btn-success--processing': ctrl.isSaving}"
ng-disabled="ctrl.saveForm.$invalid || ctrl.isSaving"
>
<span ng-if="!ctrl.isSaving">Save</span>
<span ng-if="ctrl.isSaving === true">Saving...</span>
</button>
<button class="btn btn-inverse" ng-click="ctrl.dismiss();">Cancel</button>
</div> </div>
</form> </form>
</div> </div>
...@@ -68,6 +77,7 @@ export class SaveDashboardModalCtrl { ...@@ -68,6 +77,7 @@ export class SaveDashboardModalCtrl {
originalCurrent = []; originalCurrent = [];
max: number; max: number;
saveForm: any; saveForm: any;
isSaving: boolean;
dismiss: () => void; dismiss: () => void;
timeChange = false; timeChange = false;
variableValueChange = false; variableValueChange = false;
...@@ -76,6 +86,7 @@ export class SaveDashboardModalCtrl { ...@@ -76,6 +86,7 @@ export class SaveDashboardModalCtrl {
constructor(private dashboardSrv) { constructor(private dashboardSrv) {
this.message = ''; this.message = '';
this.max = 64; this.max = 64;
this.isSaving = false;
this.templating = dashboardSrv.dash.templating.list; this.templating = dashboardSrv.dash.templating.list;
this.compareTemplating(); this.compareTemplating();
...@@ -126,6 +137,8 @@ export class SaveDashboardModalCtrl { ...@@ -126,6 +137,8 @@ export class SaveDashboardModalCtrl {
var dashboard = this.dashboardSrv.getCurrent(); var dashboard = this.dashboardSrv.getCurrent();
var saveModel = dashboard.getSaveModelClone(options); var saveModel = dashboard.getSaveModelClone(options);
this.isSaving = true;
return this.dashboardSrv.save(saveModel, options).then(this.dismiss); return this.dashboardSrv.save(saveModel, options).then(this.dismiss);
} }
} }
......
...@@ -100,6 +100,22 @@ ...@@ -100,6 +100,22 @@
// Success appears as green // Success appears as green
.btn-success { .btn-success {
@include buttonBackground($btn-success-bg, $btn-success-bg-hl); @include buttonBackground($btn-success-bg, $btn-success-bg-hl);
&--processing {
@include button-outline-variant($gray-1);
@include box-shadow(none);
cursor: default;
&:hover,
&:active,
&:active:hover,
&:focus,
&:disabled {
color: $gray-1;
background-color: transparent;
border-color: $gray-1;
}
}
} }
// Info appears as a neutral blue // Info appears as a neutral blue
.btn-secondary { .btn-secondary {
......
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