]> source.dussan.org Git - gitea.git/commitdiff
Add step start time to `ViewStepLog` (#24980)
authorZettat123 <zettat123@gmail.com>
Mon, 29 May 2023 08:18:36 +0000 (16:18 +0800)
committerGitHub <noreply@github.com>
Mon, 29 May 2023 08:18:36 +0000 (08:18 +0000)
Part of #24876

According to
https://github.com/go-gitea/gitea/pull/24876#discussion_r1205565622 , we
need the start time of the step to get the log time offset.

routers/web/repo/actions/view.go

index 211433861295e3e37e00e7fb5c44a062904a87e9..7c2e9d63d6d32dcc7a34480627e37dce38d4fe6c 100644 (file)
@@ -106,9 +106,10 @@ type ViewJobStep struct {
 }
 
 type ViewStepLog struct {
-       Step   int                `json:"step"`
-       Cursor int64              `json:"cursor"`
-       Lines  []*ViewStepLogLine `json:"lines"`
+       Step    int                `json:"step"`
+       Cursor  int64              `json:"cursor"`
+       Lines   []*ViewStepLogLine `json:"lines"`
+       Started int64              `json:"started"`
 }
 
 type ViewStepLogLine struct {
@@ -241,9 +242,10 @@ func ViewPost(ctx *context_module.Context) {
                        }
 
                        resp.Logs.StepsLog = append(resp.Logs.StepsLog, &ViewStepLog{
-                               Step:   cursor.Step,
-                               Cursor: cursor.Cursor + int64(len(logLines)),
-                               Lines:  logLines,
+                               Step:    cursor.Step,
+                               Cursor:  cursor.Cursor + int64(len(logLines)),
+                               Lines:   logLines,
+                               Started: int64(step.Started),
                        })
                }
        }