Scheduled Jobs

/views/vadmin/Schedule.html (1.2 KB)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{% import (
"strings"

"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/lib/schedule"
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/layout"
) %}

{% code type Schedule struct {
layout.Basic
Jobs schedule.Jobs
} %}

{% func (p *Schedule) Body(as *app.State, ps *cutil.PageState) %}
<div class="card">
<h3>Scheduled Jobs</h3>
{%= jobTable(p.Jobs) %}
</div>
{% endfunc %}

{% func jobTable(jobs schedule.Jobs) %}
<div class="overflow full-width">
<table class="mt min-200 expanded">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Tags</th>
<th>Last</th>
<th>Next</th>
</tr>
</thead>
<tbody>
{%- for _, j := range jobs -%}
<tr>
<td class="shrink"><a href="/admin/schedule/{%s j.ID.String() %}">{%s j.ID.String() %}</a></td>
<td>{%s j.Name %}</td>
<td>{%s strings.Join(j.Tags, ", ") %}</td>
<td>{%s util.TimeToFullMS(j.Last) %}</td>
<td>{%s util.TimeToFullMS(j.Next) %}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{% endfunc %}