Skip to content

Commit

Permalink
Ensure server action overlays aren't dismissible
Browse files Browse the repository at this point in the history
If the user has confirmed a server shutdown/restart, make sure the
informational overlay can't be dismissed.
  • Loading branch information
danrahn committed Jan 27, 2024
1 parent e367674 commit 098194b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Client/Script/ClientSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ class ClientSettingsUI {
async #fullRestart() {
try {
await ServerCommand.restart();
Overlay.setDismissible(false);
} catch (err) {
$('#serverStateMessage').innerText = `Failed to initiate restart: ${errorMessage(err)}`;
$('#srConfirm').value = 'Try Again.';
Expand Down Expand Up @@ -621,6 +622,7 @@ class ClientSettingsUI {
return;
}

Overlay.setDismissible(false);
$('#serverStateMessage').innerText = 'Server is shutting down now.';
const btnHolder = $('#srCancel').parentElement;
clearEle(btnHolder);
Expand Down
7 changes: 7 additions & 0 deletions Client/Script/Overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,11 @@ export default class Overlay {
static get() {
return $$('body>#mainOverlay');
}

/**
* Sets whether the overlay can be dismissed by the user via Escape/clicking outside of the main content.
* @param {boolean} dismissible */
static setDismissible(dismissible) {
Overlay.get().setAttribute('dismissible', dismissible ? 1 : 0);
}
}

0 comments on commit 098194b

Please sign in to comment.