From 1fee3632fcf8b4ac1d0b513235d1745975156c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 2 Dec 2024 23:18:16 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E6=B3=A8=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend.yml | 3 +- internal/app/global.go | 1 - internal/service/dashboard.go | 6 +++ web/src/views/dashboard/IndexView.vue | 56 ++++++++++++++------------- web/src/views/dashboard/types.ts | 6 +++ 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index e458e8cd..7b3336a6 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -40,10 +40,9 @@ jobs: id: build_info run: | echo "version=$(git describe --tags --abbrev=0 2>/dev/null || echo '0.0.0')" >> $GITHUB_OUTPUT - echo "build_time=$(date -u '+%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT + echo "build_time=$(date -u '+%F %T UTC')" >> $GITHUB_OUTPUT echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT echo "go_version=$(go version | cut -d' ' -f3)" >> $GITHUB_OUTPUT - echo "platform=$(go version | cut -d' ' -f4)" >> $GITHUB_OUTPUT echo "build_user=$(whoami)" >> $GITHUB_OUTPUT echo "build_host=$(hostname)" >> $GITHUB_OUTPUT echo "build_id=${{ github.run_id }}" >> $GITHUB_OUTPUT diff --git a/internal/app/global.go b/internal/app/global.go index db231ecd..6841f9e8 100644 --- a/internal/app/global.go +++ b/internal/app/global.go @@ -52,7 +52,6 @@ var ( BuildTime string CommitHash string GoVersion string - Platform string BuildUser string BuildHost string BuildID string diff --git a/internal/service/dashboard.go b/internal/service/dashboard.go index 69058ff0..40ea86f4 100644 --- a/internal/service/dashboard.go +++ b/internal/service/dashboard.go @@ -107,6 +107,12 @@ func (s *DashboardService) SystemInfo(w http.ResponseWriter, r *http.Request) { "procs": hostInfo.Procs, "hostname": hostInfo.Hostname, "panel_version": app.Version, + "commit_hash": app.CommitHash, + "build_time": app.BuildTime, + "build_user": app.BuildUser, + "build_host": app.BuildHost, + "build_id": app.BuildID, + "go_version": app.GoVersion, "kernel_arch": hostInfo.KernelArch, "kernel_version": hostInfo.KernelVersion, "os_name": hostInfo.Platform + " " + hostInfo.PlatformVersion, diff --git a/web/src/views/dashboard/IndexView.vue b/web/src/views/dashboard/IndexView.vue index c66b403c..2d13dbe4 100644 --- a/web/src/views/dashboard/IndexView.vue +++ b/web/src/views/dashboard/IndexView.vue @@ -337,10 +337,6 @@ const toSponsor = () => { } } -const toGit = () => { - window.open('https://github.com/TheTNB/panel') -} - const handleManageApp = (slug: string) => { router.push({ name: 'apps-' + slug + '-index' }) } @@ -425,10 +421,16 @@ if (import.meta.hot) { @@ -705,47 +707,47 @@ if (import.meta.hot) { - 主机名 + 系统主机名 {{ systemInfo?.hostname || '加载中...' }} - 系统版本 + 系统版本号 {{ `${systemInfo?.os_name} ${systemInfo?.kernel_arch}` || '加载中...' }} - 内核版本 + 系统内核版本 {{ systemInfo?.kernel_version || '加载中...' }} - 运行时间 + 系统运行时间 {{ formatDuration(Number(systemInfo?.uptime)) || '加载中...' }} - 操作 + 面板内部版本 - - - - 确定要重启面板吗? - - - - 检查更新 - - + {{ systemInfo?.commit_hash || '加载中...' }} + + + + 面板编译信息 + + {{ + systemInfo?.go_version + + '/' + + systemInfo?.build_time + + '/' + + systemInfo?.build_host + + '/' + + systemInfo?.build_id || '加载中...' + }} diff --git a/web/src/views/dashboard/types.ts b/web/src/views/dashboard/types.ts index cd9144e0..95ff7c8c 100644 --- a/web/src/views/dashboard/types.ts +++ b/web/src/views/dashboard/types.ts @@ -156,6 +156,12 @@ export interface SystemInfo { procs: number hostname: string panel_version: string + commit_hash: string + build_time: string + build_user: string + build_host: string + build_id: string + go_version: string kernel_arch: string kernel_version: string os_name: string