services: handle disabled state explicitly

This commit is contained in:
Girish Ramakrishnan
2025-11-25 13:40:52 +01:00
parent 790ba406bf
commit a4919b06f9
+16 -12
View File
@@ -52,8 +52,8 @@ function onActionMenu(id, event) {
}, {
icon: 'fa-solid fa-sync-alt',
label: t('services.restartActionTooltip'),
visible: id !== 'box',
disabled: (services[id].status === 'starting' && !services[id].config.recoveryMode),
visible: id !== 'box' && services[id].status !== 'disabled',
disabled: services[id].status === 'starting' && !services[id].config.recoveryMode,
action: onRestart.bind(null, id),
}, {
icon: 'fa-solid fa-fw fa-file-alt',
@@ -189,19 +189,23 @@ async function onEditSubmit() {
}
function state(service) {
if (service.status === 'active') return 'success';
else if (service.status === 'starting' && service.config.recoveryMode) return '';
else if (service.status === 'starting') return 'warning';
else return 'danger';
switch (service.status) {
case 'active': return 'success';
case 'disabled': return '';
case 'stopped': return 'danger';
case 'starting': return service.config.recoveryMode ? '' : 'warning';
default: return 'danger';
}
}
function stateTooltip(service) {
if (!service.status) return '';
if (service.status === 'active') return 'Active';
else if (service.status === 'starting' && service.config.recoveryMode) return 'Recovery mode';
else if (service.status === 'starting') return 'Starting';
else return service.status;
switch (service.status) {
case 'active': return 'Active';
case 'disabled': return 'Disabled';
case 'stopped': return 'Stopped';
case 'starting': return service.config.recoveryMode ? 'Recovery mode' : 'Starting';
default: return service.status;
}
}
onMounted(async () => {