mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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() {
|
module.directive('tagColorFromName', function() {
|
||||||
|
|
||||||
function djb2(str) {
|
function djb2(str) {
|
||||||
|
@ -123,7 +123,9 @@ function (angular, app, _, $) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.optionSelected = function(option) {
|
scope.optionSelected = function(option) {
|
||||||
if (!variable.multi) {
|
option.selected = !option.selected;
|
||||||
|
|
||||||
|
if (!variable.multi || option.text === 'All') {
|
||||||
_.each(scope.options, function(other) {
|
_.each(scope.options, function(other) {
|
||||||
if (option !== other) {
|
if (option !== other) {
|
||||||
other.selected = false;
|
other.selected = false;
|
||||||
@ -133,19 +135,16 @@ function (angular, app, _, $) {
|
|||||||
|
|
||||||
var selected = _.filter(scope.options, {selected: true});
|
var selected = _.filter(scope.options, {selected: true});
|
||||||
|
|
||||||
|
// enfore the first selected if no option is selected
|
||||||
if (selected.length === 0) {
|
if (selected.length === 0) {
|
||||||
// encode the first selected if no option is selected
|
|
||||||
scope.options[0].selected = true;
|
scope.options[0].selected = true;
|
||||||
$timeout(function() {
|
selected = [scope.options[0]];
|
||||||
scope.optionSelected(scope.options[0]);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected.length > 1) {
|
if (selected.length > 1) {
|
||||||
if (selected[0].text === 'All') {
|
if (selected[0].text === 'All') {
|
||||||
|
selected[0].selected = false;
|
||||||
selected = selected.slice(1, selected.length);
|
selected = selected.slice(1, selected.length);
|
||||||
debugger;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +159,7 @@ function (angular, app, _, $) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scope.updateLinkText();
|
scope.updateLinkText();
|
||||||
|
scope.onUpdated();
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.hide = function() {
|
scope.hide = function() {
|
||||||
@ -187,7 +187,7 @@ function (angular, app, _, $) {
|
|||||||
scope.linkText += variable.current.text;
|
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();
|
scope.updateLinkText();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -12,12 +12,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="variable-options-container" ng-if="!query.tagcloud">
|
<div class="variable-options-container" ng-if="!query.tagcloud">
|
||||||
<div class="variable-option pointer" bindonce ng-repeat="option in options"
|
<a class="variable-option pointer" bindonce ng-repeat="option in options"
|
||||||
ng-class="{'selected': selected}" ng-href="{{row.url}}">
|
ng-class="{'selected': option.selected}" ng-click="optionSelected(option)">
|
||||||
<i class="variable-option-check"></i>
|
<i class="fa fa-fw fa-square-o"></i>
|
||||||
<label for="var.option.{{$id}}" label">{{option.text}}</label>
|
<i class="fa fa-fw fa-check-square-o"></i>
|
||||||
</div>
|
<span >{{option.text}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -43,5 +43,21 @@
|
|||||||
|
|
||||||
.variable-option {
|
.variable-option {
|
||||||
display: block;
|
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