Selaa lähdekoodia

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

master
Zhe Jiang Eric Zhao 5 vuotta sitten
vanhempi
commit
8970f5380c
2 muutettua tiedostoa jossa 13 lisäystä ja 1 poistoa
  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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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…
Peruuta
Tallenna