From 05aeea6863d1a75189340213888d2e70aff8092f Mon Sep 17 00:00:00 2001 From: engigu Date: Wed, 24 Dec 2025 10:48:23 +0800 Subject: [PATCH] feat: opt pages display style --- internal/controllers/dashboard_controller.go | 31 +++++++------- web/src/api/index.ts | 2 +- web/src/components/TextOverflow.vue | 43 ++++++++++++++++++++ web/src/views/dashboard/Dashboard.vue | 6 +-- web/src/views/dependencies/Dependencies.vue | 9 +++- web/src/views/environments/Environments.vue | 7 +++- web/src/views/history/History.vue | 9 +++- web/src/views/loginlogs/LoginLogs.vue | 5 ++- web/src/views/tasks/Tasks.vue | 9 +++- 9 files changed, 94 insertions(+), 27 deletions(-) create mode 100644 web/src/components/TextOverflow.vue diff --git a/internal/controllers/dashboard_controller.go b/internal/controllers/dashboard_controller.go index 76acfb0..d05d458 100644 --- a/internal/controllers/dashboard_controller.go +++ b/internal/controllers/dashboard_controller.go @@ -26,29 +26,32 @@ func NewDashboardController(cronService *services.CronService, executorService * } type StatsResponse struct { - Tasks int64 `json:"tasks"` - Scripts int64 `json:"scripts"` - Envs int64 `json:"envs"` - Logs int64 `json:"logs"` - Scheduled int `json:"scheduled"` - Running int `json:"running"` + Tasks int64 `json:"tasks"` + TodayExecs int64 `json:"today_execs"` + Envs int64 `json:"envs"` + Logs int64 `json:"logs"` + Scheduled int `json:"scheduled"` + Running int `json:"running"` } func (dc *DashboardController) GetStats(c *gin.Context) { - var taskCount, scriptCount, envCount, logCount int64 + var taskCount, envCount, logCount, todayExecs int64 database.DB.Model(&models.Task{}).Count(&taskCount) - database.DB.Model(&models.Script{}).Count(&scriptCount) database.DB.Model(&models.EnvironmentVariable{}).Count(&envCount) database.DB.Model(&models.TaskLog{}).Count(&logCount) + // 今日执行总数 + today := time.Now().Format("2006-01-02") + database.DB.Model(&models.SendStats{}).Where("day = ?", today).Select("COALESCE(SUM(num), 0)").Scan(&todayExecs) + stats := StatsResponse{ - Tasks: taskCount, - Scripts: scriptCount, - Envs: envCount, - Logs: logCount, - Scheduled: dc.cronService.GetScheduledCount(), - Running: dc.executorService.GetRunningCount(), + Tasks: taskCount, + TodayExecs: todayExecs, + Envs: envCount, + Logs: logCount, + Scheduled: dc.cronService.GetScheduledCount(), + Running: dc.executorService.GetRunningCount(), } utils.Success(c, stats) diff --git a/web/src/api/index.ts b/web/src/api/index.ts index 132507b..a9be77e 100644 --- a/web/src/api/index.ts +++ b/web/src/api/index.ts @@ -259,7 +259,7 @@ export interface EnvListResponse { export interface Stats { tasks: number - scripts: number + today_execs: number envs: number logs: number scheduled: number diff --git a/web/src/components/TextOverflow.vue b/web/src/components/TextOverflow.vue new file mode 100644 index 0000000..0ad6e84 --- /dev/null +++ b/web/src/components/TextOverflow.vue @@ -0,0 +1,43 @@ + + + diff --git a/web/src/views/dashboard/Dashboard.vue b/web/src/views/dashboard/Dashboard.vue index 79e3c73..9c7d608 100644 --- a/web/src/views/dashboard/Dashboard.vue +++ b/web/src/views/dashboard/Dashboard.vue @@ -1,19 +1,19 @@