alchemy-chimera 0.5.4 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +39 -4
  2. package/assets/scripts/chimera/chimera.js +13 -288
  3. package/assets/stylesheets/chimera/chimera.scss +451 -0
  4. package/bootstrap.js +6 -302
  5. package/config/routes.js +53 -5
  6. package/controller/00-chimera_controller.js +16 -0
  7. package/controller/chimera_editor_controller.js +159 -614
  8. package/controller/chimera_static_controller.js +102 -9
  9. package/lib/chimera_config.js +138 -163
  10. package/model/model.js +1 -1
  11. package/package.json +8 -12
  12. package/view/chimera/dashboard.hwk +8 -0
  13. package/view/chimera/editor/index.hwk +20 -0
  14. package/view/chimera/sidebar.hwk +4 -0
  15. package/view/chimera/widgets.hwk +8 -0
  16. package/view/layouts/chimera_base.hwk +15 -0
  17. package/view/layouts/chimera_basics.hwk +15 -0
  18. package/view/layouts/chimera_body.hwk +24 -0
  19. package/assets/scripts/chimera/assoc_field.js +0 -311
  20. package/assets/scripts/chimera/boolean_field.js +0 -53
  21. package/assets/scripts/chimera/chimera_field.js +0 -622
  22. package/assets/scripts/chimera/chimera_field_wrapper.js +0 -558
  23. package/assets/scripts/chimera/date_field.js +0 -170
  24. package/assets/scripts/chimera/geopoint_field.js +0 -147
  25. package/assets/scripts/chimera/medium-button.js +0 -6
  26. package/assets/scripts/chimera/object_field.js +0 -51
  27. package/assets/scripts/chimera/page-editor.js +0 -3
  28. package/assets/scripts/chimera/password_field.js +0 -73
  29. package/assets/scripts/chimera/schema_field.js +0 -300
  30. package/assets/scripts/chimera/text_field.js +0 -119
  31. package/assets/scripts/rome/rome.js +0 -4978
  32. package/assets/scripts/vex/vex.dialog.js +0 -151
  33. package/assets/scripts/vex/vex.js +0 -193
  34. package/assets/stylesheets/chimera/chimera.less +0 -1075
  35. package/assets/stylesheets/chimera_old/chimera.less +0 -351
  36. package/assets/stylesheets/chimera_old/core.less +0 -315
  37. package/assets/stylesheets/chimera_old/font.less +0 -38
  38. package/assets/stylesheets/chimera_old/mixins.less +0 -35
  39. package/assets/stylesheets/chimera_old/page-editor.less +0 -23
  40. package/assets/stylesheets/rome/rome.less +0 -130
  41. package/assets/stylesheets/vex/vex-theme-bottom-right-corner.less +0 -613
  42. package/assets/stylesheets/vex/vex.default.less +0 -501
  43. package/assets/stylesheets/vex/vex.flat.less +0 -443
  44. package/assets/stylesheets/vex/vex.less +0 -320
  45. package/controller/chimera_page_controller.js +0 -14
  46. package/controller/chimera_settings_controller.js +0 -129
  47. package/controller/tasks_chimera_controller.js +0 -106
  48. package/helper/chimera_helper.js +0 -202
  49. package/lib/chimera_action_fields.js +0 -292
  50. package/lib/chimera_field/belongsto_chimera_field.js +0 -160
  51. package/lib/chimera_field/boolean_chimera_field.js +0 -19
  52. package/lib/chimera_field/date_chimera_field.js +0 -20
  53. package/lib/chimera_field/datetime_chimera_field.js +0 -20
  54. package/lib/chimera_field/enum_chimera_field.js +0 -131
  55. package/lib/chimera_field/geopoint_chimera_field.js +0 -20
  56. package/lib/chimera_field/habtm_chimera_field.js +0 -55
  57. package/lib/chimera_field/hasoneparent_chimera_field.js +0 -18
  58. package/lib/chimera_field/html_chimera_field.js +0 -20
  59. package/lib/chimera_field/object_chimera_field.js +0 -18
  60. package/lib/chimera_field/password_chimera_field.js +0 -18
  61. package/lib/chimera_field/schema_chimera_field.js +0 -149
  62. package/lib/chimera_field/text_chimera_field.js +0 -20
  63. package/lib/chimera_field/time_chimera_field.js +0 -18
  64. package/lib/chimera_field.js +0 -208
  65. package/model/setting_model.js +0 -51
  66. package/public/chimera/codedor.svg +0 -28
  67. package/view/chimera/dashboard.ejs +0 -5
  68. package/view/chimera/editor/add.ejs +0 -32
  69. package/view/chimera/editor/edit.ejs +0 -33
  70. package/view/chimera/editor/index.ejs +0 -87
  71. package/view/chimera/editor/remove.ejs +0 -23
  72. package/view/chimera/editor/view.ejs +0 -54
  73. package/view/chimera/elements/editor_actions.ejs +0 -4
  74. package/view/chimera/elements/empty +0 -0
  75. package/view/chimera/field_wrappers/_entries.ejs +0 -91
  76. package/view/chimera/field_wrappers/_wrapper.ejs +0 -82
  77. package/view/chimera/field_wrappers/date_edit.ejs +0 -23
  78. package/view/chimera/field_wrappers/date_list.ejs +0 -3
  79. package/view/chimera/field_wrappers/date_view.ejs +0 -16
  80. package/view/chimera/field_wrappers/default_edit.ejs +0 -22
  81. package/view/chimera/field_wrappers/default_list.ejs +0 -3
  82. package/view/chimera/field_wrappers/default_peek.ejs +0 -3
  83. package/view/chimera/field_wrappers/default_view.ejs +0 -14
  84. package/view/chimera/field_wrappers/geopoint_edit.ejs +0 -25
  85. package/view/chimera/field_wrappers/geopoint_list.ejs +0 -5
  86. package/view/chimera/field_wrappers/geopoint_view.ejs +0 -18
  87. package/view/chimera/field_wrappers/schema_edit.ejs +0 -19
  88. package/view/chimera/field_wrappers/text_edit.ejs +0 -22
  89. package/view/chimera/field_wrappers/text_list.ejs +0 -1
  90. package/view/chimera/fields/belongsto_edit.ejs +0 -4
  91. package/view/chimera/fields/belongsto_list.ejs +0 -1
  92. package/view/chimera/fields/belongsto_peek.ejs +0 -1
  93. package/view/chimera/fields/boolean_edit.ejs +0 -17
  94. package/view/chimera/fields/boolean_list.ejs +0 -3
  95. package/view/chimera/fields/boolean_view.ejs +0 -3
  96. package/view/chimera/fields/date_edit.ejs +0 -14
  97. package/view/chimera/fields/date_list.ejs +0 -9
  98. package/view/chimera/fields/date_peek.ejs +0 -9
  99. package/view/chimera/fields/date_view.ejs +0 -9
  100. package/view/chimera/fields/datetime_edit.ejs +0 -24
  101. package/view/chimera/fields/datetime_list.ejs +0 -9
  102. package/view/chimera/fields/datetime_view.ejs +0 -10
  103. package/view/chimera/fields/default_edit.ejs +0 -10
  104. package/view/chimera/fields/default_list.ejs +0 -15
  105. package/view/chimera/fields/default_view.ejs +0 -1
  106. package/view/chimera/fields/enum_edit.ejs +0 -10
  107. package/view/chimera/fields/geopoint_edit.ejs +0 -10
  108. package/view/chimera/fields/geopoint_list.ejs +0 -9
  109. package/view/chimera/fields/geopoint_view.ejs +0 -9
  110. package/view/chimera/fields/habtm_edit.ejs +0 -5
  111. package/view/chimera/fields/hasoneparent_edit.ejs +0 -6
  112. package/view/chimera/fields/hasoneparent_list.ejs +0 -1
  113. package/view/chimera/fields/object_edit.ejs +0 -8
  114. package/view/chimera/fields/password_edit.ejs +0 -12
  115. package/view/chimera/fields/schema_edit.ejs +0 -14
  116. package/view/chimera/fields/text_edit.ejs +0 -5
  117. package/view/chimera/fields/text_list.ejs +0 -9
  118. package/view/chimera/fields/text_view.ejs +0 -3
  119. package/view/chimera/fields/time_edit.ejs +0 -15
  120. package/view/chimera/fields/time_list.ejs +0 -9
  121. package/view/chimera/fields/time_view.ejs +0 -9
  122. package/view/chimera/page/edit.ejs +0 -18
  123. package/view/chimera/page_editor.ejs +0 -5
  124. package/view/chimera/sidebar.ejs +0 -40
  125. package/view/chimera/tasks/index.ejs +0 -114
  126. package/view/layouts/chimera.ejs +0 -12
  127. package/view/layouts/chimera_base.ejs +0 -11
  128. package/view/layouts/chimera_body.ejs +0 -43
