ruote-kit 2.1.10 → 2.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG.txt +10 -0
  3. data/Gemfile +21 -5
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +132 -80
  6. data/Rakefile +4 -15
  7. data/TODO.txt +12 -0
  8. data/config.ru +22 -14
  9. data/lib/ruote-kit/application.rb +46 -22
  10. data/lib/ruote-kit/helpers/json_helpers.rb +280 -0
  11. data/lib/ruote-kit/helpers/link_helpers.rb +117 -0
  12. data/lib/ruote-kit/helpers/misc_helpers.rb +35 -0
  13. data/lib/ruote-kit/helpers/pagination_helpers.rb +30 -0
  14. data/lib/ruote-kit/helpers/render_helpers.rb +39 -92
  15. data/lib/ruote-kit/public/_ruote/images/favicon.ico +0 -0
  16. data/lib/ruote-kit/public/_ruote/images/ruote.png +0 -0
  17. data/lib/ruote-kit/public/_ruote/images/ruote_buttons.png +0 -0
  18. data/lib/ruote-kit/public/_ruote/javascripts/jquery-1.4.2.min.js +154 -0
  19. data/lib/ruote-kit/public/_ruote/javascripts/rk.js +40 -0
  20. data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo-editor.js +548 -0
  21. data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo.js +32 -1
  22. data/lib/ruote-kit/public/_ruote/stylesheets/reset.css +53 -0
  23. data/lib/ruote-kit/public/_ruote/stylesheets/rk.css +355 -16
  24. data/lib/ruote-kit/public/_ruote/stylesheets/ruote-fluo-editor.css +108 -0
  25. data/lib/ruote-kit/resources/errors.rb +46 -43
  26. data/lib/ruote-kit/resources/expressions.rb +92 -35
  27. data/lib/ruote-kit/resources/participants.rb +53 -0
  28. data/lib/ruote-kit/resources/processes.rb +68 -36
  29. data/lib/ruote-kit/resources/schedules.rb +27 -0
  30. data/lib/ruote-kit/resources/workitems.rb +93 -31
  31. data/lib/ruote-kit/spec/ruote_helpers.rb +25 -16
  32. data/lib/ruote-kit/version.rb +3 -1
  33. data/lib/ruote-kit/views/_pagination.html.haml +38 -0
  34. data/lib/ruote-kit/views/_tree_editor.html.haml +52 -0
  35. data/lib/ruote-kit/views/error.html.haml +69 -0
  36. data/lib/ruote-kit/views/errors.html.haml +28 -12
  37. data/lib/ruote-kit/views/expression.html.haml +161 -30
  38. data/lib/ruote-kit/views/expressions.html.haml +26 -21
  39. data/lib/ruote-kit/views/http_error.html.haml +11 -0
  40. data/lib/ruote-kit/views/index.html.haml +4 -0
  41. data/lib/ruote-kit/views/layout.html.haml +52 -32
  42. data/lib/ruote-kit/views/participants.html.haml +79 -0
  43. data/lib/ruote-kit/views/process.html.haml +109 -42
  44. data/lib/ruote-kit/views/process_launched.html.haml +6 -2
  45. data/lib/ruote-kit/views/processes.html.haml +55 -24
  46. data/lib/ruote-kit/views/processes_new.html.haml +36 -0
  47. data/lib/ruote-kit/views/schedules.html.haml +42 -0
  48. data/lib/ruote-kit/views/workitem.html.haml +83 -29
  49. data/lib/ruote-kit/views/workitems.html.haml +42 -19
  50. data/lib/ruote-kit.rb +17 -88
  51. data/ruote-kit.gemspec +68 -80
  52. data/spec/it_has_an_engine.rb +69 -0
  53. data/spec/resources/errors_spec.rb +198 -270
  54. data/spec/resources/expressions_spec.rb +308 -52
  55. data/spec/resources/index_spec.rb +28 -16
  56. data/spec/resources/participants_spec.rb +102 -0
  57. data/spec/resources/processes_spec.rb +218 -104
  58. data/spec/resources/schedules_spec.rb +97 -0
  59. data/spec/resources/workitems_spec.rb +195 -100
  60. data/spec/ruote-kit_configure_spec.rb +32 -75
  61. data/spec/spec.opts +0 -1
  62. data/spec/spec_helper.rb +31 -92
  63. data/spec/webapp_helpers_spec.rb +309 -0
  64. metadata +87 -152
  65. data/lib/ruote-kit/configuration.rb +0 -83
  66. data/lib/ruote-kit/helpers/engine_helpers.rb +0 -24
  67. data/lib/ruote-kit/helpers/form_helpers.rb +0 -11
  68. data/lib/ruote-kit/helpers/launch_item_parser.rb +0 -59
  69. data/lib/ruote-kit/helpers/navigation_helpers.rb +0 -54
  70. data/lib/ruote-kit/helpers.rb +0 -9
  71. data/lib/ruote-kit/public/_ruote/images/bg.gif +0 -0
  72. data/lib/ruote-kit/public/_ruote/images/bg_button_left.gif +0 -0
  73. data/lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif +0 -0
  74. data/lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif +0 -0
  75. data/lib/ruote-kit/public/_ruote/images/bg_button_right.gif +0 -0
  76. data/lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js +0 -191
  77. data/lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js +0 -149
  78. data/lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css +0 -226
  79. data/lib/ruote-kit/public/_ruote/stylesheets/base.css +0 -336
  80. data/lib/ruote-kit/public/_ruote/stylesheets/style.css +0 -393
  81. data/lib/ruote-kit/views/launch_process.html.haml +0 -19
  82. data/lib/ruote-kit/views/process_failed_to_launch.html.haml +0 -7
  83. data/lib/ruote-kit/views/resource_not_found.html.haml +0 -7
  84. data/spec/helpers/render_helpers_spec.rb +0 -214
  85. data/spec/ruote-kit_spec.rb +0 -4
  86. data/spec/views/expressions.html.haml_spec.rb +0 -31
  87. data/spec/views/launch_process.html.haml_spec.rb +0 -22
  88. data/spec/views/process.html.haml_spec.rb +0 -17
  89. data/spec/views/process_launched.html.haml_spec.rb +0 -16
  90. data/spec/views/processes.html.haml_spec.rb +0 -31
  91. data/spec/views/workitems.html.haml_spec.rb +0 -69
