Преглед на файлове

dashboard: add healthCount/total information in sidebar of Sentinel dashboard (#376)

master
Zhe Jiang Eric Zhao преди 5 години
родител
ревизия
8970f5380c
променени са 2 файла, в които са добавени 13 реда и са изтрити 1 реда
  1. +1
    -0
      sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html
  2. +12
    -1
      sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js

+ 1
- 0
sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html Целия файл

@@ -19,6 +19,7 @@
<a href="#" ng-click="click($event)" collapse="{{collpaseall == 1}}" style="font-size: 16px;word-break: break-word;">
&nbsp;{{entry.app}}
<span class="fa arrow"></span>
<span class="arrow">({{entry.heathCount}}/{{entry.machines.length}})</span>
</a>

<!--<ul class="nav nav-second-level" collapse="{{entry.active}}" style="display: none;">-->


+ 12
- 1
sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js Целия файл

@@ -21,11 +21,22 @@ angular.module('sentinelDashboardApp')
function (data) {
if (data.code === 0) {
let initHashApp = $location.path().split('/')[3];
let currTime = moment(new Date()).utc().add(-1000*60*5).format('YYYY-MM-DDTHH:mm:ss')
$scope.apps = data.data;
$scope.apps.forEach(function (item) {
$scope.apps = $scope.apps.map(function (item) {
if (item.app === initHashApp) {
item.active = true;
}
var heathCount = 0;
for (var i in item.machines) {
if (item.machines[i].timestamp>currTime) {
heathCount++;
}
}
item.heathCount = heathCount;
if (heathCount>0) {
return item;
}
});
}
}


Loading…
Отказ
Запис