Add a "rerun" action also for running checks

Bug: Issue 14724
Change-Id: I6ad2d6559b26a76924cb0219fb11747bf4cc74c2
diff --git a/gr-checks/plugin.js b/gr-checks/plugin.js
index 65094f5..160c929 100644
--- a/gr-checks/plugin.js
+++ b/gr-checks/plugin.js
@@ -97,13 +97,17 @@
         }];
       }
     }
-    if (status !== 'RUNNING') {
-      run.actions = [{
-        name: 'Run',
-        primary: true,
-        callback: () => this.run(check.checker_uuid),
-      }];
-    }
+    // We also provide the "run" action for running checks, because the "/rerun"
+    // endpoint just updates the state to NOT_STARTED, which for running checks
+    // means that they are stopped and rerun.
+    let actionName = 'Run';
+    if (status === 'RUNNING') actionName = 'Stop and Rerun';
+    if (status === 'COMPLETED') actionName = 'Rerun';
+    run.actions = [{
+      name: actionName,
+      primary: true,
+      callback: () => this.run(check.checker_uuid),
+    }];
     return run;
   }