Skip to content

Commit

Permalink
Merge pull request #2989 from alectejada/AZD177372
Browse files Browse the repository at this point in the history
AZD177372: hide cancel button when test starts running or is cancelled
  • Loading branch information
mjkozicki authored Oct 26, 2023
2 parents a159137 + 6ad4b5a commit 5dcc6b7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions www/running.inc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
<div id="runningHeader" class="box">
<?php
$status = GetTestStatus($id, true);
if (!array_key_exists('startTime', $status) || !$status['startTime']) {
if ($status['statusCode'] < 400 && (!array_key_exists('startTime', $status) || !$status['startTime'])) {
?>
<form action="/cancelTest.php" method="get">
<form class="cancel_form" action="/cancelTest.php" method="get">
<input type="hidden" name="test" value="<?php echo $id;?>">
<input type="submit" value="Cancel Test"/>
</form>
Expand Down Expand Up @@ -137,9 +137,11 @@
if (response['statusCode'] != undefined &&
response['statusCode'] != lastStatusCode) {
lastStatusCode = response['statusCode'];
var showCancelButton = false;
if (lastStatusCode == 101) {
document.getElementById('waiting').classList.add('is-active');
document.getElementById('testing').classList.remove('is-active');
showCancelButton = true;
} else if (lastStatusCode == 100) {
document.getElementById('waiting').classList.remove('is-active');
document.getElementById('testing').classList.add('is-active');
Expand All @@ -148,7 +150,14 @@
} else {
reload = true;
}

if (!showCancelButton) {
$('.cancel_form').hide();
} else {
$('.cancel_form').show();
}
}

if (response['statusText'] != undefined &&
response['statusText'] != lastStatusText) {
lastStatusText = response['statusText'];
Expand Down

0 comments on commit 5dcc6b7

Please sign in to comment.