46 lines
895 B
Go
Raw Normal View History

package jobs
import (
2018-04-28 19:17:44 +00:00
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
2018-04-28 19:17:44 +00:00
var jobInfo = map[string]*utils.JobInfo{
2019-04-23 05:52:55 +00:00
"kitsu-import-anime": {
Name: "kitsu-import-anime",
},
2018-12-06 03:06:37 +00:00
// "anime-ratings": &utils.JobInfo{
// Name: "anime-ratings",
// },
// "twist": &utils.JobInfo{
// Name: "twist",
// },
// "refresh-games": &utils.JobInfo{
// Name: "refresh-games",
// },
// "test": &utils.JobInfo{
// Name: "test",
// },
2018-04-28 19:17:44 +00:00
}
var jobLogs = []string{}
// Overview shows all background jobs.
func Overview(ctx *aero.Context) string {
user := utils.GetUser(ctx)
2018-04-28 19:17:44 +00:00
jobs := []*utils.JobInfo{}
for _, job := range jobInfo {
jobs = append(jobs, job)
}
sort.Slice(jobs, func(i, j int) bool {
return jobs[i].Name < jobs[j].Name
})
2018-04-28 19:17:44 +00:00
return ctx.HTML(components.EditorJobs(jobs, jobLogs, ctx.URI(), user))
}