Fixed update of host list and item list when host or item not selected.

This commit is contained in:
Alexander Zobnin
2015-05-08 22:55:05 +03:00
parent 4b44329230
commit 6ea38462f6

View File

@@ -135,7 +135,6 @@ function (angular, _) {
$scope.metric.hostGroupList = series;
if ($scope.target.hostGroup) {
$scope.target.hostGroup = $scope.metric.hostGroupList.filter(function (item, index, array) {
// Find selected host in metric.hostList
return (item.groupid == $scope.target.hostGroup.groupid);
}).pop();
@@ -150,11 +149,13 @@ function (angular, _) {
$scope.updateHostList = function(groupid) {
$scope.datasource.performHostSuggestQuery(groupid).then(function (series) {
$scope.metric.hostList = series;
$scope.target.host = $scope.metric.hostList.filter(function (item, index, array) {
// Find selected host in metric.hostList
return (item.hostid == $scope.target.host.hostid);
}).pop();
if ($scope.target.host) {
$scope.target.host = $scope.metric.hostList.filter(function (item, index, array) {
// Find selected host in metric.hostList
return (item.hostid == $scope.target.host.hostid);
}).pop();
}
});
};
@@ -167,7 +168,6 @@ function (angular, _) {
$scope.metric.applicationList = series;
if ($scope.target.application) {
$scope.target.application = $scope.metric.applicationList.filter(function (item, index, array) {
// Find selected application in metric.hostList
return (item.applicationid == $scope.target.application.applicationid);
}).pop();
@@ -192,11 +192,12 @@ function (angular, _) {
item.expandedName = expandItemName(item);
}
});
$scope.target.item = $scope.metric.itemList.filter(function (item, index, array) {
// Find selected item in metric.hostList
return (item.itemid == $scope.target.item.itemid);
}).pop();
if ($scope.target.item) {
$scope.target.item = $scope.metric.itemList.filter(function (item, index, array) {
// Find selected item in metric.hostList
return (item.itemid == $scope.target.item.itemid);
}).pop();
}
});
} else {
$scope.metric.itemList = [];