feat: opt exec log

This commit is contained in:
engigu
2026-01-01 14:56:48 +08:00
parent 756ba1e0ea
commit 433c586f2a
2 changed files with 15 additions and 9 deletions
+14 -8
View File
@@ -17,14 +17,16 @@ func NewLogController() *LogController {
} }
type TaskLogResponse struct { type TaskLogResponse struct {
ID uint `json:"id"` ID uint `json:"id"`
TaskID uint `json:"task_id"` TaskID uint `json:"task_id"`
TaskName string `json:"task_name"` TaskName string `json:"task_name"`
TaskType string `json:"task_type"` TaskType string `json:"task_type"`
Command string `json:"command"` Command string `json:"command"`
Status string `json:"status"` Status string `json:"status"`
Duration int64 `json:"duration"` Duration int64 `json:"duration"`
CreatedAt models.LocalTime `json:"created_at"` StartTime *models.LocalTime `json:"start_time"`
EndTime *models.LocalTime `json:"end_time"`
CreatedAt models.LocalTime `json:"created_at"`
} }
func (lc *LogController) GetLogs(c *gin.Context) { func (lc *LogController) GetLogs(c *gin.Context) {
@@ -82,6 +84,8 @@ func (lc *LogController) GetLogs(c *gin.Context) {
Command: log.Command, Command: log.Command,
Status: log.Status, Status: log.Status,
Duration: log.Duration, Duration: log.Duration,
StartTime: log.StartTime,
EndTime: log.EndTime,
CreatedAt: log.CreatedAt, CreatedAt: log.CreatedAt,
} }
} }
@@ -109,6 +113,8 @@ func (lc *LogController) GetLogDetail(c *gin.Context) {
"output": log.Output, "output": log.Output,
"status": log.Status, "status": log.Status,
"duration": log.Duration, "duration": log.Duration,
"start_time": log.StartTime,
"end_time": log.EndTime,
"created_at": log.CreatedAt, "created_at": log.CreatedAt,
}) })
} }
+1 -1
View File
@@ -209,7 +209,7 @@ watch(() => route.query.task_id, (newTaskId) => {
</span> </span>
</span> </span>
<span class="w-16 text-right shrink-0 text-muted-foreground text-xs">{{ formatDuration(log.duration) }}</span> <span class="w-16 text-right shrink-0 text-muted-foreground text-xs">{{ formatDuration(log.duration) }}</span>
<span v-if="!selectedLog" class="w-40 text-right shrink-0 text-muted-foreground text-xs hidden md:block">{{ log.created_at }}</span> <span v-if="!selectedLog" class="w-40 text-right shrink-0 text-muted-foreground text-xs hidden md:block">{{ log.start_time || log.created_at }}</span>
</div> </div>
</div> </div>
</div> </div>