From e9bbd3bc5c61c2760087155387a79fcde943af71 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 19 Jan 2026 22:41:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E9=A1=B9=E7=9B=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=93=8D=E4=BD=9C=E5=88=97=E6=B7=BB=E5=8A=A0=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E5=92=8C=E9=87=8D=E8=BD=BD=E6=8C=89=E9=92=AE=20(#1260?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial plan * feat: 为项目管理操作列添加重启和重载按钮 Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com> --- web/src/views/project/ListView.vue | 55 +++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/web/src/views/project/ListView.vue b/web/src/views/project/ListView.vue index 649501b3..c8a91935 100644 --- a/web/src/views/project/ListView.vue +++ b/web/src/views/project/ListView.vue @@ -113,10 +113,10 @@ const columns: any = [ { title: $gettext('Actions'), key: 'actions', - width: 300, + width: 420, hideInExcel: true, render(row: any) { - return [ + const buttons = [ h( NButton, { @@ -125,7 +125,38 @@ const columns: any = [ onClick: () => handleToggleStatus(row) }, { default: () => (row.status === 'active' ? $gettext('Stop') : $gettext('Start')) } - ), + ) + ] + + // 仅为运行中的项目显示重启和重载按钮 + if (row.status === 'active') { + buttons.push( + h( + NButton, + { + size: 'small', + type: 'warning', + secondary: true, + style: 'margin-left: 10px;', + onClick: () => handleRestart(row) + }, + { default: () => $gettext('Restart') } + ), + h( + NButton, + { + size: 'small', + type: 'info', + secondary: true, + style: 'margin-left: 10px;', + onClick: () => handleReload(row) + }, + { default: () => $gettext('Reload') } + ) + ) + } + + buttons.push( h( NButton, { @@ -167,7 +198,9 @@ const columns: any = [ ) } ) - ] + ) + + return buttons } } ] @@ -196,6 +229,20 @@ const handleToggleStatus = (row: any) => { } } +const handleRestart = (row: any) => { + useRequest(systemctl.restart(row.name)).onSuccess(() => { + refresh() + window.$message.success($gettext('Restarted successfully')) + }) +} + +const handleReload = (row: any) => { + useRequest(systemctl.reload(row.name)).onSuccess(() => { + refresh() + window.$message.success($gettext('Reloaded successfully')) + }) +} + const handleToggleAutostart = (row: any, enabled: boolean) => { if (enabled) { useRequest(systemctl.enable(row.name)).onSuccess(() => {