(templating) update dynamic dashboard only if variable is changed

This commit is contained in:
Mitsuhiro Tanda
2016-05-16 19:26:24 +09:00
parent 3b85901b95
commit f585d22ce7
@@ -27,10 +27,15 @@ function (angular, _, kbn) {
.filter(function(variable) {
return variable.refresh === 2;
}).map(function(variable) {
var previousVariable = angular.copy(variable);
return self.updateOptions(variable).then(function () {
return self.variableUpdated(variable).then(function () {
dynamicDashboardSrv.update(self.dashboard);
$rootScope.$emit('template-variable-value-updated');
var updatedVariable = angular.copy(variable);
delete(updatedVariable.$$hashKey);
if (JSON.stringify(previousVariable) !== JSON.stringify(updatedVariable)) {
dynamicDashboardSrv.update(self.dashboard);
$rootScope.$emit('template-variable-value-updated');
}
});
});
});