dont include job output without refresh
parent
2cd9f5ea4d
commit
7db42cf5f0
|
|
@ -26,5 +26,5 @@ func (s *Server) get(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
json.NewEncoder(w).Encode(toMap(j))
|
json.NewEncoder(w).Encode(toMap(j, true))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func toMap(j *scheduler.Job) map[string]interface{} {
|
func toMap(j *scheduler.Job, output bool) map[string]interface{} {
|
||||||
tz, err := time.LoadLocation("America/Denver")
|
tz, err := time.LoadLocation("America/Denver")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
@ -23,8 +23,10 @@ func toMap(j *scheduler.Job) map[string]interface{} {
|
||||||
out["last"] = map[string]interface{}{
|
out["last"] = map[string]interface{}{
|
||||||
"run": j.LastRun.In(tz).Format(`2006-01-02 15:04:05 MST`),
|
"run": j.LastRun.In(tz).Format(`2006-01-02 15:04:05 MST`),
|
||||||
"runtime": j.LastRuntime.String(),
|
"runtime": j.LastRuntime.String(),
|
||||||
//"output": j.LastOutput,
|
"status": j.LastStatus,
|
||||||
"status": j.LastStatus,
|
}
|
||||||
|
if output {
|
||||||
|
out["last"].(map[string]interface{})["output"] = j.LastOutput
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ func (s *Server) list(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
out[i] = toMap(j)
|
out[i] = toMap(j, false)
|
||||||
}
|
}
|
||||||
sort.Slice(out, func(i, j int) bool {
|
sort.Slice(out, func(i, j int) bool {
|
||||||
return out[i]["title"].(string) < out[j]["title"].(string)
|
return out[i]["title"].(string) < out[j]["title"].(string)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue