Fix item selection.

This commit is contained in:
Alexander Zobnin
2015-05-25 00:03:26 +03:00
parent 69d889b5c2
commit aa424af15b

View File

@@ -189,13 +189,6 @@ function (angular, _) {
$scope.datasource.performAppSuggestQuery(hostid).then(function (series) { $scope.datasource.performAppSuggestQuery(hostid).then(function (series) {
$scope.metric.applicationList = $scope.metric.applicationList.concat(series); $scope.metric.applicationList = $scope.metric.applicationList.concat(series);
// Add templated variables
_.each(templateSrv.variables, function(variable) {
$scope.metric.applicationList.push({
name: '$' + variable.name
})
});
if ($scope.target.application) { if ($scope.target.application) {
$scope.target.application = $scope.metric.applicationList.filter(function (item, index, array) { $scope.target.application = $scope.metric.applicationList.filter(function (item, index, array) {
// Find selected application in metric.hostList // Find selected application in metric.hostList
@@ -225,13 +218,13 @@ function (angular, _) {
} }
}); });
}); });
} } else {
if ($scope.target.item) {
if ($scope.target.item) { $scope.target.item = $scope.metric.itemList.filter(function (item, index, array) {
$scope.target.item = $scope.metric.itemList.filter(function (item, index, array) { // Find selected item in metric.hostList
// Find selected item in metric.hostList return (item.name == $scope.target.item.name);
return (item.name == $scope.target.item.name); }).pop();
}).pop(); }
} }
}; };