diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 075e159b8..2a283c712 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1684,6 +1684,14 @@ const message = { restartHelper: 'Initialization will restart the service, causing all the original daemon processes to close', msg: 'Message', + RUNNING: 'Running', + STOPPED: 'Stopped', + STOPPING: 'Stopping', + STARTING: 'Starting', + FATAL: 'Failed to start', + BACKOFF: 'Start exception', + statusCode: 'Status code', + manage: 'Management', }, }, }; diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 2696c804f..a8bb28187 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1596,6 +1596,14 @@ const message = { serviceNameHelper: 'systemctl 管理的 Supervisor 服務名稱,一般為 supervisor 或 supervisord', restartHelper: '初始化會重啟服務,導致原有的守護進程全部關閉', msg: '信息', + RUNNING: '運行中', + STOPPED: '已停止', + STOPPING: '停止中', + STARTING: '啟動中', + FATAL: '啟動失敗', + BACKOFF: '啟動異常', + statusCode: '狀態碼', + manage: '管理', }, }, }; diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index ecc919348..be73edcd6 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1598,6 +1598,14 @@ const message = { serviceNameHelper: 'systemctl 管理的 Supervisor 服务名称,一般为 supervisor、supervisord', restartHelper: '初始化会重启服务,导致原有的守护进程全部关闭', msg: '信息', + RUNNING: '运行中', + STOPPED: '已停止', + STOPPING: '停止中', + STARTING: '启动中', + FATAL: '启动失败', + BACKOFF: '启动异常', + statusCode: '状态码', + manage: '管理', }, }, }; diff --git a/frontend/src/views/host/tool/supervisor/index.vue b/frontend/src/views/host/tool/supervisor/index.vue index 760780d1b..87a8c5609 100644 --- a/frontend/src/views/host/tool/supervisor/index.vue +++ b/frontend/src/views/host/tool/supervisor/index.vue @@ -39,6 +39,39 @@ prop="numprocs" width="100px" > + + + @@ -60,7 +93,7 @@ /> @@ -85,7 +118,7 @@ :buttons="buttons" :label="$t('commons.table.operate')" :fixed="mobile ? false : 'right'" - width="350px" + width="250px" fix /> @@ -110,6 +143,7 @@ import { GlobalStore } from '@/store'; import i18n from '@/lang'; import { HostTool } from '@/api/interface/host-tool'; import { MsgSuccess } from '@/utils/message'; +import { VideoPlay, VideoPause, RefreshRight } from '@element-plus/icons-vue'; const globalStore = GlobalStore(); const loading = ref(false); @@ -170,6 +204,20 @@ const mobile = computed(() => { return globalStore.isMobile(); }); +const checkStatus = (status: HostTool.ProcessStatus[]): string => { + if (!status || status.length === 0) return 'STOPPED'; + + const statusCounts = status.reduce((acc, curr) => { + acc[curr.status] = (acc[curr.status] || 0) + 1; + return acc; + }, {} as Record); + + if (statusCounts['STARTING']) return 'STARTING'; + if (statusCounts['RUNNING'] === status.length) return 'RUNNING'; + if (statusCounts['RUNNING'] > 0) return 'WARNING'; + return 'STOPPED'; +}; + const operate = async (operation: string, name: string) => { try { ElMessageBox.confirm( @@ -224,42 +272,11 @@ const buttons = [ getFile(row.name, 'out.log'); }, }, - { - label: i18n.global.t('app.start'), - click: function (row: HostTool.SupersivorProcess) { - operate('start', row.name); - }, - disabled: (row: any) => { - if (row.status == undefined) { - return true; - } else { - return row.status && row.status[0].status == 'RUNNING'; - } - }, - }, - { - label: i18n.global.t('app.stop'), - click: function (row: HostTool.SupersivorProcess) { - operate('stop', row.name); - }, - disabled: (row: any) => { - if (row.status == undefined) { - return true; - } - return row.status && row.status[0].status != 'RUNNING'; - }, - }, { label: i18n.global.t('commons.button.restart'), click: function (row: HostTool.SupersivorProcess) { operate('restart', row.name); }, - disabled: (row: any): boolean => { - if (row.status == undefined) { - return true; - } - return row.status && row.status[0].status != 'RUNNING'; - }, }, { label: i18n.global.t('commons.button.delete'),