diff --git a/internal/route/cli.go b/internal/route/cli.go index ad0b5d64..73dc0417 100644 --- a/internal/route/cli.go +++ b/internal/route/cli.go @@ -372,7 +372,12 @@ func Cli() []*cli.Command { }, }, { - Name: "clearTask", + Name: "sync-time", + Usage: "同步系统时间", + Action: cliService.SyncTime, + }, + { + Name: "clear-task", Usage: "清理面板任务队列(仅限指导下使用)", Hidden: true, Action: cliService.ClearTask, diff --git a/internal/service/cli.go b/internal/service/cli.go index ae16250f..36a8ec0e 100644 --- a/internal/service/cli.go +++ b/internal/service/cli.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/TheTNB/panel/pkg/ntp" "path/filepath" "time" @@ -612,6 +613,20 @@ func (s *CliService) AppRemove(ctx context.Context, cmd *cli.Command) error { return nil } +func (s *CliService) SyncTime(ctx context.Context, cmd *cli.Command) error { + now, err := ntp.Now() + if err != nil { + return err + } + + if err = ntp.UpdateSystemTime(now); err != nil { + return err + } + + color.Greenln("时间同步成功") + return nil +} + func (s *CliService) ClearTask(ctx context.Context, cmd *cli.Command) error { if err := app.Orm.Model(&biz.Task{}). Where("status", biz.TaskStatusRunning).Or("status", biz.TaskStatusWaiting). @@ -620,6 +635,7 @@ func (s *CliService) ClearTask(ctx context.Context, cmd *cli.Command) error { return fmt.Errorf("任务清理失败:%v", err) } + color.Greenln("任务清理成功") return nil } diff --git a/web/src/views/app/IndexView.vue b/web/src/views/app/IndexView.vue index 90a07ae3..e226513c 100644 --- a/web/src/views/app/IndexView.vue +++ b/web/src/views/app/IndexView.vue @@ -20,27 +20,27 @@ const columns: any = [ { title: t('appIndex.columns.name'), key: 'name', - minWidth: 200, + width: 300, resizable: true, ellipsis: { tooltip: true } }, { title: t('appIndex.columns.description'), key: 'description', - minWidth: 200, + minWidth: 300, resizable: true, ellipsis: { tooltip: true } }, { title: t('appIndex.columns.installedVersion'), key: 'installed_version', - minWidth: 100, + width: 100, ellipsis: { tooltip: true } }, { title: t('appIndex.columns.show'), key: 'show', - minWidth: 100, + width: 100, align: 'center', render(row: any) { return h(NSwitch, { diff --git a/web/src/views/backup/ListView.vue b/web/src/views/backup/ListView.vue index 66c4422e..1e3f2c49 100644 --- a/web/src/views/backup/ListView.vue +++ b/web/src/views/backup/ListView.vue @@ -25,11 +25,16 @@ const columns: any = [ resizable: true, ellipsis: { tooltip: true } }, - { title: '大小', key: 'size', minWidth: 160, ellipsis: { tooltip: true } }, + { + title: '大小', + key: 'size', + width: 160, + ellipsis: { tooltip: true } + }, { title: '更新日期', key: 'time', - minWidth: 200, + width: 200, ellipsis: { tooltip: true }, render(row: any) { return formatDateTime(row.time) diff --git a/web/src/views/cert/AccountView.vue b/web/src/views/cert/AccountView.vue index 76d310cc..296bc125 100644 --- a/web/src/views/cert/AccountView.vue +++ b/web/src/views/cert/AccountView.vue @@ -49,7 +49,7 @@ const accountColumns: any = [ { title: 'CA', key: 'ca', - minWidth: 150, + width: 150, resizable: true, ellipsis: { tooltip: true }, render(row: any) { @@ -70,7 +70,7 @@ const accountColumns: any = [ { title: '密钥类型', key: 'key_type', - minWidth: 150, + width: 150, resizable: true, ellipsis: { tooltip: true } }, diff --git a/web/src/views/cert/CertView.vue b/web/src/views/cert/CertView.vue index bf554f88..e11bbbc3 100644 --- a/web/src/views/cert/CertView.vue +++ b/web/src/views/cert/CertView.vue @@ -64,7 +64,7 @@ const certColumns: any = [ { title: '类型', key: 'type', - minWidth: 100, + width: 100, resizable: true, ellipsis: { tooltip: true }, render(row: any) { @@ -153,7 +153,7 @@ const certColumns: any = [ { title: '自动续签', key: 'auto_renew', - minWidth: 100, + width: 100, align: 'center', resizable: true, render(row: any) { diff --git a/web/src/views/cert/DnsView.vue b/web/src/views/cert/DnsView.vue index cc746af8..5d0d7ffd 100644 --- a/web/src/views/cert/DnsView.vue +++ b/web/src/views/cert/DnsView.vue @@ -43,7 +43,7 @@ const dnsColumns: any = [ { title: '类型', key: 'type', - minWidth: 150, + width: 150, resizable: true, ellipsis: { tooltip: true }, render(row: any) { diff --git a/web/src/views/container/ContainerView.vue b/web/src/views/container/ContainerView.vue index af027a1d..e54ddaf3 100644 --- a/web/src/views/container/ContainerView.vue +++ b/web/src/views/container/ContainerView.vue @@ -35,7 +35,7 @@ const columns: any = [ { title: '状态', key: 'state', - minWidth: 100, + width: 100, resizable: true, render(row: any) { return h(NSwitch, { @@ -56,7 +56,7 @@ const columns: any = [ { title: '端口(主机->容器)', key: 'ports', - minWidth: 100, + width: 100, resizable: true, ellipsis: { tooltip: true }, render(row: any) { @@ -70,7 +70,7 @@ const columns: any = [ { title: '运行状态', key: 'status', - minWidth: 300, + width: 300, resizable: true, ellipsis: { tooltip: true } }, diff --git a/web/src/views/container/ImageView.vue b/web/src/views/container/ImageView.vue index dc117200..33612f68 100644 --- a/web/src/views/container/ImageView.vue +++ b/web/src/views/container/ImageView.vue @@ -25,14 +25,14 @@ const columns: any = [ { title: 'ID', key: 'id', - minWidth: 150, + width: 150, resizable: true, ellipsis: { tooltip: true } }, { title: '容器数', key: 'containers', - minWidth: 100, + width: 100, resizable: true, ellipsis: { tooltip: true } }, @@ -56,14 +56,14 @@ const columns: any = [ { title: '大小', key: 'size', - minWidth: 150, + width: 150, resizable: true, ellipsis: { tooltip: true } }, { title: '创建时间', key: 'created', - minWidth: 200, + width: 200, resizable: true, ellipsis: { tooltip: true } }, diff --git a/web/src/views/container/NetworkView.vue b/web/src/views/container/NetworkView.vue index 355a1dcc..e08bea57 100644 --- a/web/src/views/container/NetworkView.vue +++ b/web/src/views/container/NetworkView.vue @@ -54,14 +54,14 @@ const columns: any = [ { title: '驱动', key: 'driver', - minWidth: 100, + width: 100, resizable: true, ellipsis: { tooltip: true } }, { title: '范围', key: 'scope', - minWidth: 100, + width: 100, resizable: true, ellipsis: { tooltip: true } }, @@ -85,7 +85,7 @@ const columns: any = [ { title: '网关', key: 'gateway', - minWidth: 150, + width: 150, resizable: true, ellipsis: { tooltip: true }, render(row: any): any { @@ -102,7 +102,7 @@ const columns: any = [ { title: '创建时间', key: 'created', - minWidth: 200, + width: 200, resizable: true, ellipsis: { tooltip: true } }, diff --git a/web/src/views/container/VolumeView.vue b/web/src/views/container/VolumeView.vue index 61df71e7..702507ab 100644 --- a/web/src/views/container/VolumeView.vue +++ b/web/src/views/container/VolumeView.vue @@ -35,14 +35,14 @@ const columns: any = [ { title: '驱动', key: 'driver', - minWidth: 100, + width: 100, resizable: true, ellipsis: { tooltip: true } }, { title: '范围', key: 'scope', - minWidth: 100, + width: 100, resizable: true, ellipsis: { tooltip: true } }, @@ -56,7 +56,7 @@ const columns: any = [ { title: '创建时间', key: 'created', - minWidth: 200, + width: 200, resizable: true, ellipsis: { tooltip: true } }, diff --git a/web/src/views/cron/IndexView.vue b/web/src/views/cron/IndexView.vue index c8101ce3..b6b84730 100644 --- a/web/src/views/cron/IndexView.vue +++ b/web/src/views/cron/IndexView.vue @@ -61,7 +61,7 @@ const columns: any = [ { title: '任务类型', key: 'type', - minWidth: 100, + width: 100, resizable: true, render(row: any) { return row.type === 'shell' ? '运行脚本' : row.type === 'backup' ? '备份数据' : '切割日志' @@ -70,7 +70,7 @@ const columns: any = [ { title: '启用', key: 'status', - minWidth: 60, + width: 100, align: 'center', resizable: true, render(row: any) { @@ -85,14 +85,14 @@ const columns: any = [ { title: '任务周期', key: 'time', - minWidth: 100, + width: 100, resizable: true, ellipsis: { tooltip: true } }, { title: '创建时间', key: 'created_at', - minWidth: 200, + width: 200, resizable: true, ellipsis: { tooltip: true }, render(row: any): string { @@ -102,7 +102,7 @@ const columns: any = [ { title: '最后更新时间', key: 'updated_at', - minWidth: 200, + width: 200, ellipsis: { tooltip: true }, render(row: any): string { return formatDateTime(row.updated_at) diff --git a/web/src/views/safe/IndexView.vue b/web/src/views/safe/IndexView.vue index 8cb18c27..8b81e5d7 100644 --- a/web/src/views/safe/IndexView.vue +++ b/web/src/views/safe/IndexView.vue @@ -20,7 +20,7 @@ const columns: any = [ { title: '传输协议', key: 'protocol', - minWidth: 150, + width: 150, resizable: true, ellipsis: { tooltip: true }, render(row: any): any { @@ -37,7 +37,7 @@ const columns: any = [ { title: '网络协议', key: 'family', - minWidth: 150, + width: 150, resizable: true, ellipsis: { tooltip: true }, render(row: any): any { @@ -54,7 +54,7 @@ const columns: any = [ { title: '端口', key: 'port', - minWidth: 200, + minWidth: 300, resizable: true, ellipsis: { tooltip: true }, render(row: any): any { @@ -129,7 +129,7 @@ const columns: any = [ { title: '操作', key: 'actions', - width: 150, + width: 200, align: 'center', hideInExcel: true, render(row: any) { diff --git a/web/src/views/task/IndexView.vue b/web/src/views/task/IndexView.vue index 2a1734a8..b3506049 100644 --- a/web/src/views/task/IndexView.vue +++ b/web/src/views/task/IndexView.vue @@ -26,7 +26,7 @@ const columns: any = [ { title: t('taskIndex.columns.status'), key: 'status', - minWidth: 100, + width: 150, ellipsis: { tooltip: true }, render(row: any) { return row.status === 'finished' @@ -41,7 +41,7 @@ const columns: any = [ { title: t('taskIndex.columns.createdAt'), key: 'created_at', - minWidth: 200, + width: 200, ellipsis: { tooltip: true }, render(row: any): string { return formatDateTime(row.created_at) @@ -50,7 +50,7 @@ const columns: any = [ { title: t('taskIndex.columns.updatedAt'), key: 'updated_at', - minWidth: 200, + width: 200, ellipsis: { tooltip: true }, render(row: any): string { return formatDateTime(row.updated_at) diff --git a/web/src/views/website/IndexView.vue b/web/src/views/website/IndexView.vue index bb0a5c19..800e4fab 100644 --- a/web/src/views/website/IndexView.vue +++ b/web/src/views/website/IndexView.vue @@ -26,14 +26,14 @@ const columns: any = [ { title: t('websiteIndex.columns.name'), key: 'name', - minWidth: 150, + width: 200, resizable: true, ellipsis: { tooltip: true } }, { title: t('websiteIndex.columns.status'), key: 'status', - minWidth: 60, + width: 150, align: 'center', render(row: any) { return h(NSwitch, { @@ -54,7 +54,7 @@ const columns: any = [ { title: 'SSL', key: 'ssl', - minWidth: 60, + width: 150, align: 'center', render(row: any) { return h(NSwitch, { @@ -73,7 +73,6 @@ const columns: any = [ ellipsis: { tooltip: true }, render(row: any) { return h(NInput, { - class: 'w-100', size: 'small', value: row.remark, onBlur: () => handleRemark(row),