ruote-kit 2.1.10 → 2.1.11

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 (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,55 +1,112 @@
1
+
2
+ # license is MIT, see LICENSE.txt
3
+
1
4
  class RuoteKit::Application
2
5
 
3
- get "/_ruote/expressions/?" do
4
- respond_to do |format|
5
- format.html { haml :expressions }
6
- format.json { json( :status, :ok ) }
6
+ get '/_ruote/expressions/:id' do
7
+
8
+ @process, @expression, fei = fetch_pe
9
+
10
+ return http_error(404) unless @process
11
+
12
+ if fei
13
+
14
+ return http_error(404) unless @expression
15
+
16
+ respond_with :expression
17
+ else
18
+
19
+ respond_with :expressions
7
20
  end
8
21
  end
9
22
 
10
- get "/_ruote/expressions/:wfid" do
11
- @process = engine.process( params[:wfid] )
23
+ delete '/_ruote/expressions/:id' do
12
24
 
13
- if @process
14
- respond_to do |format|
15
- format.html { haml :expressions }
16
- format.json { json( :expressions, @process.expressions ) }
17
- end
25
+ process, expression, fei = fetch_pe
26
+
27
+ return http_error(404) unless expression
28
+
29
+ if params[:_kill]
30
+ RuoteKit.engine.kill_expression(expression.fei)
18
31
  else
19
- resource_not_found
32
+ RuoteKit.engine.cancel_expression(expression.fei)
33
+ end
34
+
35
+ respond_to do |format|
36
+ format.html { redirect "/_ruote/expressions/#{expression.fei.wfid}" }
37
+ format.json { json :status, :ok }
20
38
  end
21
39
  end
22
40
 
23
- get "/_ruote/expressions/:wfid/:expid" do
24
- @process = engine.process( params[:wfid] )
41
+ put '/_ruote/expressions/:id' do
25
42
 
26
- if @process && @expression = @process.expressions.detect { |exp| exp.fei.expid == params[:expid] }
27
- respond_to do |format|
28
- format.html { haml :expression }
29
- format.json { json( :expression, @expression ) }
30
- end
31
- else
32
- resource_not_found
43
+ process, expression, fei = fetch_pe
44
+
45
+ return http_error(404) unless expression
46
+
47
+ info = begin
48
+ fetch_re_apply_info
49
+ rescue Rufus::Json::ParserError => pe
50
+ return http_error(400, pe)
51
+ end
52
+
53
+ #puts '-' * 80
54
+ #p params
55
+ #p info
56
+ #puts '-' * 80
57
+
58
+ options = {}
59
+ options[:fields] = info.fields if info.fields
60
+ options[:tree] = info.tree if info.tree
61
+
62
+ RuoteKit.engine.re_apply(expression.fei, options)
63
+
64
+ respond_to do |format|
65
+ format.html { redirect "/_ruote/expressions/#{expression.fei.wfid}" }
66
+ format.json { json :status, :ok }
33
67
  end
34
68
  end
35
69
 
36
- delete "/_ruote/expressions/:wfid/:expid" do
37
- process = engine.process( params[:wfid] )
70
+ protected
38
71
 
39
- if process && expression = process.expressions.detect { |exp| exp.fei.expid == params[:expid] }
40
- if params[:_kill]
41
- engine.kill_expression( expression.fei )
42
- else
43
- engine.cancel_expression( expression.fei )
44
- end
72
+ def fetch_pe
73
+
74
+ fei = params[:id].split('!')
75
+ wfid = fei.last
76
+
77
+ process = RuoteKit.engine.process(wfid)
78
+
79
+ expression = process ?
80
+ process.expressions.detect { |exp| exp.fei.sid == params[:id] } :
81
+ nil
82
+
83
+ fei = (fei.length > 1)
84
+
85
+ [ process, expression, fei ]
86
+ end
87
+
88
+ def fetch_re_apply_info
89
+
90
+ if request.content_type == 'application/json' then
91
+
92
+ data = Rufus::Json.decode(request.body.read)
93
+ if exp = data['expression']; data = exp; end
94
+
95
+ OpenStruct.new(data)
45
96
 
46
- respond_to do |format|
47
- format.html { redirect "/_ruote/expressions/#{params[:wfid]}" }
48
- format.json { json( :status, :ok ) }
49
- end
50
97
  else
51
- resource_not_found
98
+
99
+ o = OpenStruct.new
100
+
101
+ if fields = params[:fields]
102
+ o.fields = Rufus::Json.decode(fields)
103
+ end
104
+ if tree = params[:tree]
105
+ o.tree = Rufus::Json.decode(tree)
106
+ end
107
+
108
+ o
52
109
  end
53
110
  end
54
-
55
111
  end
112
+
@@ -0,0 +1,53 @@
1
+
2
+ # license is MIT, see LICENSE.txt
3
+
4
+ class RuoteKit::Application
5
+
6
+ get '/_ruote/participants/?' do
7
+
8
+ @participants = RuoteKit.engine.participant_list
9
+
10
+ respond_with :participants
11
+ end
12
+
13
+ put '/_ruote/participants/?' do
14
+
15
+ list = []
16
+
17
+ if request.content_type.match(/\/json/)
18
+
19
+ list = Rufus::Json.decode(request.body.read)
20
+ list = list['participants'] if list.is_a?(Hash)
21
+
22
+ else
23
+
24
+ index = 0
25
+
26
+ loop do
27
+
28
+ break unless params["regex_#{index}"]
29
+
30
+ list << {
31
+ 'regex' => params["regex_#{index}"],
32
+ 'classname' => params["classname_#{index}"],
33
+ 'options' => Rufus::Json.decode(params["options_#{index}"])
34
+ }
35
+ index = index + 1
36
+ end
37
+ end
38
+
39
+ RuoteKit.engine.participant_list = list
40
+
41
+ respond_to do |format|
42
+
43
+ format.html do
44
+ redirect '/_ruote/participants'
45
+ end
46
+ format.json do
47
+ @participants = RuoteKit.engine.participant_list
48
+ json :participants
49
+ end
50
+ end
51
+ end
52
+ end
53
+
@@ -1,59 +1,91 @@
1
+
2
+ # license is MIT, see LICENSE.txt
3
+
4
+
1
5
  class RuoteKit::Application
2
6
 
3
- get "/_ruote/processes/?" do
4
- @processes = engine.processes
7
+ get '/_ruote/processes/?' do
5
8
 
6
- respond_to do |format|
7
- format.html { haml :processes }
8
- format.json { json( :processes, @processes ) }
9
- end
9
+ @count = RuoteKit.engine.processes(:count => true)
10
+ paginate
11
+
12
+ @processes = RuoteKit.engine.processes(
13
+ :descending => true, :skip => @skip, :limit => @limit)
14
+
15
+ respond_with :processes
10
16
  end
11
17
 
12
- get "/_ruote/processes/new" do
13
- haml :launch_process
18
+ get '/_ruote/processes/new' do
19
+
20
+ haml :processes_new
14
21
  end
15
22
 
16
- get "/_ruote/processes/:wfid" do
23
+ get '/_ruote/processes/:wfid' do
17
24
 
18
- @process = engine.process( params[:wfid] )
25
+ @process = RuoteKit.engine.process(params[:wfid])
19
26
 
20
- if @process
21
- respond_to do |format|
22
- format.html { haml :process }
23
- format.json { json( :process, @process ) }
24
- end
25
- else
26
- resource_not_found
27
- end
27
+ return http_error(404) unless @process
28
+
29
+ respond_with :process
28
30
  end
29
31
 
30
- post "/_ruote/processes" do
31
- launch_item = launch_item_from_post
32
+ post '/_ruote/processes' do
33
+
34
+ begin
35
+
36
+ @info = fetch_launch_info
37
+
38
+ @wfid = RuoteKit.engine.launch(
39
+ @info.definition, @info.fields || {}, @info.variables || {})
40
+
41
+ rescue Exception => e
42
+ return http_error(400, e)
43
+ end
44
+
45
+ status 201 # created
32
46
 
33
47
  respond_to do |format|
34
- begin
35
- @wfid = engine.launch( launch_item['pdef'], launch_item['fields'], launch_item['variables'] )
36
- rescue ArgumentError => @error
37
- status 422
38
- format.html { haml :process_failed_to_launch }
39
- format.json { { "error" => { "code" => 422, "message" => @error.message } }.to_json }
40
- else
41
- format.html { haml :process_launched }
42
- format.json { json( :launched, @wfid ) }
43
- end
48
+ format.html { haml :process_launched }
49
+ format.json { json :launched, @wfid }
44
50
  end
45
51
  end
46
52
 
47
- delete "/_ruote/processes/:wfid" do
48
- if params[:_kill] == "1"
49
- engine.kill_process( params[:wfid] )
53
+ delete '/_ruote/processes/:wfid' do
54
+
55
+ if params[:_kill] == '1'
56
+ RuoteKit.engine.kill_process(params[:wfid])
50
57
  else
51
- engine.cancel_process( params[:wfid] )
58
+ RuoteKit.engine.cancel_process(params[:wfid])
52
59
  end
53
60
 
54
61
  respond_to do |format|
55
- format.html { redirect "/_ruote/processes" }
56
- format.json { json( :status, :ok ) }
62
+ format.html { redirect '/_ruote/processes' }
63
+ format.json { json :status, :ok }
64
+ end
65
+ end
66
+
67
+ protected
68
+
69
+ def fetch_launch_info
70
+
71
+ if request.content_type == 'application/json' then
72
+
73
+ OpenStruct.new(Rufus::Json.decode(request.body.read))
74
+
75
+ else
76
+
77
+ info = OpenStruct.new('definition' => params[:definition])
78
+
79
+ fields = params[:fields] || ''
80
+ fields = '{}' if fields.empty?
81
+ info.fields = Rufus::Json.decode(fields)
82
+
83
+ vars = params[:variables] || ''
84
+ vars = '{}' if vars.empty?
85
+ info.variables = Rufus::Json.decode(vars)
86
+
87
+ info
57
88
  end
58
89
  end
59
90
  end
91
+
@@ -0,0 +1,27 @@
1
+
2
+ # license is MIT, see LICENSE.txt
3
+
4
+ class RuoteKit::Application
5
+
6
+ get '/_ruote/schedules/?' do
7
+
8
+ @count = RuoteKit.engine.processes(:count => true)
9
+ paginate
10
+
11
+ @schedules = RuoteKit.engine.schedules(:skip => @skip, :limit => @limit)
12
+
13
+ respond_with :schedules
14
+ end
15
+
16
+ get '/_ruote/schedules/:wfid' do
17
+
18
+ @schedules = RuoteKit.engine.schedules(params[:wfid])
19
+
20
+ @count = @schedules.size
21
+ @skip = 0
22
+ @limit = @count
23
+
24
+ respond_with :schedules
25
+ end
26
+ end
27
+
@@ -1,65 +1,127 @@
1
+
2
+ # license is MIT, see LICENSE.txt
3
+
1
4
  class RuoteKit::Application
2
5
 
3
- get "/_ruote/workitems/?" do
6
+ get '/_ruote/workitems/?' do
4
7
 
5
8
  query = params.inject({}) { |h, (k, v)|
6
9
  h[k] = (Rufus::Json.decode(v) rescue v)
7
10
  h
8
11
  }
9
12
 
10
- @workitems = storage_participant.query(query)
13
+ @count = RuoteKit.engine.storage_participant.query(:count => true)
11
14
 
12
- respond_to do |format|
13
- format.html { haml :workitems }
14
- format.json { json( :workitems, @workitems ) }
15
+ if (query.keys - %w[ limit skip ]).empty?
16
+ paginate
17
+ else
18
+ @skip = 0
19
+ @limit = @count
15
20
  end
16
- end
17
21
 
18
- get "/_ruote/workitems/:wfid" do
19
- @wfid = params[:wfid]
20
- @workitems = find_workitems( params[:wfid] )
22
+ query['skip'] = @skip
23
+ query['limit'] = @limit
21
24
 
22
- respond_to do |format|
23
- format.html { haml( :workitems ) }
24
- format.json { json( :workitems, @workitems ) }
25
- end
25
+ @workitems = RuoteKit.engine.storage_participant.query(query)
26
+
27
+ respond_with :workitems
26
28
  end
27
29
 
28
- get "/_ruote/workitems/:wfid/:expid" do
29
- @workitem = find_workitem( params[:wfid], params[:expid] )
30
+ get '/_ruote/workitems/:id' do
31
+
32
+ @workitem, @workitems, @wfid = fetch_wi
33
+
34
+ return http_error(404) if @workitem.nil? && @workitems.nil?
30
35
 
31
36
  if @workitem
32
- respond_to do |format|
33
- format.html { haml :workitem }
34
- format.json { json( :workitem, @workitem ) }
35
- end
37
+ respond_with :workitem
36
38
  else
37
- resource_not_found
39
+ respond_with :workitems
38
40
  end
39
41
  end
40
42
 
41
- put "/_ruote/workitems/:wfid/:expid" do
42
- workitem = find_workitem( params[:wfid], params[:expid] )
43
+ put '/_ruote/workitems/:id' do
43
44
 
44
- (resource_not_found and return) if workitem.nil?
45
+ @workitem, _, _ = fetch_wi
45
46
 
46
- options = field_updates_and_proceed_from_put
47
+ return http_error(404) unless @workitem
48
+
49
+ options = begin
50
+ field_updates_and_proceed_from_put
51
+ rescue Rufus::Json::ParserError => pe
52
+ return http_error(400, pe)
53
+ end
47
54
 
48
55
  unless options[:fields].empty?
49
- workitem.fields = options[:fields]
50
- storage_participant.update( workitem )
56
+ @workitem.fields = options[:fields]
57
+ RuoteKit.engine.storage_participant.update(@workitem)
51
58
  end
52
59
 
53
60
  if options[:proceed]
54
- storage_participant.reply( workitem )
61
+ RuoteKit.engine.storage_participant.reply(@workitem)
55
62
  end
56
63
 
57
64
  respond_to do |format|
58
- format.html {
59
- redirect options[:proceed] ? "/_ruote/workitems/#{params[:wfid]}" : "/_ruote/workitems/#{params[:wfid]}/#{params[:expid]}"
60
- }
61
- format.json { json( :workitem, workitem ) }
65
+
66
+ format.html do
67
+ redirect(options[:proceed] ?
68
+ "/_ruote/workitems/#{@workitem.fei.wfid}" :
69
+ "/_ruote/workitems/#{@workitem.fei.sid}")
70
+ end
71
+ format.json do
72
+ json :workitem
73
+ end
62
74
  end
63
75
  end
64
76
 
77
+ protected
78
+
79
+ def fetch_wi
80
+
81
+ fei = params[:id].split('!')
82
+ wfid = fei.last
83
+
84
+ workitem = nil
85
+ workitems = nil
86
+
87
+ wis = RuoteKit.engine.storage_participant.by_wfid(wfid)
88
+
89
+ if fei.length > 1
90
+ workitem = wis.find { |wi| wi.fei.sid == params[:id] }
91
+ else
92
+ workitems = wis
93
+ end
94
+
95
+ [ workitem, workitems, wfid ]
96
+ end
97
+
98
+ def field_updates_and_proceed_from_put
99
+
100
+ options = { :fields => {}, :proceed => false }
101
+
102
+ if request.content_type == 'application/json'
103
+
104
+ data = Rufus::Json.decode(env['rack.input'].read)
105
+ if wi = data['workitem']; data = wi; end
106
+
107
+ unless data['fields'].nil? || data['fields'].empty?
108
+ options[:fields] = data['fields']
109
+ end
110
+ unless data['_proceed'].nil? || data['_proceed'].empty?
111
+ options[:proceed] = data['_proceed']
112
+ end
113
+
114
+ else
115
+
116
+ unless params['fields'].nil? || params['fields'].empty?
117
+ options[:fields] = Rufus::Json.decode(params[:fields])
118
+ end
119
+ unless params[:_proceed].nil? || params[:_proceed].empty?
120
+ options[:proceed] = params[:_proceed]
121
+ end
122
+ end
123
+
124
+ options
125
+ end
65
126
  end
127
+
@@ -1,9 +1,15 @@
1
+
2
+ # license is MIT, see LICENSE.txt
3
+
1
4
  module RuoteKit
2
5
  module Spec
6
+
3
7
  module RuoteHelpers
4
8
 
5
9
  # Launch a dummy process and return the wfid
6
- def launch_test_process( &block )
10
+ #
11
+ def launch_test_process(&block)
12
+
7
13
  pdef = if block_given?
8
14
  yield
9
15
  else
@@ -14,34 +20,37 @@ module RuoteKit
14
20
  end
15
21
  end
16
22
 
17
- wfid = RuoteKit.engine.launch( pdef )
18
-
19
- # Wait for the process list to populate
20
- sleep 0.1 while RuoteKit.engine.process( wfid ).nil?
23
+ wfid = RuoteKit.engine.launch(pdef)
21
24
 
22
- # Give the process some time to traverse the expression tree
23
- sleep 0.4
24
- #wait_for( 1 )
25
+ # give the engine some time to run the process
26
+ # (remember it does it asynchronously)
27
+ sleep(0.350)
25
28
 
26
29
  wfid
27
30
  end
28
31
 
29
- def noisy( on = true )
30
- RuoteKit.engine.context[:noisy] = on
32
+ def noisy(on = true)
33
+ RuoteKit.engine.noisy = on
31
34
  end
32
35
 
33
- def storage_participant
34
- RuoteKit.storage_participant
36
+ def engine
37
+ RuoteKit.engine
35
38
  end
36
39
 
37
- def find_workitem( wfid, expid )
38
- storage_participant.by_wfid( wfid ).detect { |wi| wi.fei.expid == expid }
40
+ def storage_participant
41
+ RuoteKit.engine.storage_participant
39
42
  end
40
43
 
41
- def wait_for( wfid )
42
- @_spec_worker.context.logger.wait_for( [ wfid ] )
44
+ def find_workitem(wfid, expid)
45
+ RuoteKit.engine.storage_participant.by_wfid(wfid).first { |wi|
46
+ wi.fei.expid == expid
47
+ }
43
48
  end
44
49
 
50
+ def wait_for(wfid)
51
+ RuoteKit.engine.wait_for(wfid)
52
+ end
45
53
  end
46
54
  end
47
55
  end
56
+
@@ -1,4 +1,6 @@
1
1
 
2
+ # license is MIT, see LICENSE.txt
3
+
2
4
  # lib/ruote-kit/version.rb
3
5
  #
4
6
  # so that the Rakefile doesn't have to load all the deps
@@ -6,6 +8,6 @@
6
8
 
7
9
  module RuoteKit
8
10
 
9
- VERSION = '2.1.10'
11
+ VERSION = '2.1.11'
10
12
  end
11
13
 
@@ -0,0 +1,38 @@
1
+
2
+ #pagination
3
+
4
+ - res = request.path.split('/')[2]
5
+
6
+ - if @skip
7
+
8
+ - lim = @limit || settings.limit
9
+
10
+ - @skip = 0 if @skip < 0
11
+ - @skip = @count - lim if @skip >= @count
12
+
13
+ = (@count > 0) ? @skip + 1 : 0
14
+ to
15
+ = [ @skip + @limit, @count ].min
16
+ of
17
+ = @count
18
+ = res
19
+
20
+ - las = ((@count / lim.to_f).ceil - 1) * lim
21
+ - pre = [ 0, @skip - lim ].max
22
+ - nex = [ @skip + lim, las ].min
23
+
24
+ %a.pagination{ :href => request.path, :rel => 'all' } all
25
+ - if @skip > 0
26
+ %a.pagination{ :href => "#{request.path}?limit=#{lim}&skip=0", :rel => 'first' } first
27
+ - if @skip > 0 && pre != 0
28
+ %a.pagination{ :href => "#{request.path}?limit=#{lim}&skip=#{pre}", :rel => 'previous' } previous
29
+ - if nex != las
30
+ %a.pagination{ :href => "#{request.path}?limit=#{lim}&skip=#{nex}", :rel => 'next' } next
31
+ - if las > 0 && @skip < las
32
+ %a.pagination{ :href => "#{request.path}?limit=#{lim}&skip=#{las}", :rel => 'last' } last
33
+
34
+ - else
35
+
36
+ - if resources = instance_variable_get("@#{res}")
37
+ = "#{resources.size} #{res}"
38
+
@@ -0,0 +1,52 @@
1
+
2
+ #overlay
3
+ #editor
4
+ %canvas#efluo
5
+ #fluo_editor
6
+ %a.ruote_button.ruote_go_button{ :title => 'close and use that definition', :href => '', :onclick => 'hideEditor(true); return false;' }
7
+ %a.ruote_button.ruote_cross_button{ :title => 'close', :href => '', :onclick => 'hideEditor(false); return false;' }
8
+
9
+ :javascript
10
+
11
+ $('textarea.variables').hide();
12
+
13
+ $('#overlay').hide();
14
+ $('#editor').hide();
15
+
16
+ function initEditor () {
17
+
18
+ var tree = tree || #{sample_process_tree};
19
+ var def = $('#tree')[0].value;
20
+ if (def.match(/\s*\[/)) tree = JSON.parse(def);
21
+
22
+ FluoEditor.renderFlow('fluo_editor', tree);
23
+ Fluo.renderFlow('efluo', tree);
24
+ Fluo.crop('efluo');
25
+
26
+ $('#fluo_editor')[0].onChange = function (tree) {
27
+ Fluo.renderFlow('efluo', tree);
28
+ Fluo.crop('efluo');
29
+ }
30
+ $('#fluo_editor')[0].onOver = function (expid) {
31
+ Fluo.highlight('efluo', expid);
32
+ }
33
+ }
34
+
35
+ function showEditor () {
36
+
37
+ initEditor();
38
+
39
+ document.getElementById('overlay').style.height =
40
+ '' + window.outerHeight + 'px';
41
+
42
+ $('#overlay').slideDown(function () { $('#editor').show(); });
43
+ }
44
+
45
+ function hideEditor (use) {
46
+
47
+ $('#editor').hide();
48
+ $('#overlay').hide();
49
+
50
+ if (use) $('#tree')[0].value = FluoEditor.asJson('fluo_editor');
51
+ }
52
+