level_up 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +2 -0
- data/LICENSE.txt +20 -0
- data/README.md +190 -0
- data/Rakefile +40 -0
- data/app/assets/images/level_up/search.png +0 -0
- data/app/assets/javascripts/level_up/application.js +15 -0
- data/app/assets/javascripts/level_up/home.js +2 -0
- data/app/assets/javascripts/level_up/jobs.js +2 -0
- data/app/assets/stylesheets/level_up/application.css.scss +446 -0
- data/app/assets/stylesheets/level_up/home.css.scss +119 -0
- data/app/assets/stylesheets/level_up/jobs.css.scss +159 -0
- data/app/assets/stylesheets/level_up/rwdgrid.css +403 -0
- data/app/controllers/level_up/application_controller.rb +4 -0
- data/app/controllers/level_up/home_controller.rb +22 -0
- data/app/controllers/level_up/jobs_controller.rb +117 -0
- data/app/helpers/level_up/application_helper.rb +7 -0
- data/app/helpers/level_up/home_helper.rb +7 -0
- data/app/helpers/level_up/jobs_helper.rb +4 -0
- data/app/models/level_up/job.rb +212 -0
- data/app/models/level_up/state/cancel.rb +7 -0
- data/app/models/level_up/state/end.rb +7 -0
- data/app/models/level_up/state/start.rb +9 -0
- data/app/models/level_up/state.rb +53 -0
- data/app/views/layouts/level_up/_footer.html.erb +9 -0
- data/app/views/layouts/level_up/_header.html.erb +23 -0
- data/app/views/layouts/level_up/application.html.erb +36 -0
- data/app/views/level_up/home/index.html.erb +85 -0
- data/app/views/level_up/home/workflow.html.erb +5 -0
- data/app/views/level_up/jobs/edit.html.erb +65 -0
- data/app/views/level_up/jobs/index.html.erb +73 -0
- data/app/views/level_up/jobs/show.html.erb +93 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20130212111454_create_level_up_jobs.rb +27 -0
- data/lib/level_up/configuration.rb +27 -0
- data/lib/level_up/engine.rb +17 -0
- data/lib/level_up/version.rb +3 -0
- data/lib/level_up.rb +7 -0
- data/lib/tasks/level_up_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/account_banish.rb +18 -0
- data/test/dummy/app/jobs/account_downgrade.rb +13 -0
- data/test/dummy/app/jobs/account_upgrade.rb +15 -0
- data/test/dummy/app/jobs/mailing_list_subscription.rb +15 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20130212113009_create_delayed_jobs.rb +22 -0
- data/test/dummy/db/migrate/20130215111404_create_level_up_jobs.level_up.rb +28 -0
- data/test/dummy/db/schema.rb +57 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/delayed_job +5 -0
- data/test/dummy/script/rails +6 -0
- data/test/fixtures/level_up/jobs.yml +11 -0
- data/test/functional/level_up/home_controller_test.rb +9 -0
- data/test/functional/level_up/jobs_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/level_up_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/helpers/level_up/home_helper_test.rb +6 -0
- data/test/unit/helpers/level_up/jobs_helper_test.rb +6 -0
- data/test/unit/level_up/job_test.rb +208 -0
- metadata +333 -0
@@ -0,0 +1,403 @@
|
|
1
|
+
/*********************************************************************************************
|
2
|
+
|
3
|
+
Project : rwdgrid - responsive grid system for your next project
|
4
|
+
URI: http://rwdgrid.com/
|
5
|
+
Version: 1.0
|
6
|
+
Author: Vineeth G S
|
7
|
+
Author URI: http://www.gsvineeth.com
|
8
|
+
Github URI: https://github.com/gsvineeth/rwdgrid/
|
9
|
+
|
10
|
+
**********************************************************************************************
|
11
|
+
|
12
|
+
1. CSS Reset
|
13
|
+
2. Grid 1200px
|
14
|
+
3. Grid 960px
|
15
|
+
4. Grid 720px
|
16
|
+
5. Grid lt 720px/ Mobile
|
17
|
+
6. Responsive Image
|
18
|
+
|
19
|
+
|
20
|
+
**********************************************************************************************/
|
21
|
+
|
22
|
+
|
23
|
+
/*********************************************************************************************
|
24
|
+
|
25
|
+
1. CSS Reset by Eric Meyer http://meyerweb.com/eric/tools/css/reset/
|
26
|
+
|
27
|
+
*********************************************************************************************/
|
28
|
+
|
29
|
+
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
|
30
|
+
margin: 0;
|
31
|
+
padding: 0;
|
32
|
+
border: 0;
|
33
|
+
font: inherit;
|
34
|
+
vertical-align: baseline;
|
35
|
+
}
|
36
|
+
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
|
37
|
+
display: block;
|
38
|
+
}
|
39
|
+
body {
|
40
|
+
line-height: 1;
|
41
|
+
}
|
42
|
+
ol, ul {
|
43
|
+
list-style: none;
|
44
|
+
}
|
45
|
+
blockquote, q {
|
46
|
+
quotes: none;
|
47
|
+
}
|
48
|
+
blockquote:before, blockquote:after, q:before, q:after {
|
49
|
+
content: '';
|
50
|
+
content: none;
|
51
|
+
}
|
52
|
+
table {
|
53
|
+
border-collapse: collapse;
|
54
|
+
border-spacing: 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
/*********************************************************************************************
|
58
|
+
|
59
|
+
2. Grid 1200px
|
60
|
+
|
61
|
+
*********************************************************************************************/
|
62
|
+
|
63
|
+
.container-16, .container-12 {
|
64
|
+
margin:0 auto;
|
65
|
+
width: 1200px;
|
66
|
+
overflow: hidden;
|
67
|
+
}
|
68
|
+
.grid-1, .grid-2, .grid-3, .grid-4, .grid-5, .grid-6, .grid-7, .grid-8, .grid-9, .grid-10, .grid-11, .grid-12, .grid-13, .grid-14, .grid-15, .grid-16 {
|
69
|
+
display:inline;
|
70
|
+
float: left;
|
71
|
+
margin-left: 10px;
|
72
|
+
margin-right: 10px;
|
73
|
+
}
|
74
|
+
.alpha {
|
75
|
+
margin-left: 0;
|
76
|
+
}
|
77
|
+
.omega {
|
78
|
+
margin-right: 0;
|
79
|
+
}
|
80
|
+
.beta {
|
81
|
+
margin-left: 0;
|
82
|
+
margin-right: 0;
|
83
|
+
}
|
84
|
+
.container-16 .grid-1 {
|
85
|
+
width:55px;
|
86
|
+
}
|
87
|
+
.container-16 .grid-2 {
|
88
|
+
width:130px;
|
89
|
+
}
|
90
|
+
.container-16 .grid-3 {
|
91
|
+
width:205px;
|
92
|
+
}
|
93
|
+
.container-16 .grid-4 {
|
94
|
+
width:280px;
|
95
|
+
}
|
96
|
+
.container-16 .grid-5 {
|
97
|
+
width:355px;
|
98
|
+
}
|
99
|
+
.container-16 .grid-6 {
|
100
|
+
width:430px;
|
101
|
+
}
|
102
|
+
.container-16 .grid-7 {
|
103
|
+
width:505px;
|
104
|
+
}
|
105
|
+
.container-16 .grid-8 {
|
106
|
+
width:580px;
|
107
|
+
}
|
108
|
+
.container-16 .grid-9 {
|
109
|
+
width:655px;
|
110
|
+
}
|
111
|
+
.container-16 .grid-10 {
|
112
|
+
width:730px;
|
113
|
+
}
|
114
|
+
.container-16 .grid-11 {
|
115
|
+
width:805px;
|
116
|
+
}
|
117
|
+
.container-16 .grid-12 {
|
118
|
+
width:880px;
|
119
|
+
}
|
120
|
+
.container-16 .grid-13 {
|
121
|
+
width:955px;
|
122
|
+
}
|
123
|
+
.container-16 .grid-14 {
|
124
|
+
width:1030px;
|
125
|
+
}
|
126
|
+
.container-16 .grid-15 {
|
127
|
+
width:1105px;
|
128
|
+
}
|
129
|
+
.container-16 .grid-16 {
|
130
|
+
width:1180px;
|
131
|
+
}
|
132
|
+
.container-12 .grid-1 {
|
133
|
+
width:80px;
|
134
|
+
}
|
135
|
+
.container-12 .grid-2 {
|
136
|
+
width:180px;
|
137
|
+
}
|
138
|
+
.container-12 .grid-3 {
|
139
|
+
width:280px;
|
140
|
+
}
|
141
|
+
.container-12 .grid-4 {
|
142
|
+
width:380px;
|
143
|
+
}
|
144
|
+
.container-12 .grid-5 {
|
145
|
+
width:480px;
|
146
|
+
}
|
147
|
+
.container-12 .grid-6 {
|
148
|
+
width:580px;
|
149
|
+
}
|
150
|
+
.container-12 .grid-7 {
|
151
|
+
width:680px;
|
152
|
+
}
|
153
|
+
.container-12 .grid-8 {
|
154
|
+
width:780px;
|
155
|
+
}
|
156
|
+
.container-12 .grid-9 {
|
157
|
+
width:880px;
|
158
|
+
}
|
159
|
+
.container-12 .grid-10 {
|
160
|
+
width:980px;
|
161
|
+
}
|
162
|
+
.container-12 .grid-11 {
|
163
|
+
width:1080px;
|
164
|
+
}
|
165
|
+
.container-12 .grid-12 {
|
166
|
+
width:1180px;
|
167
|
+
}
|
168
|
+
|
169
|
+
/*********************************************************************************************
|
170
|
+
|
171
|
+
3. Grid 960px (mediaqueries)
|
172
|
+
|
173
|
+
*********************************************************************************************/
|
174
|
+
|
175
|
+
@media only screen and (min-width: 960px) and (max-width: 1199px) {
|
176
|
+
.container-16, .container-12 {
|
177
|
+
width: 960px;
|
178
|
+
}
|
179
|
+
.container-16 .grid-1 {
|
180
|
+
width:40px;
|
181
|
+
}
|
182
|
+
.container-16 .grid-2 {
|
183
|
+
width:100px;
|
184
|
+
}
|
185
|
+
.container-16 .grid-3 {
|
186
|
+
width:160px;
|
187
|
+
}
|
188
|
+
.container-16 .grid-4 {
|
189
|
+
width:220px;
|
190
|
+
}
|
191
|
+
.container-16 .grid-5 {
|
192
|
+
width:280px;
|
193
|
+
}
|
194
|
+
.container-16 .grid-6 {
|
195
|
+
width:340px;
|
196
|
+
}
|
197
|
+
.container-16 .grid-7 {
|
198
|
+
width:400px;
|
199
|
+
}
|
200
|
+
.container-16 .grid-8 {
|
201
|
+
width:460px;
|
202
|
+
}
|
203
|
+
.container-16 .grid-9 {
|
204
|
+
width:520px;
|
205
|
+
}
|
206
|
+
.container-16 .grid-10 {
|
207
|
+
width:580px;
|
208
|
+
}
|
209
|
+
.container-16 .grid-11 {
|
210
|
+
width:640px;
|
211
|
+
}
|
212
|
+
.container-16 .grid-12 {
|
213
|
+
width:700px;
|
214
|
+
}
|
215
|
+
.container-16 .grid-13 {
|
216
|
+
width:760px;
|
217
|
+
}
|
218
|
+
.container-16 .grid-14 {
|
219
|
+
width:820px;
|
220
|
+
}
|
221
|
+
.container-16 .grid-15 {
|
222
|
+
width:880px;
|
223
|
+
}
|
224
|
+
.container-16 .grid-16 {
|
225
|
+
width:940px;
|
226
|
+
}
|
227
|
+
.container-12 .grid-1 {
|
228
|
+
width:60px;
|
229
|
+
}
|
230
|
+
.container-12 .grid-2 {
|
231
|
+
width:140px;
|
232
|
+
}
|
233
|
+
.container-12 .grid-3 {
|
234
|
+
width:220px;
|
235
|
+
}
|
236
|
+
.container-12 .grid-4 {
|
237
|
+
width:300px;
|
238
|
+
}
|
239
|
+
.container-12 .grid-5 {
|
240
|
+
width:380px;
|
241
|
+
}
|
242
|
+
.container-12 .grid-6 {
|
243
|
+
width:460px;
|
244
|
+
}
|
245
|
+
.container-12 .grid-7 {
|
246
|
+
width:540px;
|
247
|
+
}
|
248
|
+
.container-12 .grid-8 {
|
249
|
+
width:620px;
|
250
|
+
}
|
251
|
+
.container-12 .grid-9 {
|
252
|
+
width:700px;
|
253
|
+
}
|
254
|
+
.container-12 .grid-10 {
|
255
|
+
width:780px;
|
256
|
+
}
|
257
|
+
.container-12 .grid-11 {
|
258
|
+
width:860px;
|
259
|
+
}
|
260
|
+
.container-12 .grid-12 {
|
261
|
+
width:940px;
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
/*********************************************************************************************
|
266
|
+
|
267
|
+
4. Grid 720px (mediaqueries)
|
268
|
+
|
269
|
+
*********************************************************************************************/
|
270
|
+
|
271
|
+
@media only screen and (min-width: 720px) and (max-width: 959px) {
|
272
|
+
.container-16, .container-12 {
|
273
|
+
width: 720px;
|
274
|
+
}
|
275
|
+
.container-16 .grid-1 {
|
276
|
+
width:25px;
|
277
|
+
}
|
278
|
+
.container-16 .grid-2 {
|
279
|
+
width:70px;
|
280
|
+
}
|
281
|
+
.container-16 .grid-3 {
|
282
|
+
width:115px;
|
283
|
+
}
|
284
|
+
.container-16 .grid-4 {
|
285
|
+
width:160px;
|
286
|
+
}
|
287
|
+
.container-16 .grid-5 {
|
288
|
+
width:205px;
|
289
|
+
}
|
290
|
+
.container-16 .grid-6 {
|
291
|
+
width:250px;
|
292
|
+
}
|
293
|
+
.container-16 .grid-7 {
|
294
|
+
width:295px;
|
295
|
+
}
|
296
|
+
.container-16 .grid-8 {
|
297
|
+
width:340px;
|
298
|
+
}
|
299
|
+
.container-16 .grid-9 {
|
300
|
+
width:385px;
|
301
|
+
}
|
302
|
+
.container-16 .grid-10 {
|
303
|
+
width:430px;
|
304
|
+
}
|
305
|
+
.container-16 .grid-11 {
|
306
|
+
width:475px;
|
307
|
+
}
|
308
|
+
.container-16 .grid-12 {
|
309
|
+
width:520px;
|
310
|
+
}
|
311
|
+
.container-16 .grid-13 {
|
312
|
+
width:565px;
|
313
|
+
}
|
314
|
+
.container-16 .grid-14 {
|
315
|
+
width:610px;
|
316
|
+
}
|
317
|
+
.container-16 .grid-15 {
|
318
|
+
width:655px;
|
319
|
+
}
|
320
|
+
.container-16 .grid-16 {
|
321
|
+
width:700px;
|
322
|
+
}
|
323
|
+
.container-12 .grid-1 {
|
324
|
+
width:40px;
|
325
|
+
}
|
326
|
+
.container-12 .grid-2 {
|
327
|
+
width:100px;
|
328
|
+
}
|
329
|
+
.container-12 .grid-3 {
|
330
|
+
width:160px;
|
331
|
+
}
|
332
|
+
.container-12 .grid-4 {
|
333
|
+
width:220px;
|
334
|
+
}
|
335
|
+
.container-12 .grid-5 {
|
336
|
+
width:280px;
|
337
|
+
}
|
338
|
+
.container-12 .grid-6 {
|
339
|
+
width:340px;
|
340
|
+
}
|
341
|
+
.container-12 .grid-7 {
|
342
|
+
width:400px;
|
343
|
+
}
|
344
|
+
.container-12 .grid-8 {
|
345
|
+
width:460px;
|
346
|
+
}
|
347
|
+
.container-12 .grid-9 {
|
348
|
+
width:520px;
|
349
|
+
}
|
350
|
+
.container-12 .grid-10 {
|
351
|
+
width:580px;
|
352
|
+
}
|
353
|
+
.container-12 .grid-11 {
|
354
|
+
width:640px;
|
355
|
+
}
|
356
|
+
.container-12 .grid-12 {
|
357
|
+
width:700px;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
|
361
|
+
|
362
|
+
/*********************************************************************************************
|
363
|
+
|
364
|
+
5. Grid lt 720px / Mobile (mediaqueries)
|
365
|
+
|
366
|
+
*********************************************************************************************/
|
367
|
+
|
368
|
+
@media only screen and (max-width: 719px) {
|
369
|
+
.container-12, .container-16 {
|
370
|
+
width: 90%;
|
371
|
+
}
|
372
|
+
.grid-1, .grid-2, .grid-3, .grid-4, .grid-5, .grid-6, .grid-7, .grid-8, .grid-9, .grid-10, .grid-11, .grid-12, .grid-13, .grid-14, .grid-15, .grid-16 {
|
373
|
+
width:100%;
|
374
|
+
margin-left: 0px;
|
375
|
+
margin-right: 0px;
|
376
|
+
}
|
377
|
+
.alpha {
|
378
|
+
margin-left: 0;
|
379
|
+
}
|
380
|
+
.omega {
|
381
|
+
margin-right: 0;
|
382
|
+
}
|
383
|
+
.beta {
|
384
|
+
margin-left: 0;
|
385
|
+
margin-right: 0;
|
386
|
+
}
|
387
|
+
.container-16 .grid-1, .container-16 .grid-2, .container-16 .grid-3, .container-16 .grid-4, .container-16 .grid-5, .container-16 .grid-6, .container-16 .grid-7, .container-16 .grid-8, .container-16 .grid-9, .container-16 .grid-10, .container-16 .grid-11, .container-16 .grid-12, .container-16 .grid-13, .container-16 .grid-14, .container-16 .grid-15, .container-16 .grid-16, .container-12 .grid-1, .container-12 .grid-2, .container-12 .grid-3, .container-12 .grid-4, .container-12 .grid-5, .container-12 .grid-6, .container-12 .grid-7, .container-12 .grid-8, .container-12 .grid-9, .container-12 .grid-10, .container-12 .grid-11, .container-12 .grid-12 {
|
388
|
+
width:100%;
|
389
|
+
}
|
390
|
+
}
|
391
|
+
|
392
|
+
|
393
|
+
/*********************************************************************************************
|
394
|
+
|
395
|
+
6. Responsive Image
|
396
|
+
|
397
|
+
*********************************************************************************************/
|
398
|
+
|
399
|
+
|
400
|
+
img.scale, img.responsive {
|
401
|
+
max-width: 100%;
|
402
|
+
height: auto;
|
403
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_dependency "level_up/application_controller"
|
2
|
+
|
3
|
+
module LevelUp
|
4
|
+
class HomeController < ApplicationController
|
5
|
+
if Configuration.http_authentication
|
6
|
+
http_basic_authenticate_with name: Configuration.http_login, password: Configuration.http_password
|
7
|
+
end
|
8
|
+
|
9
|
+
def index
|
10
|
+
@metrics = {created: {}, started: {}, ended: {}, canceled: {}}
|
11
|
+
[:created, :started, :ended, :canceled].each do |type|
|
12
|
+
start_date = Date.today - 1.month
|
13
|
+
values = LevelUp::Job.where(created_at: start_date..Date.today).order(:created_at).group("DATE(#{type}_at)").count
|
14
|
+
|
15
|
+
while start_date != Date.today do
|
16
|
+
@metrics[type][start_date.to_s] = values[start_date.to_s] ? values[start_date.to_s] : 0
|
17
|
+
start_date += 1.day
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require_dependency 'level_up/application_controller'
|
2
|
+
|
3
|
+
module LevelUp
|
4
|
+
class JobsController < ApplicationController
|
5
|
+
if Configuration.http_authentication
|
6
|
+
http_basic_authenticate_with name: Configuration.http_login, password: Configuration.http_password
|
7
|
+
end
|
8
|
+
|
9
|
+
def index
|
10
|
+
@search_params = params[:search] || {}
|
11
|
+
@query_params = @search_params.dup
|
12
|
+
|
13
|
+
if @query_params[:delayed_job_id_eq] == 'true'
|
14
|
+
@query_params[:delayed_job_id_is_not_null] = true
|
15
|
+
elsif @query_params[:delayed_job_id_eq] == 'false'
|
16
|
+
@query_params[:delayed_job_id_is_null] = true
|
17
|
+
end
|
18
|
+
@query_params.delete :delayed_job_id_eq
|
19
|
+
|
20
|
+
@search = Job.search(@query_params)
|
21
|
+
@jobs = @search.relation.page(params[:page]).per(20)
|
22
|
+
end
|
23
|
+
|
24
|
+
def show
|
25
|
+
@job = Job.find params[:id]
|
26
|
+
end
|
27
|
+
|
28
|
+
def edit
|
29
|
+
@job = Job.find params[:id]
|
30
|
+
end
|
31
|
+
|
32
|
+
def update
|
33
|
+
@job = Job.find params[:id]
|
34
|
+
if @job.update_attributes(params[:job])
|
35
|
+
redirect_to job_path(@job), notice: 'Changes saved!'
|
36
|
+
else
|
37
|
+
render :edit
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def destroy
|
42
|
+
job = Job.find params[:id]
|
43
|
+
job.destroy
|
44
|
+
redirect_to jobs_path, notice: "Job destroyed!"
|
45
|
+
end
|
46
|
+
|
47
|
+
def unqueue
|
48
|
+
job = Job.find params[:id]
|
49
|
+
job.unqueue!
|
50
|
+
redirect_to job_path(job), notice: 'Unqueued!'
|
51
|
+
end
|
52
|
+
|
53
|
+
def run
|
54
|
+
job = Job.find params[:id]
|
55
|
+
job.event!(nil, false, false)
|
56
|
+
redirect_to job_path(job), notice: 'Run!'
|
57
|
+
end
|
58
|
+
|
59
|
+
def reboot
|
60
|
+
job = Job.find params[:id]
|
61
|
+
if job.boot_async!
|
62
|
+
redirect_to job_path(job), notice: 'Rebooted!'
|
63
|
+
else
|
64
|
+
flash[:error] = 'Error while rebooting'
|
65
|
+
redirect_to job_path(job)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def move
|
70
|
+
job = Job.find params[:id]
|
71
|
+
if job.boot_async!(params[:state])
|
72
|
+
redirect_to job_path(j), notice: "Moved to #{params[:state]}!"
|
73
|
+
else
|
74
|
+
flash[:error] = "Error while moving to #{params[:state]}"
|
75
|
+
redirect_to job_path(job)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
respond_to :svg
|
80
|
+
def graphviz
|
81
|
+
job = Job.find params[:id]
|
82
|
+
g = GraphViz.new(:G, type: :digraph)
|
83
|
+
g[:bgcolor]= '#fafbfb'
|
84
|
+
|
85
|
+
g.node[:color] = '#111111'
|
86
|
+
g.node[:style] = 'filled'
|
87
|
+
g.node[:shape] = 'box'
|
88
|
+
g.node[:fillcolor] = '#666666'
|
89
|
+
g.node[:fontcolor] = 'white'
|
90
|
+
g.node[:fontname] = 'Verdana'
|
91
|
+
g.edge[:color] = '#000000'
|
92
|
+
g.edge[:arrowhead] = 'open'
|
93
|
+
|
94
|
+
states = {}
|
95
|
+
job.states.each do |state|
|
96
|
+
states[state] = g.add_nodes(state.to_s.humanize.downcase)
|
97
|
+
if state == :start
|
98
|
+
states[state][:fillcolor] = '#5db1a4'
|
99
|
+
states[state][:color] = '#048282'
|
100
|
+
|
101
|
+
elsif state == :end
|
102
|
+
states[state][:fillcolor] = '#b40d28'
|
103
|
+
states[state][:color] = '#600615'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
job.states.each do |state|
|
108
|
+
job.transitions(state).each do |transition|
|
109
|
+
g.add_edges(states[state], states[transition])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
g.output(:svg => "#{Rails.root}/tmp/job_#{job.id}.svg")
|
114
|
+
send_data(File.open("#{Rails.root}/tmp/job_#{job.id}.svg").read, filename: "job_#{job.id}.svg", type: 'image/svg+xml', disposition: 'inline')
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|