@@ -1,320 +0,0 @@
1
- @keyframes vex-fadein {
2
- /* line 9, ../sass/_keyframes.sass */
3
- 0% {
4
- opacity: 0;
5
- }
6
-
7
- /* line 11, ../sass/_keyframes.sass */
8
- 100% {
9
- opacity: 1;
10
- }
11
- }
12
- @-webkit-keyframes vex-fadein {
13
- /* line 9, ../sass/_keyframes.sass */
14
- 0% {
15
- opacity: 0;
16
- }
17
-
18
- /* line 11, ../sass/_keyframes.sass */
19
- 100% {
20
- opacity: 1;
21
- }
22
- }
23
- @-moz-keyframes vex-fadein {
24
- /* line 9, ../sass/_keyframes.sass */
25
- 0% {
26
- opacity: 0;
27
- }
28
-
29
- /* line 11, ../sass/_keyframes.sass */
30
- 100% {
31
- opacity: 1;
32
- }
33
- }
34
- @-ms-keyframes vex-fadein {
35
- /* line 9, ../sass/_keyframes.sass */
36
- 0% {
37
- opacity: 0;
38
- }
39
-
40
- /* line 11, ../sass/_keyframes.sass */
41
- 100% {
42
- opacity: 1;
43
- }
44
- }
45
- @-o-keyframes vex-fadein {
46
- /* line 9, ../sass/_keyframes.sass */
47
- 0% {
48
- opacity: 0;
49
- }
50
-
51
- /* line 11, ../sass/_keyframes.sass */
52
- 100% {
53
- opacity: 1;
54
- }
55
- }
56
- @keyframes vex-fadeout {
57
- /* line 16, ../sass/_keyframes.sass */
58
- 0% {
59
- opacity: 1;
60
- }
61
-
62
- /* line 18, ../sass/_keyframes.sass */
63
- 100% {
64
- opacity: 0;
65
- }
66
- }
67
- @-webkit-keyframes vex-fadeout {
68
- /* line 16, ../sass/_keyframes.sass */
69
- 0% {
70
- opacity: 1;
71
- }
72
-
73
- /* line 18, ../sass/_keyframes.sass */
74
- 100% {
75
- opacity: 0;
76
- }
77
- }
78
- @-moz-keyframes vex-fadeout {
79
- /* line 16, ../sass/_keyframes.sass */
80
- 0% {
81
- opacity: 1;
82
- }
83
-
84
- /* line 18, ../sass/_keyframes.sass */
85
- 100% {
86
- opacity: 0;
87
- }
88
- }
89
- @-ms-keyframes vex-fadeout {
90
- /* line 16, ../sass/_keyframes.sass */
91
- 0% {
92
- opacity: 1;
93
- }
94
-
95
- /* line 18, ../sass/_keyframes.sass */
96
- 100% {
97
- opacity: 0;
98
- }
99
- }
100
- @-o-keyframes vex-fadeout {
101
- /* line 16, ../sass/_keyframes.sass */
102
- 0% {
103
- opacity: 1;
104
- }
105
-
106
- /* line 18, ../sass/_keyframes.sass */
107
- 100% {
108
- opacity: 0;
109
- }
110
- }
111
- @keyframes vex-rotation {
112
- /* line 127, ../sass/_keyframes.sass */
113
- 0% {
114
- transform: rotate(0deg);
115
- -webkit-transform: rotate(0deg);
116
- -moz-transform: rotate(0deg);
117
- -ms-transform: rotate(0deg);
118
- -o-transform: rotate(0deg);
119
- }
120
-
121
- /* line 129, ../sass/_keyframes.sass */
122
- 100% {
123
- transform: rotate(359deg);
124
- -webkit-transform: rotate(359deg);
125
- -moz-transform: rotate(359deg);
126
- -ms-transform: rotate(359deg);
127
- -o-transform: rotate(359deg);
128
- }
129
- }
130
- @-webkit-keyframes vex-rotation {
131
- /* line 127, ../sass/_keyframes.sass */
132
- 0% {
133
- transform: rotate(0deg);
134
- -webkit-transform: rotate(0deg);
135
- -moz-transform: rotate(0deg);
136
- -ms-transform: rotate(0deg);
137
- -o-transform: rotate(0deg);
138
- }
139
-
140
- /* line 129, ../sass/_keyframes.sass */
141
- 100% {
142
- transform: rotate(359deg);
143
- -webkit-transform: rotate(359deg);
144
- -moz-transform: rotate(359deg);
145
- -ms-transform: rotate(359deg);
146
- -o-transform: rotate(359deg);
147
- }
148
- }
149
- @-moz-keyframes vex-rotation {
150
- /* line 127, ../sass/_keyframes.sass */
151
- 0% {
152
- transform: rotate(0deg);
153
- -webkit-transform: rotate(0deg);
154
- -moz-transform: rotate(0deg);
155
- -ms-transform: rotate(0deg);
156
- -o-transform: rotate(0deg);
157
- }
158
-
159
- /* line 129, ../sass/_keyframes.sass */
160
- 100% {
161
- transform: rotate(359deg);
162
- -webkit-transform: rotate(359deg);
163
- -moz-transform: rotate(359deg);
164
- -ms-transform: rotate(359deg);
165
- -o-transform: rotate(359deg);
166
- }
167
- }
168
- @-ms-keyframes vex-rotation {
169
- /* line 127, ../sass/_keyframes.sass */
170
- 0% {
171
- transform: rotate(0deg);
172
- -webkit-transform: rotate(0deg);
173
- -moz-transform: rotate(0deg);
174
- -ms-transform: rotate(0deg);
175
- -o-transform: rotate(0deg);
176
- }
177
-
178
- /* line 129, ../sass/_keyframes.sass */
179
- 100% {
180
- transform: rotate(359deg);
181
- -webkit-transform: rotate(359deg);
182
- -moz-transform: rotate(359deg);
183
- -ms-transform: rotate(359deg);
184
- -o-transform: rotate(359deg);
185
- }
186
- }
187
- @-o-keyframes vex-rotation {
188
- /* line 127, ../sass/_keyframes.sass */
189
- 0% {
190
- transform: rotate(0deg);
191
- -webkit-transform: rotate(0deg);
192
- -moz-transform: rotate(0deg);
193
- -ms-transform: rotate(0deg);
194
- -o-transform: rotate(0deg);
195
- }
196
-
197
- /* line 129, ../sass/_keyframes.sass */
198
- 100% {
199
- transform: rotate(359deg);
200
- -webkit-transform: rotate(359deg);
201
- -moz-transform: rotate(359deg);
202
- -ms-transform: rotate(359deg);
203
- -o-transform: rotate(359deg);
204
- }
205
- }
206
- /* line 11, ../sass/vex.sass */
207
- .vex, .vex *, .vex *:before, .vex *:after {
208
- -moz-box-sizing: border-box;
209
- -webkit-box-sizing: border-box;
210
- box-sizing: border-box;
211
- }
212
-
213
- /* line 14, ../sass/vex.sass */
214
- .vex {
215
- position: fixed;
216
- overflow: auto;
217
- -webkit-overflow-scrolling: touch;
218
- z-index: 11110;
219
- top: 0;
220
- right: 0;
221
- bottom: 0;
222
- left: 0;
223
- }
224
-
225
- /* line 25, ../sass/vex.sass */
226
- .vex-overlay {
227
- background: black;
228
- filter: alpha(opacity=40);
229
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
230
- }
231
-
232
- /* line 30, ../sass/vex.sass */
233
- .vex-overlay {
234
- animation: vex-fadein 0.5s;
235
- -webkit-animation: vex-fadein 0.5s;
236
- -moz-animation: vex-fadein 0.5s;
237
- -ms-animation: vex-fadein 0.5s;
238
- -o-animation: vex-fadein 0.5s;
239
- -webkit-backface-visibility: hidden;
240
- position: fixed;
241
- background: rgba(0, 0, 0, 0.4);
242
- top: 0;
243
- right: 0;
244
- bottom: 0;
245
- left: 0;
246
- }
247
- /* line 39, ../sass/vex.sass */
248
- .vex.vex-closing .vex-overlay {
249
- animation: vex-fadeout 0.5s;
250
- -webkit-animation: vex-fadeout 0.5s;
251
- -moz-animation: vex-fadeout 0.5s;
252
- -ms-animation: vex-fadeout 0.5s;
253
- -o-animation: vex-fadeout 0.5s;
254
- -webkit-backface-visibility: hidden;
255
- }
256
-
257
- /* line 42, ../sass/vex.sass */
258
- .vex-content {
259
- animation: vex-fadein 0.5s;
260
- -webkit-animation: vex-fadein 0.5s;
261
- -moz-animation: vex-fadein 0.5s;
262
- -ms-animation: vex-fadein 0.5s;
263
- -o-animation: vex-fadein 0.5s;
264
- -webkit-backface-visibility: hidden;
265
- background: white;
266
- }
267
- /* line 46, ../sass/vex.sass */
268
- .vex.vex-closing .vex-content {
269
- animation: vex-fadeout 0.5s;
270
- -webkit-animation: vex-fadeout 0.5s;
271
- -moz-animation: vex-fadeout 0.5s;
272
- -ms-animation: vex-fadeout 0.5s;
273
- -o-animation: vex-fadeout 0.5s;
274
- -webkit-backface-visibility: hidden;
275
- }
276
-
277
- /* line 49, ../sass/vex.sass */
278
- .vex-close:before {
279
- font-family: Arial, sans-serif;
280
- content: "\00D7";
281
- }
282
-
283
- /* line 53, ../sass/vex.sass */
284
- .vex-dialog-form {
285
- margin: 0;
286
- }
287
-
288
- /* line 56, ../sass/vex.sass */
289
- .vex-dialog-button {
290
- -webkit-appearance: none;
291
- cursor: pointer;
292
- }
293
-
294
- /* line 60, ../sass/vex.sass */
295
- .vex-loading-spinner {
296
- animation: vex-rotation 0.7s linear infinite;
297
- -webkit-animation: vex-rotation 0.7s linear infinite;
298
- -moz-animation: vex-rotation 0.7s linear infinite;
299
- -ms-animation: vex-rotation 0.7s linear infinite;
300
- -o-animation: vex-rotation 0.7s linear infinite;
301
- -webkit-backface-visibility: hidden;
302
- -moz-box-shadow: 0 0 1em rgba(0, 0, 0, 0.1);
303
- -webkit-box-shadow: 0 0 1em rgba(0, 0, 0, 0.1);
304
- box-shadow: 0 0 1em rgba(0, 0, 0, 0.1);
305
- position: fixed;
306
- z-index: 1112;
307
- margin: auto;
308
- top: 0;
309
- right: 0;
310
- bottom: 0;
311
- left: 0;
312
- height: 2em;
313
- width: 2em;
314
- background: white;
315
- }
316
-
317
- /* line 76, ../sass/vex.sass */
318
- body.vex-open {
319
- overflow: hidden;
320
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * The Chimera Page Controller class
3
- *
4
- * @author Jelle De Loecker <jelle@develry.be>
5
- * @since 0.2.0
6
- * @version 0.5.0
7
- */
8
- var Page = Function.inherits('Alchemy.Controller.Chimera.Editor', function Page(conduit, options) {
9
- Page.super.call(this, conduit, options);
10
- });
11
-
12
- Page.setAction(function edit(conduit) {
13
- this.render('chimera/page/edit');
14
- });
@@ -1,129 +0,0 @@
1
- /**
2
- * The Chimera Settings Controller class
3
- *
4
- * @author Kjell Keisse <kjell@codedor.be>
5
- * @since 0.2.0
6
- * @version 0.3.0
7
- */
8
- var Settings = Function.inherits('Alchemy.Controller.Chimera.Editor', function Setting(conduit, options) {
9
-
10
- Setting.super.call(this, conduit, options);
11
-
12
- this.addComponent('paginate');
13
-
14
- //this.addAction('draft', 'save', {handleManual: true});
15
- this.addAction('record', 'save', {title: '<span class="fi-save"></span>', handleManual: true});
16
-
17
- });
18
-
19
- /**
20
- * The index action
21
- *
22
- * @param {Conduit} conduit
23
- */
24
- Settings.setAction(function index(conduit) {
25
-
26
- var that = this,
27
- modelName = 'settings',
28
- model = Model.get(modelName);
29
-
30
- model.find('first', function gotResult(err, settings){
31
- if(settings.available){
32
- return that.edit(conduit);
33
- } else {
34
- model.save({email: ''}, {create: true}, function afterSave(err) {
35
- model.find('first', function gotResult(err, settings){
36
- return that.edit(conduit);
37
- });
38
- });
39
- }
40
- });
41
-
42
- });
43
-
44
- /**
45
- * The edit action
46
- *
47
- * @param {Conduit} conduit
48
- */
49
- Settings.setAction(function edit(conduit) {
50
-
51
- var that = this,
52
- modelName = 'settings',
53
- model = Model.get(modelName),
54
- chimera = model.constructor.chimera,
55
- id;
56
-
57
- model.find('first', function gotResult(err, settings){
58
-
59
- id = settings._id;
60
-
61
- var actionFields = chimera.getActionFields('edit'),
62
- groups = actionFields.groups.clone();
63
-
64
- actionFields.processRecords(model, settings, function groupedRecords(err, groups) {
65
-
66
- if (err) {
67
- return conduit.error(err);
68
- }
69
-
70
- that.set('groups', groups);
71
- that.set('actions', that.getActions());
72
- that.set('modelName', modelName);
73
- that.set('pageTitle', modelName.humanize());
74
- that.internal('modelName', modelName);
75
- that.internal('recordId', id);
76
-
77
- that.render('chimera/editor/edit');
78
-
79
- });
80
- });
81
-
82
-
83
- });
84
-
85
- /**
86
- * The save action
87
- *
88
- * @param {Conduit} conduit
89
- */
90
- Settings.setAction(function save(conduit) {
91
-
92
- var that = this,
93
- actionFields,
94
- modelName,
95
- chimera,
96
- options,
97
- groups,
98
- record,
99
- model,
100
- data,
101
- id;
102
-
103
- modelName = 'settings';
104
- model = Model.get(modelName);
105
-
106
- chimera = model.constructor.chimera;
107
- data = conduit.body.data;
108
- actionFields = chimera.getActionFields('edit');
109
- groups = actionFields.groups.clone();
110
-
111
- model.find('first', function gotResult(err, settings){
112
-
113
- id = settings._id;
114
-
115
- record = data[modelName.classify()];
116
- record._id = alchemy.castObjectId(id);
117
-
118
- options = {};
119
-
120
- // Force create, even though an _id could be given
121
- if (conduit.body.create === true) {
122
- options.create = true;
123
- }
124
-
125
- model.save(record, options, function afterSave(err) {
126
- that.edit(conduit);
127
- });
128
- });
129
- });
@@ -1,106 +0,0 @@
1
- var all_task_types = alchemy.getClassGroup('task'),
2
- running_tasks = alchemy.shared('Task.running', 'Array');
3
-
4
- /**
5
- * The Chimera Task Controller class
6
- *
7
- * @author Jelle De Loecker <jelle@kipdola.be>
8
- * @since 0.4.1
9
- * @version 0.4.1
10
- */
11
- var Tasks = Function.inherits('Alchemy.Controller.Chimera', function Task(conduit) {
12
- Task.super.call(this, conduit);
13
- });
14
-
15
- /**
16
- * The index action:
17
- * Show all running and finished jobs
18
- *
19
- * @param {Conduit} conduit
20
- */
21
- Tasks.setAction(function index(conduit) {
22
-
23
- var that = this,
24
- finished = [],
25
- running = [],
26
- command,
27
- tasks = [],
28
- i;
29
-
30
- running_tasks.forEach(function eachTask(task) {
31
- tasks.push(function getDescription(next) {
32
- task.getDescription(function gotDescription(err, description) {
33
-
34
- if (err) {
35
- return next(err);
36
- }
37
-
38
- if (task.stopped) {
39
- finished.push(task);
40
- } else {
41
- running.push(task);
42
- }
43
-
44
- return next();
45
- });
46
- });
47
- });
48
-
49
- Function.parallel(tasks, function done(err) {
50
-
51
- if (err) {
52
- return conduit.error(err);
53
- }
54
-
55
- that.set('pagetitle', 'Tasks');
56
- that.set('running', running);
57
- that.set('finished', finished);
58
-
59
- that.render('chimera/tasks/index');
60
- });
61
- });
62
-
63
- /**
64
- * Get a specific command
65
- *
66
- * @param {String} id
67
- */
68
- Tasks.setMethod(function getById(id) {
69
-
70
- var i;
71
-
72
- for (i = 0; i < running_tasks.length; i++) {
73
- if (running_tasks[i].id == id) {
74
- return running_tasks[i];
75
- }
76
- }
77
- });
78
-
79
- /**
80
- * Do a specific action on a command
81
- *
82
- * @param {Conduit} conduit
83
- */
84
- Tasks.setAction(function action(conduit, id, type) {
85
-
86
- var task = this.getById(id);
87
-
88
- if (!task) {
89
- throw new Error('Task "' + id + '" not found');
90
- }
91
-
92
- switch (type) {
93
-
94
- case 'stop':
95
- task.stop();
96
- break;
97
-
98
- case 'pause':
99
- task.pause();
100
- break;
101
-
102
- case 'resume':
103
- task.resume();
104
- break;
105
- }
106
- });