Skip to content
This repository was archived by the owner on Sep 17, 2019. It is now read-only.

Commit b25116d

Browse files
committed
add new
1 parent 8d91232 commit b25116d

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

‎app/hosts/hosts.html‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ <h3 class="modal-title">{{type}}主机</h3>
6767
<th ng-click="orderBy('appset.name')">
6868
所属应用集 <i class="fa fa-sort-amount-asc fa-fw"></i>
6969
</th>
70+
<th>
71+
客户端状态
72+
</th>
7073
<th>监控路径</th>
7174
<th></th>
7275
</thead>
@@ -76,6 +79,9 @@ <h3 class="modal-title">{{type}}主机</h3>
7679
<td class="table-td-padding">{{host.name}}</td>
7780
<td class="table-td-padding">{{host.ip}}</td>
7881
<td class="table-td-padding">{{host.appset.name}}</td>
82+
<td class="table-td-padding">
83+
{{getStatus(host.id)}}
84+
</td>
7985
<td class="table-td-padding">
8086
<ul class="list-unstyled list-no-margin">
8187
<li ng-repeat="p in host.path">{{p.path}}</li>

‎app/hosts/hosts.js‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ angular.module('ModuleAB.hosts', ['ngRoute'])
1111

1212
.controller('hosts', ['$scope', '$http', '$uibModal', '$rootScope',
1313
function($scope, $http, $uibModal, $rootScope) {
14+
var clientStatus;
1415
$scope.currentPage = 1;
1516
$scope.numPerPage = 15;
1617
$scope.hostsGet = function() {
@@ -35,7 +36,19 @@ angular.module('ModuleAB.hosts', ['ngRoute'])
3536
});
3637
};
3738

39+
$scope.hostsRunGet = function() {
40+
$http({
41+
method: "GET",
42+
url: "/api/v1/client/config/status"
43+
}).then(function(response) {
44+
clientStatus = response.data;
45+
}, function(response) {
46+
clientStatus = null;
47+
});
48+
};
49+
3850
$scope.hostsGet();
51+
$scope.hostsRunGet();
3952

4053
$scope.hostEdit = function(type, host) {
4154
var modal = $uibModal.open({
@@ -59,6 +72,19 @@ angular.module('ModuleAB.hosts', ['ngRoute'])
5972
$scope.order = o;
6073
}
6174

75+
$scope.getStatus = function(id) {
76+
var s = '<i class="fa {0} fa-fw"></i> {1}'
77+
try {
78+
if (clientStatus[id] === 1) {
79+
return s.format('fa-check', '运行中');
80+
} else {
81+
return s.format('fa-times', '未运行');
82+
}
83+
} catch (e) {
84+
return s.format('fa-question', '未知');
85+
}
86+
}
87+
6288
$scope.delete = function(host) {
6389
var modal = $uibModal.open({
6490
templateUrl: 'common/deleteModal.html',

0 commit comments

Comments
 (0)