Skip to content

Commit

Permalink
Handle mass trigger ajax errors so the close button shows up
Browse files Browse the repository at this point in the history
Increase the ajax timeout for mass trigger
Adjust the font color to an off white for visibility
  • Loading branch information
austinwbest committed Nov 29, 2023
1 parent de7b9dc commit 9986693
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions root/app/www/public/ajax/containers.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
}
?>
<tr id="<?= $nameHash ?>" class="<?= $groupHash ?>" style="display: none;">
<th scope="row"><input id="massTrigger-<?= $nameHash ?>" type="checkbox" class="form-check-input containers-check group-<?= $groupHash ?>-check"></th>
<th scope="row"><input id="massTrigger-<?= $nameHash ?>" data-name="<?= $process['Names'] ?>" type="checkbox" class="form-check-input containers-check group-<?= $groupHash ?>-check"></th>
<td><?= ($logo ? '<img src="' . $logo . '" height="32" width="32">' : '') ?></td>
<td><?= $process['Names'] ?><br><span class="text-muted small-text"><?= truncateMiddle($process['inspect'][0]['Config']['Image'], 35) ?></span></td>
<td id="<?= $nameHash ?>-control"><?= $control ?></td>
Expand Down Expand Up @@ -199,7 +199,7 @@
}
?>
<tr id="<?= $nameHash ?>">
<th scope="row"><input id="massTrigger-<?= $nameHash ?>" type="checkbox" class="form-check-input containers-check"></th>
<th scope="row"><input id="massTrigger-<?= $nameHash ?>" data-name="<?= $process['Names'] ?>" type="checkbox" class="form-check-input containers-check"></th>
<td><?= ($logo ? '<img src="' . $logo . '" height="32" width="32">' : '') ?></td>
<td><?= $process['Names'] ?><br><span class="text-muted small-text"><?= truncateMiddle($process['inspect'][0]['Config']['Image'], 35) ?></span></td>
<td id="<?= $nameHash ?>-control"><?= $control ?></td>
Expand Down
6 changes: 5 additions & 1 deletion root/app/www/public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
:root {
--primary: #EB1616;
--secondary: #191C24;
--light: #6C7293;
--light: #F8F0E3;
--dark: #000000;
}

td, span, div {
color: var(--light);
}

.back-to-top {
position: fixed;
display: none;
Expand Down
14 changes: 13 additions & 1 deletion root/app/www/public/js/containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ function massApplyContainerTrigger()
} else {
$.each($('[id^=massTrigger-]'), function () {
if ($(this).prop('checked')) {
const containerName = $(this).attr('data-name');
const containerHash = $(this).attr('id').replace('massTrigger-', '');

$.ajax({
type: 'POST',
url: '../ajax/containers.php',
data: '&m=massApplyContainerTrigger&trigger=' + $('#massContainerTrigger').val() + '&hash=' + containerHash,
dataType: 'json',
async: 'global',
timeout: 600000,
success: function (resultData) {
if (parseInt($('#massContainerTrigger').val()) == 5) {
$('#massTrigger-results').append(resultData.result + "\n");
Expand All @@ -129,6 +130,17 @@ function massApplyContainerTrigger()
$('#massTrigger-results').prepend(counter + ': ' + resultData.result);
}

if (counter == selected) {
$('#massContainerTrigger').val('0');
$('.containers-check').prop('checked', false);
$('#massTrigger-close-btn').show();
$('#massTrigger-spinner').hide();
}
counter++;
},
error: function(jqhdr, textStatus, errorThrown) {
$('#massTrigger-results').prepend(counter + ': ' + containerName + ' ajax error (' + errorThrown + ')<br>');

if (counter == selected) {
$('#massContainerTrigger').val('0');
$('.containers-check').prop('checked', false);
Expand Down

0 comments on commit 9986693

Please sign in to comment.