From 9f777a535b9593fa59bf5e1631a406059487a4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 23 Jul 2016 13:29:48 +0200 Subject: [PATCH 1/2] fix(): removed dashboard version to schema version migration --- public/app/features/dashboard/dashboardSrv.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 937d5266c56..19590ec0c0e 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -16,10 +16,6 @@ function (angular, $, _, moment) { data = {}; } - if (!data.id && data.version) { - data.schemaVersion = data.version; - } - this.id = data.id || null; this.title = data.title || 'No Title'; this.autoUpdate = data.autoUpdate; From 0de0f4d014da5ebe5c84bfcc5fd20389dfec2859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 25 Jul 2016 12:02:59 +0200 Subject: [PATCH 2/2] feat(templating): fixed issue with template variables set to reload on dashboard load being issued multiple times, fixes #5637 --- .../features/templating/templateValuesSrv.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index fb751a2ce3a..9ecb02f0a0b 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -10,6 +10,7 @@ function (angular, _, kbn) { module.service('templateValuesSrv', function($q, $rootScope, datasourceSrv, $location, templateSrv, timeSrv) { var self = this; + this.variableLock = {}; function getNoneOption() { return { text: 'None', value: '', isNone: true }; } @@ -90,6 +91,8 @@ function (angular, _, kbn) { } else { lock.resolve(); } + }).finally(function() { + delete self.variableLock[variable.name]; }); }; @@ -124,7 +127,7 @@ function (angular, _, kbn) { templateSrv.setGrafanaVariable('$__auto_interval', interval); }; - this.setVariableValue = function(variable, option, initPhase) { + this.setVariableValue = function(variable, option) { variable.current = angular.copy(option); if (_.isArray(variable.current.text)) { @@ -134,13 +137,7 @@ function (angular, _, kbn) { self.selectOptionsForCurrentValue(variable); templateSrv.updateTemplateData(); - // on first load, variable loading is ordered to ensure - // that parents are updated before children. - if (initPhase) { - return $q.when(); - } - - return self.updateOptionsInChildVariables(variable); + return this.updateOptionsInChildVariables(variable); }; this.variableUpdated = function(variable) { @@ -149,6 +146,11 @@ function (angular, _, kbn) { }; this.updateOptionsInChildVariables = function(updatedVariable) { + // if there is a variable lock ignore cascading update because we are in a boot up scenario + if (self.variableLock[updatedVariable.name]) { + return $q.when(); + } + var promises = _.map(self.variables, function(otherVariable) { if (otherVariable === updatedVariable) { return;