mirror of
https://github.com/grafana/grafana.git
synced 2025-01-18 20:43:26 -06:00
Multi selecting starting to work
This commit is contained in:
parent
3334e36397
commit
6e0947c0d9
@ -136,7 +136,6 @@ function (angular, _, config) {
|
||||
|
||||
});
|
||||
|
||||
|
||||
module.directive('tagColorFromName', function() {
|
||||
|
||||
function djb2(str) {
|
||||
|
@ -123,7 +123,9 @@ function (angular, app, _, $) {
|
||||
};
|
||||
|
||||
scope.optionSelected = function(option) {
|
||||
if (!variable.multi) {
|
||||
option.selected = !option.selected;
|
||||
|
||||
if (!variable.multi || option.text === 'All') {
|
||||
_.each(scope.options, function(other) {
|
||||
if (option !== other) {
|
||||
other.selected = false;
|
||||
@ -133,19 +135,16 @@ function (angular, app, _, $) {
|
||||
|
||||
var selected = _.filter(scope.options, {selected: true});
|
||||
|
||||
// enfore the first selected if no option is selected
|
||||
if (selected.length === 0) {
|
||||
// encode the first selected if no option is selected
|
||||
scope.options[0].selected = true;
|
||||
$timeout(function() {
|
||||
scope.optionSelected(scope.options[0]);
|
||||
});
|
||||
return;
|
||||
selected = [scope.options[0]];
|
||||
}
|
||||
|
||||
if (selected.length > 1) {
|
||||
if (selected[0].text === 'All') {
|
||||
selected[0].selected = false;
|
||||
selected = selected.slice(1, selected.length);
|
||||
debugger;
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,6 +159,7 @@ function (angular, app, _, $) {
|
||||
}
|
||||
|
||||
scope.updateLinkText();
|
||||
scope.onUpdated();
|
||||
};
|
||||
|
||||
scope.hide = function() {
|
||||
@ -187,7 +187,7 @@ function (angular, app, _, $) {
|
||||
scope.linkText += variable.current.text;
|
||||
};
|
||||
|
||||
scope.$watchGroup(['variable.hideLabel', 'variable.name', 'variable.label'], function() {
|
||||
scope.$watchGroup(['variable.hideLabel', 'variable.name', 'variable.label', 'variable.current.text'], function() {
|
||||
scope.updateLinkText();
|
||||
});
|
||||
},
|
||||
|
@ -12,12 +12,13 @@
|
||||
</div>
|
||||
|
||||
<div class="variable-options-container" ng-if="!query.tagcloud">
|
||||
<div class="variable-option pointer" bindonce ng-repeat="option in options"
|
||||
ng-class="{'selected': selected}" ng-href="{{row.url}}">
|
||||
<i class="variable-option-check"></i>
|
||||
<label for="var.option.{{$id}}" label">{{option.text}}</label>
|
||||
</div>
|
||||
<a class="variable-option pointer" bindonce ng-repeat="option in options"
|
||||
ng-class="{'selected': option.selected}" ng-click="optionSelected(option)">
|
||||
<i class="fa fa-fw fa-square-o"></i>
|
||||
<i class="fa fa-fw fa-check-square-o"></i>
|
||||
<span >{{option.text}}</label>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -43,5 +43,21 @@
|
||||
|
||||
.variable-option {
|
||||
display: block;
|
||||
.fa {
|
||||
font-size: 130%;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
.fa-check-square-o { display: none; }
|
||||
|
||||
&.selected {
|
||||
.fa-square-o {
|
||||
display: none;
|
||||
}
|
||||
.fa-check-square-o {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user