Merged with basic host_view frontend
This commit is contained in:
parent
f5f549391c
commit
72228d566d
@ -109,10 +109,10 @@ angular.module('adagios.live')
|
||||
});
|
||||
}])
|
||||
|
||||
.factory('getObjectId', ['$http', function($http) {
|
||||
.factory('getObjectId', ['$http', function ($http) {
|
||||
return function (objectType, objectName) {
|
||||
|
||||
var postData, postString, req;
|
||||
var postString, req;
|
||||
|
||||
postString = "with_fields=id&object_type=" + objectType + "&host_name=" + objectName;
|
||||
|
||||
@ -132,7 +132,7 @@ angular.module('adagios.live')
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('getHostById', ['$http', function($http) {
|
||||
.factory('getHostById', ['$http', function ($http) {
|
||||
return function (objectId) {
|
||||
|
||||
var postString, req;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<td>{{key}}</td>
|
||||
<td>{{value}}</td>
|
||||
</tr>
|
||||
<tr ng-repeat="key, value in data.config">
|
||||
<tr ng-repeat="(key, value) in data.config">
|
||||
<td>{{key}}</td>
|
||||
<td>{{value}}</td>
|
||||
</tr>
|
||||
|
@ -16,7 +16,7 @@ angular.module('adagios.view.host_view', ['ngRoute',
|
||||
.controller('HostViewCtrl', ['$http', '$scope', '$routeParams', 'getObjectId', 'getHostById',
|
||||
function ($http, $scope, $routeParams, getObjectId, getHostById) {
|
||||
|
||||
$scope.data = {}
|
||||
$scope.data = {};
|
||||
|
||||
if (!!$routeParams.host) {
|
||||
$scope.hostName = $routeParams.host;
|
||||
@ -30,23 +30,22 @@ angular.module('adagios.view.host_view', ['ngRoute',
|
||||
|
||||
$http.get('/rest/status/json/hosts/?host_name=' + host)
|
||||
.success(function (data) {
|
||||
$scope.data = objectData['live'] = data[0];
|
||||
$scope.data = objectData.live = data[0];
|
||||
});
|
||||
|
||||
objectType = 'host';
|
||||
getObjectId(objectType, host)
|
||||
.success(function (data) {
|
||||
objectId = data[0]["id"];
|
||||
$scope.data["id"] = objectId;
|
||||
objectId = data[0].id;
|
||||
$scope.data.id = objectId;
|
||||
getHostById(objectId)
|
||||
.success(function (data) {
|
||||
$scope.data['config'] = data;
|
||||
})
|
||||
$scope.data.config = data;
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
getData($scope.host);
|
||||
|
||||
getData($scope.hostName);
|
||||
}]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user