mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed tag selection issues
This commit is contained in:
parent
0992b6a616
commit
650d3d5046
@ -31,7 +31,7 @@ function (angular, app, _) {
|
|||||||
|
|
||||||
vm.search = {query: '', options: vm.options};
|
vm.search = {query: '', options: vm.options};
|
||||||
vm.selectedValuesCount = currentValues.length;
|
vm.selectedValuesCount = currentValues.length;
|
||||||
vm.selectedTags = vm.selectedTag || [];
|
vm.selectedTags = vm.selectedTags || [];
|
||||||
|
|
||||||
if (!vm.tags) {
|
if (!vm.tags) {
|
||||||
vm.tags = _.map(vm.variable.tags, function(value) {
|
vm.tags = _.map(vm.variable.tags, function(value) {
|
||||||
@ -76,7 +76,6 @@ function (angular, app, _) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
vm.selectedTags = _.filter(vm.tags, {selected: true});
|
|
||||||
vm.selectionsChanged(false);
|
vm.selectionsChanged(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -168,10 +167,9 @@ function (angular, app, _) {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
vm.variable.current = {};
|
|
||||||
vm.variable.current.value = _.pluck(selected, 'value');
|
vm.variable.current.value = _.pluck(selected, 'value');
|
||||||
vm.variable.current.text = _.pluck(valuesNotInTag, 'text').join(', ');
|
vm.variable.current.text = _.pluck(valuesNotInTag, 'text').join(', ');
|
||||||
vm.selectedValuesCount = vm.variable.current.value.length;
|
vm.selectedValuesCount = selected.length;
|
||||||
|
|
||||||
// only single value
|
// only single value
|
||||||
if (vm.selectedValuesCount === 1) {
|
if (vm.selectedValuesCount === 1) {
|
||||||
|
@ -78,7 +78,7 @@ function (angular, _, kbn) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.setVariableValue = function(variable, option) {
|
this.setVariableValue = function(variable, option) {
|
||||||
variable.current = option;
|
variable.current = angular.copy(option);
|
||||||
templateSrv.updateTemplateData();
|
templateSrv.updateTemplateData();
|
||||||
return this.updateOptionsInChildVariables(variable);
|
return this.updateOptionsInChildVariables(variable);
|
||||||
};
|
};
|
||||||
|
@ -74,6 +74,18 @@ function () {
|
|||||||
expect(ctrl.options[2].selected).to.be(true);
|
expect(ctrl.options[2].selected).to.be(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('and then dropdown is opened and closed without changes', function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
ctrl.show();
|
||||||
|
ctrl.commitChanges();
|
||||||
|
rootScope.$digest();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should still have selected tag", function() {
|
||||||
|
expect(ctrl.selectedTags.length).to.be(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('and then unselected', function() {
|
describe('and then unselected', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
ctrl.selectTag(ctrl.tags[0]);
|
ctrl.selectTag(ctrl.tags[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user