mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fixed issue in metric_segment
This commit is contained in:
parent
04a5ad529c
commit
dacfa6b978
@ -186,25 +186,27 @@ function (_, $, coreModule) {
|
|||||||
|
|
||||||
$scope.getOptionsInternal = function() {
|
$scope.getOptionsInternal = function() {
|
||||||
if ($scope.options) {
|
if ($scope.options) {
|
||||||
var optionSegments = _.map($scope.options, function(option) {
|
cachedOptions = _.map($scope.options, function(option) {
|
||||||
return uiSegmentSrv.newSegment({value: option.text});
|
return uiSegmentSrv.newSegment({value: option.text});
|
||||||
});
|
});
|
||||||
return $q.when(optionSegments);
|
return $q.when(cachedOptions);
|
||||||
} else {
|
} else {
|
||||||
return $scope.getOptions().then(function(options) {
|
return $scope.getOptions().then(function(options) {
|
||||||
cachedOptions = options;
|
cachedOptions =_.map(options, function(option) {
|
||||||
return _.map(options, function(option) {
|
if (option.html) {
|
||||||
|
return option;
|
||||||
|
}
|
||||||
return uiSegmentSrv.newSegment({value: option.text});
|
return uiSegmentSrv.newSegment({value: option.text});
|
||||||
});
|
});
|
||||||
|
return cachedOptions;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.onSegmentChange = function() {
|
$scope.onSegmentChange = function() {
|
||||||
var options = $scope.options || cachedOptions;
|
|
||||||
|
|
||||||
if (options) {
|
if (cachedOptions) {
|
||||||
var option = _.find(options, {text: $scope.segment.value});
|
var option = _.find(cachedOptions, {value: $scope.segment.value});
|
||||||
if (option && option.value !== $scope.property) {
|
if (option && option.value !== $scope.property) {
|
||||||
$scope.property = option.value;
|
$scope.property = option.value;
|
||||||
} else if (attrs.custom !== 'false') {
|
} else if (attrs.custom !== 'false') {
|
||||||
|
Loading…
Reference in New Issue
Block a user