Explorar el Código

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

master
Zhe Jiang Eric Zhao hace 5 años
padre
commit
8970f5380c
Se han modificado 2 ficheros con 13 adiciones y 1 borrados
  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 Ver fichero

@@ -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 Ver fichero

@@ -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;
}
});
}
}


Cargando…
Cancelar
Guardar