petri_flow 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/config/wf_manifest.js +2 -0
  6. data/app/assets/javascripts/wf/application.js +4 -0
  7. data/app/assets/stylesheets/wf/application.scss +2 -0
  8. data/app/assets/stylesheets/wf/arcs.css +4 -0
  9. data/app/assets/stylesheets/wf/cases.css +4 -0
  10. data/app/assets/stylesheets/wf/comments.css +4 -0
  11. data/app/assets/stylesheets/wf/fields.css +4 -0
  12. data/app/assets/stylesheets/wf/forms.css +4 -0
  13. data/app/assets/stylesheets/wf/guards.css +4 -0
  14. data/app/assets/stylesheets/wf/places.css +4 -0
  15. data/app/assets/stylesheets/wf/transitions.css +4 -0
  16. data/app/assets/stylesheets/wf/workflows.css +4 -0
  17. data/app/assets/stylesheets/wf/workitem_assignments.css +4 -0
  18. data/app/assets/stylesheets/wf/workitems.css +4 -0
  19. data/app/controllers/wf/application_controller.rb +14 -0
  20. data/app/controllers/wf/arcs_controller.rb +61 -0
  21. data/app/controllers/wf/cases_controller.rb +48 -0
  22. data/app/controllers/wf/comments_controller.rb +30 -0
  23. data/app/controllers/wf/fields_controller.rb +54 -0
  24. data/app/controllers/wf/forms_controller.rb +59 -0
  25. data/app/controllers/wf/guards_controller.rb +58 -0
  26. data/app/controllers/wf/places_controller.rb +53 -0
  27. data/app/controllers/wf/transitions_controller.rb +69 -0
  28. data/app/controllers/wf/workflows_controller.rb +59 -0
  29. data/app/controllers/wf/workitem_assignments_controller.rb +30 -0
  30. data/app/controllers/wf/workitems_controller.rb +79 -0
  31. data/app/helpers/wf/application_helper.rb +6 -0
  32. data/app/helpers/wf/arcs_helper.rb +6 -0
  33. data/app/helpers/wf/cases_helper.rb +6 -0
  34. data/app/helpers/wf/comments_helper.rb +6 -0
  35. data/app/helpers/wf/fields_helper.rb +6 -0
  36. data/app/helpers/wf/forms_helper.rb +6 -0
  37. data/app/helpers/wf/guards_helper.rb +6 -0
  38. data/app/helpers/wf/places_helper.rb +6 -0
  39. data/app/helpers/wf/transitions_helper.rb +6 -0
  40. data/app/helpers/wf/workflows_helper.rb +6 -0
  41. data/app/helpers/wf/workitem_assignments_helper.rb +6 -0
  42. data/app/helpers/wf/workitems_helper.rb +6 -0
  43. data/app/jobs/wf/application_job.rb +6 -0
  44. data/app/jobs/wf/fire_timed_workitem_job.rb +15 -0
  45. data/app/mailers/wf/application_mailer.rb +8 -0
  46. data/app/models/wf/application_record.rb +7 -0
  47. data/app/models/wf/arc.rb +42 -0
  48. data/app/models/wf/callbacks/assignment_default.rb +12 -0
  49. data/app/models/wf/callbacks/deadline_default.rb +11 -0
  50. data/app/models/wf/callbacks/enable_default.rb +11 -0
  51. data/app/models/wf/callbacks/fire_default.rb +11 -0
  52. data/app/models/wf/callbacks/hold_timeout_default.rb +11 -0
  53. data/app/models/wf/callbacks/notification_default.rb +11 -0
  54. data/app/models/wf/callbacks/time_default.rb +11 -0
  55. data/app/models/wf/callbacks/unassignment_default.rb +11 -0
  56. data/app/models/wf/case.rb +44 -0
  57. data/app/models/wf/case_assignment.rb +22 -0
  58. data/app/models/wf/case_command/add_comment.rb +17 -0
  59. data/app/models/wf/case_command/add_manual_assignment.rb +17 -0
  60. data/app/models/wf/case_command/add_token.rb +20 -0
  61. data/app/models/wf/case_command/add_workitem_assignment.rb +35 -0
  62. data/app/models/wf/case_command/begin_workitem_action.rb +33 -0
  63. data/app/models/wf/case_command/cancel.rb +17 -0
  64. data/app/models/wf/case_command/cancel_workitem.rb +20 -0
  65. data/app/models/wf/case_command/clear_manual_assignments.rb +16 -0
  66. data/app/models/wf/case_command/clear_workitem_assignments.rb +20 -0
  67. data/app/models/wf/case_command/consume_token.rb +23 -0
  68. data/app/models/wf/case_command/enable_transitions.rb +33 -0
  69. data/app/models/wf/case_command/end_workitem_action.rb +25 -0
  70. data/app/models/wf/case_command/finish_workitem.rb +18 -0
  71. data/app/models/wf/case_command/finished_p.rb +28 -0
  72. data/app/models/wf/case_command/fire_message_transition.rb +20 -0
  73. data/app/models/wf/case_command/fire_transition_internal.rb +41 -0
  74. data/app/models/wf/case_command/lock_token.rb +21 -0
  75. data/app/models/wf/case_command/new.rb +17 -0
  76. data/app/models/wf/case_command/release_token.rb +20 -0
  77. data/app/models/wf/case_command/remove_manual_assignment.rb +17 -0
  78. data/app/models/wf/case_command/remove_workitem_assignment.rb +24 -0
  79. data/app/models/wf/case_command/resume.rb +17 -0
  80. data/app/models/wf/case_command/set_workitem_assignments.rb +32 -0
  81. data/app/models/wf/case_command/start_case.rb +19 -0
  82. data/app/models/wf/case_command/start_workitem.rb +26 -0
  83. data/app/models/wf/case_command/suspend.rb +17 -0
  84. data/app/models/wf/case_command/sweep_automatic_transitions.rb +31 -0
  85. data/app/models/wf/case_command/sweep_timed_transitions.rb +16 -0
  86. data/app/models/wf/case_command/workitem_action.rb +20 -0
  87. data/app/models/wf/comment.rb +21 -0
  88. data/app/models/wf/demo_target.rb +18 -0
  89. data/app/models/wf/entry.rb +33 -0
  90. data/app/models/wf/field.rb +53 -0
  91. data/app/models/wf/field_value.rb +30 -0
  92. data/app/models/wf/form.rb +18 -0
  93. data/app/models/wf/group.rb +21 -0
  94. data/app/models/wf/guard.rb +73 -0
  95. data/app/models/wf/party.rb +22 -0
  96. data/app/models/wf/place.rb +28 -0
  97. data/app/models/wf/token.rb +37 -0
  98. data/app/models/wf/transition.rb +49 -0
  99. data/app/models/wf/transition_static_assignment.rb +21 -0
  100. data/app/models/wf/user.rb +26 -0
  101. data/app/models/wf/workflow.rb +182 -0
  102. data/app/models/wf/workitem.rb +78 -0
  103. data/app/models/wf/workitem_assignment.rb +19 -0
  104. data/app/views/layouts/wf/_alert.html.erb +4 -0
  105. data/app/views/layouts/wf/_footer.html.erb +13 -0
  106. data/app/views/layouts/wf/_nav.html.erb +13 -0
  107. data/app/views/layouts/wf/_notice.html.erb +4 -0
  108. data/app/views/layouts/wf/application.html.erb +34 -0
  109. data/app/views/wf/arcs/_form.html.erb +40 -0
  110. data/app/views/wf/arcs/edit.html.erb +1 -0
  111. data/app/views/wf/arcs/new.html.erb +1 -0
  112. data/app/views/wf/arcs/show.html.erb +67 -0
  113. data/app/views/wf/cases/_form.html.erb +27 -0
  114. data/app/views/wf/cases/index.html.erb +35 -0
  115. data/app/views/wf/cases/new.html.erb +1 -0
  116. data/app/views/wf/cases/show.html.erb +113 -0
  117. data/app/views/wf/comments/new.html.erb +27 -0
  118. data/app/views/wf/fields/_form.html.erb +42 -0
  119. data/app/views/wf/fields/edit.html.erb +1 -0
  120. data/app/views/wf/fields/new.html.erb +1 -0
  121. data/app/views/wf/forms/_form.html.erb +32 -0
  122. data/app/views/wf/forms/edit.html.erb +1 -0
  123. data/app/views/wf/forms/index.html.erb +32 -0
  124. data/app/views/wf/forms/new.html.erb +1 -0
  125. data/app/views/wf/forms/show.html.erb +53 -0
  126. data/app/views/wf/guards/_form.html.erb +43 -0
  127. data/app/views/wf/guards/edit.html.erb +1 -0
  128. data/app/views/wf/guards/new.html.erb +1 -0
  129. data/app/views/wf/places/_form.html.erb +43 -0
  130. data/app/views/wf/places/edit.html.erb +1 -0
  131. data/app/views/wf/places/new.html.erb +1 -0
  132. data/app/views/wf/transitions/_form.html.erb +92 -0
  133. data/app/views/wf/transitions/edit.html.erb +1 -0
  134. data/app/views/wf/transitions/new.html.erb +1 -0
  135. data/app/views/wf/workflows/_form.html.erb +32 -0
  136. data/app/views/wf/workflows/edit.html.erb +1 -0
  137. data/app/views/wf/workflows/index.html.erb +38 -0
  138. data/app/views/wf/workflows/new.html.erb +1 -0
  139. data/app/views/wf/workflows/show.html.erb +177 -0
  140. data/app/views/wf/workitem_assignments/new.html.erb +27 -0
  141. data/app/views/wf/workitems/index.html.erb +68 -0
  142. data/app/views/wf/workitems/pre_finish.html.erb +33 -0
  143. data/app/views/wf/workitems/show.html.erb +211 -0
  144. data/config/routes.rb +30 -0
  145. data/db/migrate/20200130201043_init.rb +226 -0
  146. data/db/migrate/20200130201641_init_some_data.rb +15 -0
  147. data/db/migrate/20200131200455_create_wf_entries.rb +19 -0
  148. data/db/migrate/20200201001543_add_target_field_name_for_guard.rb +7 -0
  149. data/lib/tasks/wf_tasks.rake +5 -0
  150. data/lib/wf/engine.rb +10 -0
  151. data/lib/wf/version.rb +5 -0
  152. data/lib/wf.rb +7 -0
  153. metadata +312 -0
