diff --git a/dashboard/src/views/ServicesView.vue b/dashboard/src/views/ServicesView.vue index 1e70432e3..751adb2e4 100644 --- a/dashboard/src/views/ServicesView.vue +++ b/dashboard/src/views/ServicesView.vue @@ -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 () => {