-
Notifications
You must be signed in to change notification settings - Fork 5
/
play.jade
262 lines (243 loc) · 8.08 KB
/
play.jade
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
//-###########################################################################
//- Copyright (C) 2015-2016 by Vaughn Iverson
//- meteor-job-collection-playground is free software released under the MIT/X11 license.
//- See included LICENSE file for details.
//-###########################################################################
head
title meteor-job-collection-playground
body
div.ui.container
+top
+newJobInput
+jobTable jobCollection
template(name="top")
div.ui.segment
h2.ui.header
div.content
| job-collection Playground App
div.sub.header Connected clients: #{clientsConnected}
unless currentUser
div.ui.info.message
p
| You are currently in the public playground, create
| an account and sign in to have a private space.
div.loginTemp
+loginButtons align="right"
| Source code for this app is available
a(href="https://github.com/vsivsi/meteor-job-collection-playground") on GitHub
|, as is source for a
a(href="https://github.com/vsivsi/meteor-job-collection-playground-worker")
| plain node.js worker script
template(name="workerPanel")
div.ui.raised.segment#workerPanel
h3.ui.header
div.content
| Local worker
div.sub.header Jobs processed locally: #{jobsProcessed}
p Status:
if status
div.ui.small.green.label Running
p Job: {{truncateId _id}} Run: {{truncateId runId}}
div.ui.tiny.indicating.progress(data-percent="#{progress.percent}")
div.bar(style="transition-duration: 100ms; width: #{progress.percent}%;")
div.label Running #{progress.percent}%
button.orange.ui.small.right.labeled.icon.button.fail-job
i.thumbs.down.icon
| Fail
button.red.ui.small.right.labeled.icon.button.crash-job
i.bomb.icon
| Crash
else
div.ui.small.grey.label Idle
template(name="newJobInput")
div.ui.segment
h3.ui.header Create a new repeating job
| using Later.js
a(target="_blank" href="https://bunkat.github.io/later/parsers.html#text")
| text parser input,
| or a
a(target="_blank" href="http://en.wikipedia.org/wiki/Cron#CRON_expression")
| CRON expression
|:
p
div.field
label When should it run?
span.text-muted (all absolute times are UTC):
div.ui.large.fluid.action.input(class="#{inputError}")
input(id="inputLater" placeholder="e.g. 'every 5 minutes' or '*/5 * * * *'" type="text")
if inputReady
button#newJob.ui.green.right.labeled.icon.button
i.wait.icon
| Create new job
else if inputError
button.ui.disabled.red.right.labeled.icon.button
i.wait.icon
| Create new job
else
button.ui.disabled.right.labeled.icon.button
i.wait.icon
| Create new job
p
if inputReady
table.ui.celled.table
thead
tr
th
| Next 3 runtimes:
tbody
each nextTimes
tr
td
| #{.}
template(name="jobControls")
h4 Collection Controls
div.ui.equal.width.stackable.grid
div.column
button.ui.fluid.labeled.icon.button.pause-queue
i.pause.icon
| Pause all
div.column
button.ui.yellow.fluid.labeled.icon.button.cancel-queue
i.ban.icon
| Cancel all
div.column
button.ui.teal.fluid.labeled.icon.button.restart-queue
i.repeat.icon
| Restart all
div.column
button.ui.blue.fluid.labeled.icon.button.rerun-queue
i.refresh.icon
| Rerun all
div.column
button.ui.red.fluid.labeled.icon.button.remove-queue
i.remove.icon
| Remove all
template(name="jobTable")
div.ui.segment#jobTable
div.ui.raised.segment
h3.ui.header
div.content
| Job Collection
div.sub.header
| Total jobs processed: #{jobsProcessed} by #{numWorkers}
if equals numWorkers 1
| worker
else
| workers
div.ui.basic.segment
u Fine print:
| Jobs only run when a client is connected. This is because all "work" in this demo is
| performed in the client code. If you crash your local worker (or close/reload the page)
| while it is processing a job then that run of the job will not complete, and after a few
| minutes the job will time out and "auto-fail" so it can be retried later.
| Completed and cancelled jobs are also automatically removed
| by a "cleanup" job on the server after a short period of time. If you are not signed in,
| then the job collection you see below is being shared with other public users and will
| update "live" with their actions. In this demo when you create a new repeating job, all
| preexisting running or waiting jobs of that type are automatically cancelled.
table.ui.celled.striped.table
thead
tr
th Type
th Id
th Ready to Run
th Updated
th Attempts
th Repeats
th Status
th Actions
tbody
each jobEntries
+jobEntry
else
tr
td.center.aligned(colspan="20")
span.text-info No jobs in collection...
+jobControls
if wideScreen
div.ui.left.very.close.rail
+workerPanel localWorker
div.ui.right.very.close.rail
+logEntries
else
div.ui.stackable.grid
div.eight.wide.column
+workerPanel localWorker
div.eight.wide.column
+logEntries
template(name="pauseButton")
button.ui.mini.icon.button.pause-job
i.pause.icon
div.ui.inverted.popup Pause Job
template(name="resumeButton")
button.ui.mini.active.icon.button.resume-job
i.play.icon
div.ui.inverted.popup Resume Job
template(name="restartButton")
button.ui.mini.teal.icon.button.restart-job
i.repeat.icon
div.ui.inverted.popup Restart Job
template(name="rerunButton")
button.ui.mini.blue.icon.button.rerun-job
i.refresh.icon
div.ui.inverted.popup Rerun Job
template(name="cancelButton")
button.ui.mini.yellow.icon.button.cancel-job
i.ban.icon
div.ui.inverted.popup Cancel Job
template(name="removeButton")
button.ui.mini.red.icon.button.remove-job
i.remove.icon
div.ui.inverted.popup Remove Job
template(name="readyNowButton")
button.ui.compact.mini.white.right.floated.circular.icon.button.ready-job
i.play.green.icon
div.ui.inverted.popup Ready now
template(name="jobEntry")
tr
with doc
td #{type}
td {{truncateId _id}}
td(class="#{futurePast}")
| {{relativeTime after}}
if equals status 'waiting'
+readyNowButton
td {{relativeTime updated}}
td #{retried} / #{numRetries}
td #{repeated} / #{numRepeats}
td
if equals status "running"
div.ui.tiny.indicating.progress(data-percent="#{progress.percent}")
div.bar(style="transition-duration: 100ms; width: #{progress.percent}%;")
div.label Running #{progress.percent}%
else
div.ui.small.label(class="#{statusBG}") #{status}
td.button-column
if pausable
+pauseButton
if equals status 'paused'
+resumeButton
if restartable
+restartButton
if equals status 'completed'
+rerunButton
if cancellable
+cancelButton
if removable
+removeButton
template(name="logEntries")
div.ui.raised.segment#logEntries
h3 Recently Logged Events
div.ui.feed
each recentEvents
div.event(class="#{level}")
div.content
div.summary
div.user #{type} #{jobId}
if runId
div.meta Run: #{runId}
div.date {{relativeTime time}}
div.extra.text
div.ui.message(class="#{level}")
i.big.icon(class="#{levelIcon} #{level}")
| #{message}