health: done

This commit is contained in:
nemunaire 2020-01-29 11:35:01 +01:00
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();
})

View file

@ -1,14 +1,24 @@
<div class="jumbotron text-light bg-dark">
<h1 class="display-4">Interface d'administration du challenge</h1>
<p class="lead">
Sélectionnez une action dans le menu ci-dessus.
</p>
<hr class="my-4">
<p ng-controller="VersionController">
Version de l'API : {{ v.version }}
</p>
<p ng-controller="TimestampController">
Latence frontend-backend : <ng-pluralize count="t.diffFB / 1000000000" when="{'one': '{}&nbsp;seconde', 'other': '{}&nbsp;secondes'}"></ng-pluralize><br>
Dernière synchronisation du frontend : {{ t.frontend | date:"mediumTime" }}
</p>
<div class="row">
<div class="col">
<p ng-controller="VersionController">
Version de l'API : {{ v.version }}
</p>
<p ng-controller="TimestampController">
Latence frontend-backend : <ng-pluralize count="t.diffFB / 1000000000" when="{'one': '{}&nbsp;seconde', 'other': '{}&nbsp;secondes'}"></ng-pluralize><br>
Dernière synchronisation du frontend : {{ t.frontend | date:"mediumTime" }}
</p>
</div>
<div class="col">
<ul ng-controller="HealthController">
<li ng-repeat="heal in health">
<a ng-href="teams/{{ heal.id_team }}" ng-if="heal.id_team">{{ heal.path }}</a>
<span ng-if="!heal.id_team">{{ heal.path }}</span>
: {{ heal.error }}
</li>
</ul>
</div>
</div>
</div>