@@ -1,30 +1,369 @@
1
- /** Custom styles for rk **/
1
+ e
2
+ /* layout */
2
3
 
3
- ul.nolist {
4
- list-style-type: none;
4
+ * {
5
+ margin: 0;
6
+ }
7
+ html, body {
8
+ /*
9
+ height: 100%;
10
+ */
11
+ }
12
+
13
+ /* general */
14
+
15
+ body {
16
+ font: 14px/1.75em "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
17
+ background: white;
5
18
  }
6
19
 
7
- ul.nested_list {
8
- list-style-type: none;
20
+ #header {
21
+ margin-top: 14px;
22
+ }
23
+ #hlogo {
24
+ float: left;
25
+ margin-top: 33px;
26
+ margin-right: 7px;
27
+ }
28
+ #htext {
29
+ float: left;
30
+ }
31
+ #hclear {
32
+ clear: both;
9
33
  }
10
- ul.nested_list > li {
11
- padding: 4px 0;
34
+ #ruote_kit {
35
+ font: 83px Helvetica, Arial, Geneva, sans-serif;
36
+ font-weight: bold;
37
+ color: #e3e3e3;
12
38
  }
13
- ul.nested_list li ul {
14
- list-style-type: none;
15
- color: #999;
39
+ #main_navigation {
40
+ position: relative;
41
+ top: -38px;
42
+ left: 4px;
43
+ z-index: 99;
16
44
  }
17
45
 
