|
@@ -21,11 +21,22 @@ angular.module('sentinelDashboardApp') |
|
|
function (data) { |
|
|
function (data) { |
|
|
if (data.code === 0) { |
|
|
if (data.code === 0) { |
|
|
let initHashApp = $location.path().split('/')[3]; |
|
|
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 = data.data; |
|
|
$scope.apps.forEach(function (item) { |
|
|
|
|
|
|
|
|
$scope.apps = $scope.apps.map(function (item) { |
|
|
if (item.app === initHashApp) { |
|
|
if (item.app === initHashApp) { |
|
|
item.active = true; |
|
|
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; |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|