2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 13:47:15 +08:00

Merge remote-tracking branch 'origin/main'

This commit is contained in:
2026-01-19 23:05:25 +08:00

View File

@@ -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(() => {