mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
added comment, variableChange -> variableValueChange
This commit is contained in:
parent
609b0fa498
commit
b122f53085
@ -16,13 +16,13 @@ const template = `
|
||||
|
||||
<form name="ctrl.saveForm" ng-submit="ctrl.save()" class="modal-content" novalidate>
|
||||
<div class="p-t-1">
|
||||
<div class="gf-form-group" ng-if="ctrl.timeChange || ctrl.variableChange">
|
||||
<div class="gf-form-group" ng-if="ctrl.timeChange || ctrl.variableValueChange">
|
||||
<gf-form-switch class="gf-form"
|
||||
label="Save current time range" ng-if="ctrl.timeChange" label-class="width-12" switch-class="max-width-6"
|
||||
checked="ctrl.saveTimerange" on-change="buildUrl()">
|
||||
</gf-form-switch>
|
||||
<gf-form-switch class="gf-form"
|
||||
label="Save current variables" ng-if="ctrl.variableChange" label-class="width-12" switch-class="max-width-6"
|
||||
label="Save current variables" ng-if="ctrl.variableValueChange" label-class="width-12" switch-class="max-width-6"
|
||||
checked="ctrl.saveVariables" on-change="buildUrl()">
|
||||
</gf-form-switch>
|
||||
</div>
|
||||
@ -70,7 +70,7 @@ export class SaveDashboardModalCtrl {
|
||||
saveForm: any;
|
||||
dismiss: () => void;
|
||||
timeChange = false;
|
||||
variableChange = false;
|
||||
variableValueChange = false;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(private dashboardSrv) {
|
||||
@ -91,21 +91,24 @@ export class SaveDashboardModalCtrl {
|
||||
}
|
||||
|
||||
compareTemplating() {
|
||||
//checks if variables has been added or removed, if so variables will be saved automatically
|
||||
if (this.dashboardSrv.dash.originalTemplating.length !== this.dashboardSrv.dash.templating.list.length) {
|
||||
return (this.variableChange = false);
|
||||
return (this.variableValueChange = false);
|
||||
}
|
||||
|
||||
//checks if variable value has changed
|
||||
if (this.dashboardSrv.dash.templating.list.length > 0) {
|
||||
for (let i = 0; i < this.dashboardSrv.dash.templating.list.length; i++) {
|
||||
if (
|
||||
this.dashboardSrv.dash.templating.list[i].current.text !==
|
||||
this.dashboardSrv.dash.originalTemplating[i].current.text
|
||||
) {
|
||||
return (this.variableChange = true);
|
||||
return (this.variableValueChange = true);
|
||||
}
|
||||
}
|
||||
return (this.variableChange = false);
|
||||
return (this.variableValueChange = false);
|
||||
} else {
|
||||
return (this.variableChange = false);
|
||||
return (this.variableValueChange = false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user