Reload job in ui
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"local/firestormy/scheduler"
|
||||
"net/http"
|
||||
"sort"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *Server) list(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -29,22 +28,7 @@ func (s *Server) list(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
tz, err := time.LoadLocation("America/Denver")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
out[i]["disabled"] = j.Disabled
|
||||
out[i]["id"] = j.Name
|
||||
out[i]["title"] = j.Title
|
||||
out[i]["cron"] = j.Schedule
|
||||
out[i]["language"] = j.Runner.String()
|
||||
out[i]["script"] = j.Raw
|
||||
out[i]["last"] = map[string]interface{}{
|
||||
"run": j.LastRun.In(tz).Format(`2006-01-02 15:04:05 MST`),
|
||||
"runtime": j.LastRuntime.String(),
|
||||
"output": string(j.LastOutput),
|
||||
"status": j.LastStatus,
|
||||
}
|
||||
out[i] = toMap(j)
|
||||
}
|
||||
sort.Slice(out, func(i, j int) bool {
|
||||
return out[i]["title"].(string) < out[j]["title"].(string)
|
||||
|
||||
Reference in New Issue
Block a user