diff --git a/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html b/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html index 6a030b37..dbabfff6 100755 --- a/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html +++ b/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html @@ -19,6 +19,7 @@  {{entry.app}} + ({{entry.heathCount}}/{{entry.machines.length}}) diff --git a/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js b/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js index ce1a9030..55f63548 100755 --- a/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.js +++ b/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; + } }); } }