services: handle disabled state explicitly
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user