18
- div.options {
19
- width: 250px;
20
- float: right;
46
+ h1 {
47
+ font-size: 170%;
48
+ font-weight: normal;
49
+ margin-bottom: 21px;
50
+ }
51
+ h2 {
52
+ font-size: 110%;
53
+ font-weight: normal;
21
54
  }
22
55
 
23
- .force-block {
56
+ #container {
57
+ width: auto;
58
+ margin-top: 7px;
59
+ margin-left: 28px;
60
+ margin-right: 28px;
61
+ }
62
+ #main {
63
+ }
64
+
65
+ a {
66
+ cursor: pointer;
67
+ }
68
+ a:visited {
69
+ color: blue;
70
+ }
71
+ a:hover {
72
+ color: gray;
73
+ }
74
+
75
+ label {
24
76
  display: block;
25
- float: none;
77
+ font-weight: normal;
78
+ }
79
+
80
+ .togglable {
81
+ cursor: pointer;
82
+ }
83
+ .togglable:hover {
84
+ color: gray;
85
+ }
86
+
87
+ table.list {
88
+ width: 100%;
89
+ margin-top: 14px;
90
+ }
91
+ table.list td {
92
+ border: 1px solid #d0d1d3;
93
+ padding: 3px;
94
+ }
95
+ table.list thead td {
96
+ text-align: center;
97
+ color #d0d1d3;
98
+ border: 1px solid #d0d1d3;
99
+ }
100
+ /*
101
+ table.list tr:nth-child(even) td {
102
+ background: #f4f6f6;
103
+ }
104
+ */
105
+ table.list tr td.right {
106
+ text-align: right;
107
+ }
108
+ table.list tr:hover {
109
+ background: #f4f6f6;
110
+ }
111
+ table.list td.no_padding {
112
+ padding: 0;
113
+ margin: 0;
114
+ }
115
+
116
+ table.details {
117
+ margin-top: 14px;
118
+ }
119
+ table.details td {
120
+ border: 1px solid #d0d1d3;
121
+ padding: 0px 7px;
122
+ vertical-align: top;
123
+ }
124
+ table.details > tbody > tr > td:first-child {
125
+ color: #8b8f91;
126
+ text-align: right;
127
+ margin: 0;
128
+ }
129
+ table.details tr:hover {
130
+ background: #f4f6f6;
131
+ }
132
+ table.details td.no_border {
133
+ border-left: 0;
134
+ border-right: 0;
135
+ }
136
+ table.details td.no_border:hover {
137
+ background: white;
138
+ }
139
+ table.details td.no_padding {
140
+ padding: 0;
141
+ margin: 0;
142
+ }
143
+
144
+ /*
145
+ .group {
146
+ margin: 6px 0;
147
+ padding: 12px;
148
+ background: #fff;
149
+ border: 1px dashed #ccd0d4;
150
+ border-radius: 8px;
151
+ -webkit-border-radius: 8px;
152
+ -moz-border-radius: 8px;
153
+ }
154
+ .group:hover {
155
+ border-style: solid;
156
+ }*/
157
+
158
+ .links {
159
+ margin-top: 14px;
160
+ border-left: 2px solid #ccd0d4;
161
+ padding-left: 7px;
162
+ }
163
+
164
+ span.explanation {
165
+ font-size: 80%;
166
+ color: #8b8f91;
167
+ }
168
+
169
+ /* flash */
170
+
171
+ .flash {
172
+ }
173
+
174
+ /* footer */
175
+
176
+ #as_json {
177
+ margin-top: 28px;
178
+ font-size: 80%;
179
+ }
180
+
181
+ #footer {
182
+ margin-top: 14px;
183
+ }
184
+ #footer > div {
185
+ font-size: 80%;
186
+ }
187
+
188
+ /* participants */
189
+
190
+ input.participant {
191
+ width: 250px;
192
+ height: 20px;
193
+ font-family: "Menlo Regular", "Monaco", courier, monospace;
194
+ }
195
+ input#put_button {
196
+ margin-top: 14px;
197
+ }
198
+
199
+ table.participants {
200
+ margin-top: 14px;
201
+ }
202
+ table.participants td {
203
+ border: 0;
204
+ padding: 0;
205
+ margin: 0;
206
+ }
207
+ table.participants td:last-child {
208
+ padding-left: 7px;
209
+ }
210
+ table.participants thead td {
211
+ text-align: center;
212
+ color #d0d1d3;
213
+ }
214
+ table.participants tr:hover {
215
+ background: #f4f6f6;
216
+ }
217
+
218
+ /* expressions */
219
+
220
+ pre.pdef {
221
+ font-family: "Menlo Regular", "Monaco", courier, monospace;
222
+ font-size: 90%;
223
+ line-height: 14px;
224
+ margin-top: 4px;
225
+ cursor: pointer;
26
226
  }
27
227
 
28
- .b5 {
228
+ /* ... traces */
229
+
230
+ pre.trace {
231
+ font-family: "Menlo Regular", "Monaco", courier, monospace;
232
+ font-size: 10px;
233
+ margin-top: 7px;
29
234
  margin-bottom: 5px;
235
+ line-height: 11px;
236
+ }
237
+
238
+ div.trace {
239
+ font-size: 10px;
240
+ line-height: 11px;
241
+ cursor: pointer;
242
+ }
243
+
244
+ /* overlay */
245
+
246
+ div#overlay {
247
+ position: absolute;
248
+ top: 0;
249
+ left: 0;
250
+ right: 0;
251
+ bottom: 0;
252
+ background-color: black;
253
+ opacity: 0.7;
254
+ width: auto;
255
+ height: auto;
256
+ z-index: 99;
257
+ }
258
+
259
+ /* fluo */
260
+
261
+ #fluo {
262
+ float: right;
263
+ }
264
+
265
+ /* editor */
266
+
267
+ div#editor {
268
+ position: absolute;
269
+ top: 10%;
270
+ left: 10%;
271
+ right: 10%;
272
+ width: 80%;
273
+ height: auto;
274
+ background: #ffffff;
275
+ z-index: 999;
276
+ padding: 14px;
277
+ border-radius: 15px;
278
+ -webkit-border-radius: 15px;
279
+ -moz-border-radius: 15px;
280
+ box-shadow: 0 1px 12px #000;
281
+ -webkit-box-shadow: 0 1px 12px #000;
282
+ -moz-box-shadow: 0 1px 12px #000;
283
+ }
284
+ div#fluo_editor {
285
+ }
286
+ div#editor > a.ruote_go_button {
287
+ margin-left: 4px;
288
+ }
289
+ #efluo {
290
+ margin: -3px -3px;
291
+ float: right;
292
+ }
293
+
294
+ /* buttons +-^vx... */
295
+
296
+ a.ruote_button {
297
+ display: inline-block;
298
+ margin-right: 1px;
299
+ width: 12px;
300
+ height: 12px;
301
+ background: transparent url(../images/ruote_buttons.png) no-repeat;
302
+ }
303
+ a.ruote_plus_button {
304
+ background-position: 0 0;
305
+ }
306
+ a.ruote_minus_button {
307
+ background-position: 0 -20px;
308
+ }
309
+ a.ruote_up_button {
310
+ background-position: 0 -40px;
311
+ }
312
+ a.ruote_down_button {
313
+ background-position: 0 -60px;
314
+ }
315
+ a.ruote_cut_button {
316
+ background-position: 0 -20px;
317
+ }
318
+ a.ruote_paste_button {
319
+ background-position: 0 -80px;
320
+ }
321
+ a.ruote_go_button {
322
+ background-position: 0 -100px;
323
+ }
324
+ a.ruote_copy_button {
325
+ background-position: 0 -120px;
326
+ }
327
+ a.ruote_left_button {
328
+ background-position: 0 -140px;
329
+ }
330
+ a.ruote_right_button {
331
+ background-position: 0 -160px;
30
332
  }
