From 4b2f7d6f1d6b389cb22b48597a58e1829f49eaa2 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Fri, 5 Jun 2020 11:28:20 +0200
Subject: [PATCH] also show failed tasks

---
 inventory_provider/static/update.html | 14 ++++++++++++++
 inventory_provider/static/update.js   |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/inventory_provider/static/update.html b/inventory_provider/static/update.html
index 17efc214..1c44a592 100644
--- a/inventory_provider/static/update.html
+++ b/inventory_provider/static/update.html
@@ -57,6 +57,20 @@
           </table>
         </div>
 
+        <div class="container p-3 my-3 border" ng-show="failed.length">
+          <table class="table table-striped" summary="failed tasks">
+            <tr>
+              <th>
+                  <button ng-click="show_failed=!show_failed">{{show_failed ? "hide" : "show"}}</button>
+              </th>
+              <th scope="col">failed tasks</th>
+            </tr>
+            <tr ng-if="show_failed" ng-repeat="description in failed">
+              <td colspan="2">{{ description }}</td>
+            </tr>
+          </table>
+        </div>
+
         <div class="container p-3 my-3 border" ng-show="pending.length">
           <table class="table table-striped" summary="pending tasks">
             <tr>
diff --git a/inventory_provider/static/update.js b/inventory_provider/static/update.js
index 15f2f647..a4d87b4c 100644
--- a/inventory_provider/static/update.js
+++ b/inventory_provider/static/update.js
@@ -17,6 +17,7 @@ myApp.controller('update', function($scope, $http, $timeout) {
     $scope.show_warnings = true;
     $scope.show_errors = true;
     $scope.show_pending = true;
+    $scope.show_failed = true;
 
     $scope.check_status = function() {
 
@@ -32,6 +33,8 @@ myApp.controller('update', function($scope, $http, $timeout) {
                 $scope.latch_error = rsp.data.latch.failure;
                 if (!$scope.latch_pending) {
                     $scope.update_request_status = "";
+                } else {
+                    $scope.update_request_status = "update is running";
                 }
                 $timeout($scope.check_status, 5000);
             },
-- 
GitLab