diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index ac2f5bb5975..b2bed74a4ce 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -57,10 +57,6 @@ function (angular, _, kbn) { var option = _.findWhere(variable.options, { text: urlValue }); option = option || { text: urlValue, value: urlValue }; - if (_.isArray(urlValue)) { - option.text = urlValue.join(', '); - } - this.updateAutoInterval(variable); return this.setVariableValue(variable, option); }; @@ -79,6 +75,11 @@ function (angular, _, kbn) { this.setVariableValue = function(variable, option) { variable.current = angular.copy(option); + + if (_.isArray(variable.current.value)) { + variable.current.text = variable.current.value.join(' + '); + } + templateSrv.updateTemplateData(); return this.updateOptionsInChildVariables(variable); }; @@ -127,6 +128,7 @@ function (angular, _, kbn) { this.validateVariableSelectionState = function(variable) { if (!variable.current) { + if (!variable.options.length) { return; } return self.setVariableValue(variable, variable.options[0]); } diff --git a/public/css/less/submenu.less b/public/css/less/submenu.less index 9f4653600bc..7cd15d183f2 100644 --- a/public/css/less/submenu.less +++ b/public/css/less/submenu.less @@ -132,5 +132,7 @@ } .dash-nav-link { + padding: 8px 7px; + display: inline-block; color: @textColor; } diff --git a/public/test/specs/templateValuesSrv-specs.js b/public/test/specs/templateValuesSrv-specs.js index 2ff287b8b6d..359ccc98540 100644 --- a/public/test/specs/templateValuesSrv-specs.js +++ b/public/test/specs/templateValuesSrv-specs.js @@ -68,7 +68,7 @@ define([ expect(variable.current.value.length).to.be(2); expect(variable.current.value[0]).to.be("new"); expect(variable.current.value[1]).to.be("other"); - expect(variable.current.text).to.be("new, other"); + expect(variable.current.text).to.be("new + other"); }); });