feat(dashboard): restarts from 30 seconds; no "undefined" in the restart banner

Restarts can be scheduled in seconds (30 s to 24 h; minutes still accepted), with 30 second and 1 minute choices for
quick restarts. The restart banner only names who scheduled it when that is known: staff who manage restarts read it
from /api/server/restart, everyone else gets when and why from the status, which leaves the name out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-27 15:43:32 -05:00
parent 55ea44e2e8
commit cb2c26d520
5 changed files with 21 additions and 16 deletions

View File

@@ -77,9 +77,9 @@
The server shuts down cleanly; your process supervisor (systemd, Docker restart policy...) starts it again.</p>
<div class="input-group input-group-sm mb-2">
<span class="input-group-text">In</span>
<select class="form-select" id="restartMinutes">
<option value="5">5 minutes</option><option value="10">10 minutes</option><option value="15" selected>15 minutes</option>
<option value="30">30 minutes</option><option value="60">1 hour</option><option value="120">2 hours</option>
<select class="form-select" id="restartSeconds">
<option value="30">30 seconds</option><option value="60">1 minute</option><option value="300">5 minutes</option><option value="600">10 minutes</option><option value="900" selected>15 minutes</option>
<option value="1800">30 minutes</option><option value="3600">1 hour</option><option value="7200">2 hours</option>
</select>
</div>
<div class="mb-2"><input class="form-control form-control-sm" id="restartReason" maxlength="300" placeholder="Reason shown to players (optional)"></div>
@@ -112,7 +112,7 @@ $(function () {
};
schedule.addEventListener('click', function () {
if (!confirm('Schedule a restart? Everyone online will be warned and then disconnected.')) return;
api.action('/api/server/restart', { minutes: parseInt(document.getElementById('restartMinutes').value, 10), reason: document.getElementById('restartReason').value.trim() }, 'Restart scheduled')
api.action('/api/server/restart', { seconds: parseInt(document.getElementById('restartSeconds').value, 10), reason: document.getElementById('restartReason').value.trim() }, 'Restart scheduled')
.then(function (r) { showRestart(r.restart); }).catch(function () {});
});
document.getElementById('restartCancel').addEventListener('click', function () {