333
+ a.ruote_cross_button {
334
+ background-position: 0 -180px;
335
+ }
336
+ a.ruote_plus_button:hover {
337
+ background-position: -20px 0;
338
+ }
339
+ a.ruote_minus_button:hover {
340
+ background-position: -20px -20px;
341
+ }
342
+ a.ruote_up_button:hover {
343
+ background-position: -20px -40px;
344
+ }
345
+ a.ruote_down_button:hover {
346
+ background-position: -20px -60px;
347
+ }
348
+ a.ruote_cut_button:hover {
349
+ background-position: -20px -20px;
350
+ }
351
+ a.ruote_paste_button:hover {
352
+ background-position: -20px -80px;
353
+ }
354
+ a.ruote_go_button:hover {
355
+ background-position: -20px -100px;
356
+ }
357
+ a.ruote_copy_button:hover {
358
+ background-position: -20px -120px;
359
+ }
360
+ a.ruote_left_button:hover {
361
+ background-position: -20px -140px;
362
+ }
363
+ a.ruote_right_button:hover {
364
+ background-position: -20px -160px;
365
+ }
366
+ a.ruote_cross_button:hover {
367
+ background-position: -20px -180px;
368
+ }
369
+
@@ -0,0 +1,108 @@
1
+
2
+ #fluo_editor {
3
+ font: 14px/1.5em monaco, mono;
4
+ text-align: left;
5
+ color: #000;
6
+ border: 1px solid #c1c1c1;
7
+ border-top-color: #848484;
8
+ border-bottom-color: #ddd;
9
+ padding: 6px;
10
+ margin: 6px 4px;
11
+ background: #fff;
12
+ background: -webkit-gradient(linear, 0% 0%, 0% 6, from(#dbe0e2), to(#fff));
13
+ background: -moz-linear-gradient(top, #dbe0e2, #fff 6px);
14
+ }
15
+ .rfe_expression {
16
+ }
17
+ .rfe_expression_atts,
18
+ .rfe_text,
19
+ .rfe_expression_name,
20
+ .rfe_expression_string,
21
+ .rfe_ghost_button {
22
+ }
23
+ .rfe_expression_name {
24
+ color: #8b8f91;
25
+ }
26
+ .rfe_expression_atts {
27
+ }
28
+ .rfe_expression_string {
29
+ color: #82dd48;
30
+ }
31
+ .rfe_exp_span {
32
+ }
33
+ .rfe_buttons {
34
+ display: inline-block;
35
+ white-space: nowrap;
36
+ margin-left: 6px;
37
+ }
38
+ .rfe_buttons:hover {
39
+ cursor: default;
40
+ }
41
+ .rfe_button {
42
+ cursor: pointer;
43
+ padding-left: 1px;
44
+ }
45
+ a.rfe_button {
46
+ display: inline-block;
47
+ padding: 0;
48
+ margin: 0 -1px;
49
+ width: 12px;
50
+ height: 12px;
51
+ background: transparent url(/_ruote/images/ruote_buttons.png) no-repeat;
52
+ }
53
+ a.rfe_add {
54
+ background-position: 0 0;
55
+ }
56
+ a.rfe_cut {
57
+ background-position: 0 -20px;
58
+ }
59
+ a.rfe_moveup {
60
+ background-position: 0 -40px;
61
+ }
62
+ a.rfe_movedown {
63
+ background-position: 0 -60px;
64
+ }
65
+ a.rfe_paste {
66
+ background-position: 0 -80px;
67
+ }
68
+ a.rfe_add:hover {
69
+ background-position: -20px 0;
70
+ }
71
+ a.rfe_cut:hover {
72
+ background-position: -20px -20px;
73
+ }
74
+ a.rfe_moveup:hover {
75
+ background-position: -20px -40px;
76
+ }
77
+ a.rfe_movedown:hover {
78
+ background-position: -20px -60px;
79
+ }
80
+ a.rfe_paste:hover {
81
+ background-position: -20px -80px;
82
+ }
83
+ .rfe_exp > input[type="text"] {
84
+ color: #000;
85
+ font: 14px/1em monaco, mono;
86
+ border: 0;
87
+ padding: 0 10px;
88
+ padding-top: 1px;
89
+ margin: 0;
90
+ margin-left: -11px;
91
+ margin-bottom: 1px;
92
+ width: 400px;
93
+ background: #86e74c;
94
+ border-radius: 15px;
95
+ -webkit-border-radius: 15px;
96
+ -moz-border-radius: 15px;
97
+ }
98
+ img.rfe_button {
99
+ margin: 0;
100
+ vertical-align: middle;
101
+ }
102
+ /* safari */
103
+ @media screen and (-webkit-min-device-pixel-ratio:0) {
104
+ .rfe_exp > input[type="text"] {
105
+ padding-top: 2px;
106
+ margin-bottom: 0;
107
+ }
108
+
@@ -1,65 +1,68 @@
1
1
 
2
+ # license is MIT, see LICENSE.txt
3
+
2
4
  class RuoteKit::Application
3
5
 
4
6
  get '/_ruote/errors/?' do
5
7
 
6
- @errors = engine.errors
8
+ @count = RuoteKit.engine.errors(:count => true)
9
+ paginate
7
10
 
8
- respond_to do |format|
9
- format.html { haml :errors }
10
- format.json { json( :errors, @errors ) }
11
- end
11
+ @errors = RuoteKit.engine.errors(:skip => @skip, :limit => @limit)
12
+
13
+ respond_with :errors
12
14
  end
13
15
 
14
- get '/_ruote/errors/:wfid' do
16
+ get '/_ruote/errors/:id' do
17
+
18
+ @error, @errors = fetch_e
15
19
 
16
- process = engine.process( wfid )
17
- @errors = process ? process.errors : nil
20
+ return http_error(404) if @error.nil? && @errors.nil?
18
21
 
19
- if @errors
20
- respond_to do |format|
21
- format.html { haml :errors }
22
- format.json { json( :errors, @errors ) }
23
- end
22
+ if @error
23
+ respond_with :error
24
24
  else
25
- resource_not_found
25
+ @count = @errors.size
26
+ @skip = 0
27
+ @limit = @count
28
+ respond_with :errors
26
29
  end
27
30
  end
28
31
 
29
- get '/_ruote/errors/:wfid/:expid' do
32
+ # replay_at_error(e)
33
+ #
34
+ delete '/_ruote/errors/:fei' do
30
35
 
31
- process = engine.process( wfid )
32
- errors = process ? process.errors : nil
33
- @error = errors ? errors.find { |e| e.fei.expid == expid } : nil
36
+ fei = params[:fei]
37
+ wfid = fei.split('!').last
34
38
 
35
- if @error
36
- respond_to do |format|
37
- format.html { haml :error }
38
- format.json { json( :error, @error ) }
39
- end
40
- else
41
- resource_not_found
39
+ ps = RuoteKit.engine.process(wfid)
40
+ error = ps.errors.find { |e| e.fei.sid == fei }
41
+
42
+ RuoteKit.engine.replay_at_error(error)
43
+
44
+ respond_to do |format|
45
+ format.html { redirect '/_ruote/errors' }
46
+ format.json { json :status, :ok }
42
47
  end
43
48
  end
44
49
 
45
- # replay_at_error(e)
46
- #
47
- delete '/_ruote/errors/:wfid/:expid' do
48
-
49
- #process = engine.process( params[:wfid] )
50
- #if process && expression = process.expressions.detect { |exp| exp.fei.expid == params[:expid] }
51
- # if params[:_kill]
52
- # engine.kill_expression( expression.fei )
53
- # else
54
- # engine.cancel_expression( expression.fei )
55
- # end
56
- # respond_to do |format|
57
- # format.html { redirect "/_ruote/expressions/#{params[:wfid]}" }
58
- # format.json { json( :status, :ok ) }
59
- # end
60
- #else
61
- # resource_not_found
62
- #end
50
+ protected
51
+
52
+ def fetch_e
53
+
54
+ fei = params[:id].split('!')
55
+ wfid = fei.last
56
+
57
+ error = nil
58
+ process = RuoteKit.engine.process(wfid)
59
+ errors = process ? process.errors : nil
60
+
61
+ if errors && fei.length > 1
62
+ error = errors.find { |er| er.fei.sid == params[:id] }
63
+ end
64
+
65
+ [ error, errors ]
63
66
  end
64
67
  end
65
68