Move jobs raw definition to their own namespace and the cascading fallout

This commit is contained in:
Bel LaPointe
2020-04-24 09:52:34 -06:00
parent d9b10029ae
commit 9bd9c47895
7 changed files with 84 additions and 35 deletions

View File

@@ -1,6 +1,8 @@
package server
import (
"local/firestormy/config"
"local/firestormy/config/ns"
"local/firestormy/scheduler"
"time"
)
@@ -16,7 +18,8 @@ func toMap(j *scheduler.Job) map[string]interface{} {
out["title"] = j.Title
out["cron"] = j.Schedule
out["language"] = j.Runner.String()
out["script"] = j.Raw
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(),