From 8fc28f592d69168244e9c1cc175494ad4f05ca1b Mon Sep 17 00:00:00 2001 From: mixeme Date: Wed, 24 Jun 2026 07:49:26 +0300 Subject: [PATCH] app/format: add EventLine compact formatter (T1.1) Uses filepath.Base for the log file so the jobs log view can show one-line entries without the full directory path cluttering the row. EventText is kept intact for the History table. Co-Authored-By: Claude Sonnet 4.6 --- src/app/format.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app/format.go b/src/app/format.go index c49863d..a784378 100644 --- a/src/app/format.go +++ b/src/app/format.go @@ -2,6 +2,7 @@ package app import ( "fmt" + "path/filepath" "strings" "gitea.mixdep.ru/mix/gosentry/src/domain" @@ -32,6 +33,19 @@ func EventText(e domain.RunRecord) string { return fmt.Sprintf("%s %s %s %s %s", e.Time, trigger, e.JobName, e.State, e.Detail) } +// EventLine formats a run record as a compact single line for the jobs log +// view, using only the base name of the log file instead of the full path. +func EventLine(e domain.RunRecord) string { + trigger := e.Trigger + if trigger == "" { + trigger = "Unknown" + } + if e.LogFile != "" { + return fmt.Sprintf("%s %s %s %s %s %s", e.Time, trigger, e.JobName, e.State, e.Detail, filepath.Base(e.LogFile)) + } + return fmt.Sprintf("%s %s %s %s %s", e.Time, trigger, e.JobName, e.State, e.Detail) +} + // DisplayFolder formats a job's folder for display: "(No folder)" if empty, // else the trimmed folder name. func DisplayFolder(folder string) string {