Add Stop Podman to Settings, alongside Start/Restart
Rounds out the Podman Service card to the full start/stop/restart trio. Stop and Restart both get a confirm() first — both actually stop every running container (with its own configured grace period) before touching the API service itself, not just the service process; worth surfacing that explicitly rather than letting it be a surprise. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,8 +72,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
function serviceButtons() {
|
||||
return ['settings-service-status-btn', 'settings-service-start-btn', 'settings-service-stop-btn', 'settings-service-restart-btn']
|
||||
.map(function (id) { return P.el(id); });
|
||||
}
|
||||
|
||||
function refreshServiceStatus() {
|
||||
const buttons = [P.el('settings-service-status-btn'), P.el('settings-service-start-btn'), P.el('settings-service-restart-btn')];
|
||||
const buttons = serviceButtons();
|
||||
buttons.forEach(function (b) { b.disabled = true; });
|
||||
return P.get('settings', 'service_status').then(renderServiceResult).catch(function (err) {
|
||||
P.el('settings-service-chip').className = 'podman-chip podman-chip-bad';
|
||||
@@ -86,7 +91,7 @@
|
||||
}
|
||||
|
||||
function runServiceAction(action) {
|
||||
const buttons = [P.el('settings-service-status-btn'), P.el('settings-service-start-btn'), P.el('settings-service-restart-btn')];
|
||||
const buttons = serviceButtons();
|
||||
buttons.forEach(function (b) { b.disabled = true; });
|
||||
P.el('settings-service-log').style.display = '';
|
||||
P.el('settings-service-log').textContent = 'Working…';
|
||||
@@ -205,7 +210,14 @@
|
||||
|
||||
P.el('settings-service-status-btn').addEventListener('click', refreshServiceStatus);
|
||||
P.el('settings-service-start-btn').addEventListener('click', function () { runServiceAction('service_start'); });
|
||||
P.el('settings-service-restart-btn').addEventListener('click', function () { runServiceAction('service_restart'); });
|
||||
P.el('settings-service-stop-btn').addEventListener('click', function () {
|
||||
if (!confirm('Stop podman? All running containers will be stopped first (each with its own configured grace period).')) return;
|
||||
runServiceAction('service_stop');
|
||||
});
|
||||
P.el('settings-service-restart-btn').addEventListener('click', function () {
|
||||
if (!confirm('Restart podman? All running containers will be stopped and podman.sock will be unavailable until it comes back up.')) return;
|
||||
runServiceAction('service_restart');
|
||||
});
|
||||
P.el('settings-format-disk-btn').addEventListener('click', openFormatDiskModal);
|
||||
|
||||
refreshServiceStatus();
|
||||
|
||||
Reference in New Issue
Block a user