Fix update host group, host, application and item lists.
This commit is contained in:
@@ -21,7 +21,11 @@ function (angular, _) {
|
|||||||
|
|
||||||
// Update host group, host, application and item lists
|
// Update host group, host, application and item lists
|
||||||
$scope.updateHostGroupList();
|
$scope.updateHostGroupList();
|
||||||
|
if ($scope.target.hostGroup) {
|
||||||
|
$scope.updateHostList($scope.target.hostGroup.groupid);
|
||||||
|
} else {
|
||||||
$scope.updateHostList();
|
$scope.updateHostList();
|
||||||
|
}
|
||||||
if ($scope.target.host) {
|
if ($scope.target.host) {
|
||||||
$scope.updateAppList($scope.target.host.hostid);
|
$scope.updateAppList($scope.target.host.hostid);
|
||||||
if ($scope.target.application) {
|
if ($scope.target.application) {
|
||||||
@@ -131,7 +135,6 @@ function (angular, _) {
|
|||||||
$scope.metric.hostGroupList = series;
|
$scope.metric.hostGroupList = series;
|
||||||
if ($scope.target.hostGroup) {
|
if ($scope.target.hostGroup) {
|
||||||
$scope.target.hostGroup = $scope.metric.hostGroupList.filter(function (item, index, array) {
|
$scope.target.hostGroup = $scope.metric.hostGroupList.filter(function (item, index, array) {
|
||||||
|
|
||||||
// Find selected host in metric.hostList
|
// Find selected host in metric.hostList
|
||||||
return (item.groupid == $scope.target.hostGroup.groupid);
|
return (item.groupid == $scope.target.hostGroup.groupid);
|
||||||
}).pop();
|
}).pop();
|
||||||
@@ -146,11 +149,13 @@ function (angular, _) {
|
|||||||
$scope.updateHostList = function(groupid) {
|
$scope.updateHostList = function(groupid) {
|
||||||
$scope.datasource.performHostSuggestQuery(groupid).then(function (series) {
|
$scope.datasource.performHostSuggestQuery(groupid).then(function (series) {
|
||||||
$scope.metric.hostList = series;
|
$scope.metric.hostList = series;
|
||||||
$scope.target.host = $scope.metric.hostList.filter(function (item, index, array) {
|
|
||||||
|
|
||||||
|
if ($scope.target.host) {
|
||||||
|
$scope.target.host = $scope.metric.hostList.filter(function (item, index, array) {
|
||||||
// Find selected host in metric.hostList
|
// Find selected host in metric.hostList
|
||||||
return (item.hostid == $scope.target.host.hostid);
|
return (item.hostid == $scope.target.host.hostid);
|
||||||
}).pop();
|
}).pop();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -163,7 +168,6 @@ function (angular, _) {
|
|||||||
$scope.metric.applicationList = series;
|
$scope.metric.applicationList = series;
|
||||||
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
|
||||||
return (item.applicationid == $scope.target.application.applicationid);
|
return (item.applicationid == $scope.target.application.applicationid);
|
||||||
}).pop();
|
}).pop();
|
||||||
@@ -188,11 +192,12 @@ function (angular, _) {
|
|||||||
item.expandedName = expandItemName(item);
|
item.expandedName = expandItemName(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.itemid == $scope.target.item.itemid);
|
return (item.itemid == $scope.target.item.itemid);
|
||||||
}).pop();
|
}).pop();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$scope.metric.itemList = [];
|
$scope.metric.itemList = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user