health: done

This commit is contained in:
nemunaire 2020-01-29 11:35:01 +01:00
parent a0b19f6184
commit 007efc6118
4 changed files with 58 additions and 15 deletions

View file

@ -136,6 +136,9 @@ angular.module("FICApp")
.factory("Timestamp", function($resource) {
return $resource("/api/timestamps.json")
})
.factory("Health", function($resource) {
return $resource("/api/health.json")
})
.factory("Monitor", function($resource) {
return $resource("/api/monitor/:machineId", { machineId: '@id' })
})
@ -416,6 +419,15 @@ angular.module("FICApp")
$scope.$on('$destroy', function () { $interval.cancel(myinterval); });
})
.controller("HealthController", function($scope, $interval, Health) {
var refresh = function() {
$scope.health = Health.query();
}
refresh();
var myinterval = $interval(refresh, 2500);
$scope.$on('$destroy', function () { $interval.cancel(myinterval); });
})
.controller("MonitorController", function($scope, Monitor) {
$scope.monitor = Monitor.get();
})