feat: fix Ln number

This commit is contained in:
Jason Song 2022-10-31 13:21:15 +08:00
parent 339ddf4c5f
commit 30df383ca0

View File

@ -62,7 +62,7 @@ type ViewGroup struct {
} }
type ViewJob struct { type ViewJob struct {
Id int64 `json:"id"` ID int64 `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Status string `json:"status"` Status string `json:"status"`
} }
@ -103,7 +103,7 @@ func ViewPost(ctx *context.Context) {
respJobs := make([]*ViewJob, len(jobs)) respJobs := make([]*ViewJob, len(jobs))
for i, v := range jobs { for i, v := range jobs {
respJobs[i] = &ViewJob{ respJobs[i] = &ViewJob{
Id: v.ID, ID: v.ID,
Name: v.Name, Name: v.Name,
Status: v.Status.String(), Status: v.Status.String(),
} }
@ -168,7 +168,7 @@ func ViewPost(ctx *context.Context) {
logLines := make([]ViewStepLogLine, len(logRows)) logLines := make([]ViewStepLogLine, len(logRows))
for i, row := range logRows { for i, row := range logRows {
logLines[i] = ViewStepLogLine{ logLines[i] = ViewStepLogLine{
Ln: cursor.Cursor + int64(i), Ln: cursor.Cursor + int64(i) + 1, // start at 1
M: row.Content, M: row.Content,
T: float64(row.Time.AsTime().UnixNano()) / float64(time.Second), T: float64(row.Time.AsTime().UnixNano()) / float64(time.Second),
} }