feat(web): service page, manual update, jobs list and live job log (#7)
Also publishes the jobs topic on agent revoke and updates the agent snippet to mount stacks read-write at the same path.
This commit is contained in:
@@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/shcizo/package-updater/internal/imageref"
|
||||
"github.com/shcizo/package-updater/internal/master/model"
|
||||
@@ -49,3 +50,15 @@ type agentRow struct {
|
||||
model.Agent
|
||||
Online bool
|
||||
}
|
||||
|
||||
// jobDuration is how long a job ran, or has been running; "" before it starts.
|
||||
func jobDuration(j model.Job) string {
|
||||
if j.StartedAt == nil {
|
||||
return ""
|
||||
}
|
||||
end := time.Now()
|
||||
if j.FinishedAt != nil {
|
||||
end = *j.FinishedAt
|
||||
}
|
||||
return end.Sub(*j.StartedAt).Round(time.Second).String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user