@@ -0,0 +1,92 @@
1
+ <%= form_with(model: transition, url: [@workflow, @transition], local: true) do |f| %>
2
+ <% if transition.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(transition.errors.count, "error") %> prohibited this transition from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% transition.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :name, class: "label" %>
21
+ <%= f.text_field :name, class: "form-control", placeholder: "Name" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.label :description, class: "label" %>
26
+ <%= f.text_area :description, class: "form-control", placeholder: "Description" %>
27
+ </div>
28
+
29
+ <div class="form-group">
30
+ <%= f.label :trigger_limit, class: "label" %>
31
+ <%= f.text_field :trigger_limit, class: "form-control", placeholder: "Trigger Limit" %>
32
+ </div>
33
+
34
+ <div class="form-group">
35
+ <%= f.label :sort_order, class: "label" %>
36
+ <%= f.text_field :sort_order, class: "form-control", placeholder: "Sort Order" %>
37
+ </div>
38
+
39
+ <div class="form-group">
40
+ <%= f.label :trigger_type, class: "label" %>
41
+ <%= f.select :trigger_type, Wf::Transition.trigger_types.keys, {}, class: "form-control custom-select", placeholder: "Trigger Type" %>
42
+ </div>
43
+
44
+ <div class="form-group">
45
+ <%= f.label :form_id, class: "label" %>
46
+ <%= f.select :form_id, Wf::Form.all.map{|x| [x.name, x.id]}, {include_blank: 'user can input from custom form?'}, class: "form-control custom-select", placeholder: "Trigger Type" %>
47
+ </div>
48
+
49
+ <div class="form-group">
50
+ <%= f.label :enable_callback, class: "label" %>
51
+ <%= f.select :enable_callback, Wf::Workflow.enable_callbacks, {}, class: "form-control custom-select", placeholder: "Callback" %>
52
+ </div>
53
+
54
+ <div class="form-group">
55
+ <%= f.label :fire_callback, class: "label" %>
56
+ <%= f.select :fire_callback, Wf::Workflow.fire_callbacks, {}, class: "form-control custom-select", placeholder: "Callback" %>
57
+ </div>
58
+
59
+ <div class="form-group">
60
+ <%= f.label :deadline_callback, class: "label" %>
61
+ <%= f.select :deadline_callback, Wf::Workflow.deadline_callbacks, {}, class: "form-control custom-select", placeholder: "Callback" %>
62
+ </div>
63
+
64
+ <div class="form-group">
65
+ <%= f.label :time_callback, class: "label" %>
66
+ <%= f.select :time_callback, Wf::Workflow.time_callbacks, {}, class: "form-control custom-select", placeholder: "Callback" %>
67
+ </div>
68
+
69
+ <div class="form-group">
70
+ <%= f.label :hold_timeout_callback, class: "label" %>
71
+ <%= f.select :hold_timeout_callback, Wf::Workflow.hold_timeout_callbacks, {}, class: "form-control custom-select", placeholder: "Callback" %>
72
+ </div>
73
+
74
+ <div class="form-group">
75
+ <%= f.label :assignment_callback, class: "label" %>
76
+ <%= f.select :assignment_callback, Wf::Workflow.assignment_callbacks, {}, class: "form-control custom-select", placeholder: "Callback" %>
77
+ </div>
78
+
79
+ <div class="form-group">
80
+ <%= f.label :unassignment_callback, class: "label" %>
81
+ <%= f.select :unassignment_callback, Wf::Workflow.unassignment_callbacks, {}, class: "form-control custom-select", placeholder: "Callback" %>
82
+ </div>
83
+
84
+ <div class="form-group">
85
+ <%= f.label :notification_callback, class: "label" %>
86
+ <%= f.select :notification_callback, Wf::Workflow.notification_callbacks, {}, class: "form-control custom-select", placeholder: "Callback" %>
87
+ </div>
88
+
89
+ <div class="form-group">
90
+ <%= f.submit class: "btn btn-primary", data: {disable_with: 'Waiting...'} %>
91
+ </div>
92
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow, transition: @transition %>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow, transition: @transition %>
@@ -0,0 +1,32 @@
1
+ <%= form_with(model: workflow, local: true) do |f| %>
2
+ <% if workflow.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(workflow.errors.count, "error") %> prohibited this workflow from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% workflow.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :name, class: "label" %>
21
+ <%= f.text_field :name, class: "form-control", placeholder: "Name" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.label :description, class: "label" %>
26
+ <%= f.text_area :description, class: "form-control", placeholder: "Description" %>
27
+ </div>
28
+
29
+ <div class="form-group">
30
+ <%= f.submit class: "btn btn-primary", data: {disable_with: 'Waiting...'} %>
31
+ </div>
32
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow %>
@@ -0,0 +1,38 @@
1
+ <div class="float-left"><h2>Workflows</h2></div>
2
+ <div class="float-right">
3
+ <%= link_to 'New Workflow', new_workflow_path, class: 'btn btn-primary' %>
4
+ </div>
5
+ <div>
6
+ <table class="table table-bordered table-info">
7
+ <thead>
8
+ <tr>
9
+ <th scope="col">ID</th>
10
+ <th scope="col">Name</th>
11
+ <th scope="col">Description</th>
12
+ <th scope="col">Is Valid?</th>
13
+ <th scope="col">Error Msg</th>
14
+ <th scope="col">Actions</th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @workflows.each do |workflow| %>
19
+ <tr>
20
+ <td><%= workflow.id %></td>
21
+ <td><%= link_to workflow.name, workflow_path(workflow) %></td>
22
+ <td><%= workflow.description %></td>
23
+ <td><%= workflow.is_valid? %></td>
24
+ <td><%= workflow.error_msg %></td>
25
+ <td>
26
+ <%= link_to 'Delete Workflow', workflow_path(workflow), remote: true, method: :delete, data: {confirm: 'confirm?'}, class: 'btn btn-danger btn-sm' %>
27
+ <%= link_to 'Create Transition', new_workflow_transition_path(workflow), class: 'btn btn-info btn-sm' %>
28
+ <%= link_to 'Create Place', new_workflow_place_path(workflow), class: 'btn btn-info btn-sm' %>
29
+ <%= link_to 'Create Arc', new_workflow_arc_path(workflow), class: 'btn btn-info btn-sm' %>
30
+ </td>
31
+ </tr>
32
+ <% end %>
33
+ </tbody>
34
+ </table>
35
+ </div>
36
+ <div>
37
+ <%= paginate @workflows, theme: 'twitter-bootstrap-4' %>
38
+ </div>
@@ -0,0 +1 @@
1
+ <%= render "form", workflow: @workflow %>
@@ -0,0 +1,177 @@
1
+ <div class="float-right">
2
+ <% if @workflow.is_valid? %>
3
+ <%= link_to 'New Case', new_workflow_case_path(@workflow), class: 'btn btn-dark' %>
4
+ <% end %>
5
+ <%= link_to 'Edit Workflow', edit_workflow_path(@workflow), class: 'btn btn-primary' %>
6
+ <%= link_to 'Create Transitions', new_workflow_transition_path(@workflow), class: 'btn btn-primary' %>
7
+ <%= link_to 'Create Places', new_workflow_place_path(@workflow), class: 'btn btn-primary' %>
8
+ <%= link_to 'Create Arcs', new_workflow_arc_path(@workflow), class: 'btn btn-primary' %>
9
+ <%= link_to 'Delete Workflow', workflow_path(@workflow), data: {confirm: 'confirm?'}, method: :delete, class: 'btn btn-danger' %>
10
+ </div>
11
+ <div>
12
+ <h2 class="">Workflow Detail</h2>
13
+ <table class="table table-bordered table-info">
14
+ <tbody>
15
+ <tr>
16
+ <th scope="row">ID</th>
17
+ <td><%= @workflow.id %></td>
18
+ </tr>
19
+ <tr>
20
+ <th scope="row">Name</th>
21
+ <td><%= @workflow.name %></td>
22
+ </tr>
23
+ <tr>
24
+ <th scope="row">Description</th>
25
+ <td><%= @workflow.description %></td>
26
+ </tr>
27
+ <tr>
28
+ <th scope="row">Is Valid?</th>
29
+ <td><%= @workflow.is_valid? %></td>
30
+ </tr>
31
+
32
+ <tr>
33
+ <th scope="row">Error Msg</th>
34
+ <td><%= @workflow.error_msg %></td>
35
+ </tr>
36
+ </tbody>
37
+ </table>
38
+ </div>
39
+
40
+ <div>
41
+ <h2>Graph Editor</h2>
42
+ <div class="card">
43
+ <div class="card-body">
44
+ <%=raw @workflow.render_graph %>
45
+ </div>
46
+ </div>
47
+ </div>
48
+
49
+ <div>
50
+ <h2 class="">Cases</h2>
51
+ <table class="table table-bordered table-info">
52
+ <thead>
53
+ <tr>
54
+ <th scope="col">All</th>
55
+ <th scope="col">Created</th>
56
+ <th scope="col">Active</th>
57
+ <th scope="col">Suspended</th>
58
+ <th scope="col">Canceled</th>
59
+ <th scope="col">Finished</th>
60
+ </tr>
61
+ </thead>
62
+ <tbody>
63
+ <tr>
64
+ <td><%= link_to @workflow.cases.count, workflow_cases_path(@workflow) %></td>
65
+ <td><%= link_to @workflow.cases.created.count, workflow_cases_path(@workflow, state: :created) %></td>
66
+ <td><%= link_to @workflow.cases.active.count, workflow_cases_path(@workflow, state: :active) %></td>
67
+ <td><%= link_to @workflow.cases.suspended.count, workflow_cases_path(@workflow, state: :suspended) %></td>
68
+ <td><%= link_to @workflow.cases.canceled.count, workflow_cases_path(@workflow, state: :canceled) %></td>
69
+ <td><%= link_to @workflow.cases.finished.count, workflow_cases_path(@workflow, state: :finished) %></td>
70
+ </tr>
71
+ </tbody>
72
+ </table>
73
+ </div>
74
+
75
+ <div>
76
+ <h2>Places</h2>
77
+ <table class="table table-bordered table-info">
78
+ <thead>
79
+ <tr>
80
+ <th scope="col">ID</th>
81
+ <th scope="col">Name</th>
82
+ <th scope="col">Description</th>
83
+ <th scope="col">Place Type</th>
84
+ <th scope="col">Sort Order</th>
85
+ <th scope="col">Actions</th>
86
+ </tr>
87
+ </thead>
88
+ <tbody>
89
+ <% @workflow.places.each do |place| %>
90
+ <tr>
91
+ <td><%= place.id %></td>
92
+ <td><%= place.name %></td>
93
+ <td><%= place.description %></td>
94
+ <td><%= place.place_type %></td>
95
+ <td><%= place.sort_order %></td>
96
+ <td><%= link_to 'Edit Place', edit_workflow_place_path(@workflow, place), class: 'btn btn-sm btn-info' %></td>
97
+ <td><%= link_to 'Delete Place', [@workflow, place], remote: true, method: :delete, data: {confirm: 'confirm?'}, class: 'btn btn-sm btn-info' %></td>
98
+ </tr>
99
+ <% end %>
100
+ </tbody>
101
+ </table>
102
+ </div>
103
+ <div>
104
+ <h2>Transitions</h2>
105
+ <table class="table table-bordered table-info">
106
+ <thead>
107
+ <tr>
108
+ <th scope="col">ID</th>
109
+ <th scope="col">Name</th>
110
+ <th scope="col">Description</th>
111
+ <th scope="col">Trigger Limit</th>
112
+ <th scope="col">Trigger Type</th>
113
+ <th scope="col">Sort Order</th>
114
+ <th scope="col">Custom Form</th>
115
+ <th scope='col'> Actions </th>
116
+ </tr>
117
+ </thead>
118
+ <tbody>
119
+ <% @workflow.transitions.each do |transition| %>
120
+ <tr>
121
+ <td><%= transition.id %></td>
122
+ <td><%= transition.name %></td>
123
+ <td><%= transition.description %></td>
124
+ <td><%= transition.trigger_limit %></td>
125
+ <td><%= transition.trigger_type %></td>
126
+ <td><%= transition.sort_order %></td>
127
+
128
+ <td>
129
+ <% if transition.form %>
130
+ <%= link_to transition.form.name, form_path(transition.form) %>
131
+ <% else %>
132
+ No Form
133
+ <% end %>
134
+ </td>
135
+ <td><%= link_to 'Edit Transition', edit_workflow_transition_path(@workflow, transition), class: 'btn btn-sm btn-info' %></td>
136
+ <td><%= link_to 'Delete Transition', [@workflow, transition], remote: true, method: :delete, data: {confirm: 'confirm?'}, class: 'btn btn-sm btn-info' %></td>
137
+ </tr>
138
+ <% end %>
139
+ </tbody>
140
+ </table>
141
+ </div>
142
+ <div>
143
+ <h2>Arcs</h2>
144
+ <table class="table table-bordered table-info">
145
+ <thead>
146
+ <tr>
147
+ <th scope="col">ID</th>
148
+ <th scope="col">Name</th>
149
+ <th scope="col">Direction</th>
150
+ <th scope="col">Place</th>
151
+ <th scope="col">Transition</th>
152
+ <th scope="col">Arc Type</th>
153
+ <th scope="col">Guards</th>
154
+ <th scope='col'> Actions </th>
155
+ </tr>
156
+ </thead>
157
+ <tbody>
158
+ <% @workflow.arcs.includes(:transition, :place).each do |arc| %>
159
+ <tr>
160
+ <td><%= link_to arc.id, workflow_arc_path(@workflow, arc) %></td>
161
+ <td><%= link_to arc.name, workflow_arc_path(@workflow, arc) %></td>
162
+ <td><%= arc.direction %></td>
163
+ <td><%= arc.place&.name %></td>
164
+ <td><%= arc.transition&.name %></td>
165
+ <td><%= arc.guards.map(&:inspect).join(" & ") %></td>
166
+ <td><%= link_to 'Edit Arc', edit_workflow_arc_path(@workflow, arc), class: 'btn btn-sm btn-info' %></td>
167
+ <td>
168
+ <% if arc.out? %>
169
+ <%= link_to 'Add Gruards', new_arc_guard_path(arc), class: 'btn btn-sm btn-info' %>
170
+ <% end %>
171
+ </td>
172
+ <td><%= link_to 'Delete Arc', [@workflow, arc], remote: true, method: :delete, data: {confirm: 'confirm?'}, class: 'btn btn-sm btn-danger' %></td>
173
+ </tr>
174
+ <% end %>
175
+ </tbody>
176
+ </table>
177
+ </div>
@@ -0,0 +1,27 @@
1
+ <%= form_with(model: @workitem_assignment, url: workitem_workitem_assignments_path(@workitem), local: true) do |f| %>
2
+ <% if @workitem_assignment.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(@workitem_assignment.errors.count, "error") %> prohibited this workitem_assignment from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% @workitem_assignment.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <div class="form-group">
20
+ <%= f.label :party_id, class: "label" %>
21
+ <%= f.select :party_id, Wf::Party.all.map{|x| [x.party_name, x.id]}, {}, class: "form-control custom-select", placeholder: "party_id" %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= f.submit class: "btn btn-primary", value: "Assign", data: {disable_with: 'Waiting...'} %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,68 @@
1
+ <div>
2
+ <h2 class="">Stats</h2>
3
+ <table class="table table-bordered table-info">
4
+ <thead>
5
+ <tr>
6
+ <th scope="col">All</th>
7
+ <th scope="col">Enabled</th>
8
+ <th scope="col">Started</th>
9
+ <th scope="col">Canceled</th>
10
+ <th scope="col">Finished</th>
11
+ <th scope="col">Overridden</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <tr>
16
+ <td><%= link_to @workitems.unscope(:offset).unscope(:limit).unscope(:order).unscope(:select).count, workitems_path %></td>
17
+ <td><%= link_to @workitems.unscope(:offset).unscope(:limit).unscope(:order).unscope(:select).enabled.count, workitems_path(state: :enabled) %></td>
18
+ <td><%= link_to @workitems.unscope(:offset).unscope(:limit).unscope(:order).unscope(:select).started.count, workitems_path(state: :started) %></td>
19
+ <td><%= link_to @workitems.unscope(:offset).unscope(:limit).unscope(:order).unscope(:select).canceled.count, workitems_path(state: :canceled) %></td>
20
+ <td><%= link_to @workitems.unscope(:offset).unscope(:limit).unscope(:order).unscope(:select).finished.count, workitems_path(state: :finished) %></td>
21
+ <td><%= link_to @workitems.unscope(:offset).unscope(:limit).unscope(:order).unscope(:select).overridden.count, workitems_path(state: :overridden) %></td>
22
+ </tr>
23
+ </tbody>
24
+ </table>
25
+ </div>
26
+
27
+ <div>
28
+ <h2>Workitems</h2>
29
+ <table class="table table-bordered table-info">
30
+ <thead>
31
+ <tr>
32
+ <th scope="col">ID</th>
33
+ <th scope="col">Transition</th>
34
+ <th scope="col">State</th>
35
+ <th scope="col">Holding User</th>
36
+ <th scope="col">Started At</th>
37
+ <th scope="col">Enabled At</th>
38
+ <th scope="col">Canceled At</th>
39
+ <th scope="col">Finished At</th>
40
+ <th scope="col">Overridden At</th>
41
+ <th scope="col">Deadline</th>
42
+ <th scope="col">Detail</th>
43
+ </tr>
44
+ </thead>
45
+ <tbody>
46
+ <% @workitems.each do |workitem| %>
47
+ <tr>
48
+ <td><%= link_to workitem.id, workitem_path(workitem) %></td>
49
+ <td>
50
+ <%= link_to workitem.transition.name, workflow_transition_path(workitem.workflow, workitem.transition) %> </td>
51
+ <td><%= workitem.state %></td>
52
+ <td><%= workitem.holding_user_id %></td>
53
+ <td><%= workitem.started_at %></td>
54
+ <td><%= workitem.enabled_at %></td>
55
+ <td><%= workitem.canceled_at %></td>
56
+ <td><%= workitem.finished_at %></td>
57
+ <td><%= workitem.overridden_at %></td>
58
+ <td><%= workitem.deadline %></td>
59
+ <td><%= link_to "Run", workitem_path(workitem), class: 'btn btn-sm btn-success' %></td>
60
+ </tr>
61
+ <% end %>
62
+ </tbody>
63
+ </table>
64
+ </div>
65
+
66
+ <div>
67
+ <%= paginate @workitems, theme: 'twitter-bootstrap-4' %>
68
+ </div>
@@ -0,0 +1,33 @@
1
+ <%= form_with(model: @workitem, url: finish_workitem_path(@workitem), method: :put, local: true) do |f| %>
2
+ <% if @workitem.errors.any? %>
3
+ <article class="message is-danger">
4
+ <div class="message-header">
5
+ <p>
6
+ <%= pluralize(@workitem.errors.count, "error") %> prohibited this workitem from being saved:
7
+ </p>
8
+ </div>
9
+ <div class="message-body content">
10
+ <ul>
11
+ <% @workitem.errors.full_messages.each do |message| %>
12
+ <li><%= message %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ </article>
17
+ <% end %>
18
+
19
+ <% if @workitem.transition.form %>
20
+ <%= f.fields_for :entry do |ff| %>
21
+ <% @workitem.transition.form.fields.each do |field| %>
22
+ <div class="form-group">
23
+ <%= ff.label field.name, class: "label" %>
24
+ <%= ff.text_field field.id, class: "form-control" %>
25
+ </div>
26
+ <% end %>
27
+ <% end %>
28
+ <% end %>
29
+
30
+ <div class="form-group">
31
+ <%= f.submit class: "btn btn-primary", value: "Done", data: {disable_with: 'Waiting...'} %>
32
+ </div>
33
+ <% end %>