Skip to content
Snippets Groups Projects
Commit 1e7d1a18 authored by Erik Reid's avatar Erik Reid
Browse files

added table with pending task statuses

parent 8e22d3ba
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,23 @@
{{ update_request_status }}
</div>
<div class="grid-item" ng-show="latch_error||latch_pending">
<table>
<tr>
<th>name</th>
<th>status</th>
<th>success</th>
<th>message</th>
</tr>
<tr ng-repeat="t in tasks">
<td>{{ t.name }}</td>
<td>{{ t.status }}</td>
<td>{{ t.success }}</td>
<td>{{ t.message }}</td>
</tr>
</table>
</div>
</div>
</div>
</body>
......
......@@ -9,6 +9,8 @@ myApp.controller('update', function($scope, $http, $timeout) {
$scope.update_request_status = "";
$scope.update_request_error = false;
$scope.tasks = [];
$scope.check_status = function() {
$http({
......@@ -25,6 +27,9 @@ myApp.controller('update', function($scope, $http, $timeout) {
$scope.update_request_status = "";
}
$timeout($scope.check_status, 5000);
if ($scope.latch_pending || $scope.latch_error) {
$scope.refresh_update_status();
}
},
/* error response */
function(rsp) {
......@@ -32,11 +37,39 @@ myApp.controller('update', function($scope, $http, $timeout) {
$scope.latch_info = "communication error";
$scope.latch_pending = false;
$scope.latch_error = true;
$timeout($scope.check_status(), 5000);
$timeout($scope.check_status, 5000);
}
);
}
$scope.refresh_update_status = function() {
$http({
method: 'GET',
// url: window.location.origin + "/jobs/check-task-status/9d1cbcd2-c377-4b7a-b969-04ce17f03f20"
url: window.location.origin + "/jobs/check-update-status"
}).then(
/* ok response */
function(rsp) {
console.log('got update status rsp: ' + JSON.stringify(rsp.data).substring(0,30));
$scope.tasks = rsp.data.map(t => ({
id: t.id,
parent: t.parent,
status: t.status,
success: t.ready ? (t.success ? "OK" : "NO") : "-",
message: (t.result && t.result.message) ? t.result.message.substring(0,30) : "",
name: t.result ? t.result.task : "",
}));
},
/* error response */
function(rsp) {
// assume this is 404 ...
$scope.tasks = [];
}
);
}
$scope.launch_update = function() {
$scope.update_request_status = "sending update request";
$scope.update_request_error = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment