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 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package app
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.mixdep.ru/mix/gosentry/src/domain"
|
"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)
|
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,
|
// DisplayFolder formats a job's folder for display: "(No folder)" if empty,
|
||||||
// else the trimmed folder name.
|
// else the trimmed folder name.
|
||||||
func DisplayFolder(folder string) string {
|
func DisplayFolder(folder string) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user