package server import ( "local/firestormy/config" "local/firestormy/config/ns" "local/firestormy/scheduler" "time" ) func toMap(j *scheduler.Job) map[string]interface{} { tz, err := time.LoadLocation("America/Denver") if err != nil { panic(err) } out := make(map[string]interface{}) out["disabled"] = j.Disabled out["id"] = j.Name out["title"] = j.Title out["cron"] = j.Schedule out["language"] = j.Runner.String() b, _ := config.Store.Get(j.Name, ns.JobsRaw...) out["script"] = string(b) out["last"] = map[string]interface{}{ "run": j.LastRun.In(tz).Format(`2006-01-02 15:04:05 MST`), "runtime": j.LastRuntime.String(), "output": j.LastOutput, "status": j.LastStatus, } return out }