petri_flow 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f669c4fb84fdecaea3a2662a2e0c192c26557553f019a6c0f8b230792873bfd
4
- data.tar.gz: 9ed26a5ff25b478956d23240de68a1b0f8381b1fa95a6aba85400ebd0453fc72
3
+ metadata.gz: 2b49ee6a8670d856f4c49892c235385b7d12a2918c7e909380c36cb45770bd8b
4
+ data.tar.gz: d0479916f6a0b30c72f6e54e5de57efdf3e88fe4e0e9c36f5077ab223b1a6c5f
5
5
  SHA512:
6
- metadata.gz: '09ffd098c4d07ca5f05324ef0bd7bff6035ca94cefe43a260071e92ad513adbf0ed67ad4392dcdf2484190e131a9d9c5c5baf975b989bbef7f8027d36f5b6670'
7
- data.tar.gz: 7de998e32418769e63521fe60cbd1d1a4c7c302847075fdd8fc0a3cc9265acca245c292223afd7366ad4b8c74f6edc912e3bc24f6ea92435f20e5e8a5f9b6661
6
+ metadata.gz: bc7387ca697d2a67ee0686afa6191a5ade457322861ce5f014b9005fc44c9734c6612159dcab09c09e31b35a55353db3a833fa6c23023f09ca266ddc3d599e10
7
+ data.tar.gz: a3a5398ae365be6bd2b49691d8ccba02c444172986f1a8808e7ba00d00b537f13e36361010aae162c48aa37ebef85ac298f4dae8a2e69e5aba4eba446588a04d
@@ -2,3 +2,4 @@
2
2
  //= require popper
3
3
  //= require bootstrap
4
4
  //= require rails-ujs
5
+ //= require select2-full
@@ -1,3 +1,8 @@
1
+ /*
2
+ *= require select2
3
+ *= require select2-bootstrap4
4
+ */
5
+
1
6
  @import "uikit/index";
2
7
 
3
8
  main{
@@ -14,7 +14,7 @@ module Wf
14
14
 
15
15
  def create
16
16
  @arc = Wf::Arc.find(params[:arc_id])
17
- gp = guard_params.merge(fieldable: GlobalID::Locator.locate(guard_params[:fieldable])) if guard_params[:fieldable].present?
17
+ gp = guard_params.merge(fieldable: GlobalID::Locator.locate(guard_params[:fieldable]))
18
18
  @guard = @arc.guards.new(gp.merge(workflow: @arc.workflow))
19
19
  redirect_to workflow_arc_path(@arc.workflow, @arc), notice: "only out direction arc can set guard!" unless @arc.out?
20
20
  if @guard.save
@@ -14,7 +14,8 @@ module Wf
14
14
 
15
15
  def create
16
16
  @workflow = Wf::Workflow.find(params[:workflow_id])
17
- @transition = @workflow.transitions.new(transition_params)
17
+ tp = transition_params.merge(form: GlobalID::Locator.locate(transition_params[:form]))
18
+ @transition = @workflow.transitions.new(tp)
18
19
  if @transition.save
19
20
  redirect_to workflow_path(@workflow), notice: "transition was successfully created."
20
21
  else
@@ -38,7 +39,8 @@ module Wf
38
39
  def update
39
40
  @workflow = Wf::Workflow.find(params[:workflow_id])
40
41
  @transition = @workflow.transitions.find(params[:id])
41
- if @transition.update(transition_params)
42
+ tp = transition_params.merge(form: GlobalID::Locator.locate(transition_params[:form]))
43
+ if @transition.update(tp)
42
44
  redirect_to workflow_path(@workflow), notice: "transition was successfully updated."
43
45
  else
44
46
  render :edit
@@ -54,7 +56,7 @@ module Wf
54
56
  :trigger_limit,
55
57
  :trigger_type,
56
58
  :sort_order,
57
- :form_id,
59
+ :form,
58
60
  :enable_callback,
59
61
  :fire_callback,
60
62
  :time_callback,
@@ -42,17 +42,21 @@ module Wf
42
42
 
43
43
  def finish
44
44
  if @workitem.transition.form && params[:workitem][:entry]
45
- entry = @workitem.entries.find_or_create_by!(user: wf_current_user)
46
- params[:workitem][:entry].permit!.each do |field_id, field_value|
47
- if field = entry.field_values.where(form: @workitem.transition.form, workflow: @workitem.workflow, field_id: field_id).first
48
- field.update!(value: field_value)
49
- else
50
- entry.field_values.create!(form: @workitem.transition.form, workflow: @workitem.workflow, field_id: field_id, value: field_value)
51
- end
45
+ form = @workitem.transition.form
46
+ cmd = Wf::CaseCommand::CreateEntry.call(form, @workitem, wf_current_user, params[:workitem][:entry].permit!)
47
+ if cmd.success?
48
+ Wf::CaseCommand::FinishWorkitem.call(@workitem)
49
+ finish_and_redirect
50
+ else
51
+ redirect_to pre_finish_workitem_path(@workitem), notice: "Your input no OK."
52
52
  end
53
- entry.update_payload!
53
+ else
54
+ Wf::CaseCommand::FinishWorkitem.call(@workitem)
55
+ finish_and_redirect
54
56
  end
55
- Wf::CaseCommand::FinishWorkitem.call(@workitem)
57
+ end
58
+
59
+ def finish_and_redirect
56
60
  if @workitem.case.finished?
57
61
  redirect_to workflow_case_path(@workitem.workflow, @workitem.case), notice: "workitem is done, and the case is finished."
58
62
  else
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Wf::CaseCommand
4
+ class CreateEntry
5
+ prepend SimpleCommand
6
+ attr_reader :form, :workitem, :user, :params
7
+ def initialize(form, workitem, user, params)
8
+ @form = form
9
+ @workitem = workitem
10
+ @params = params
11
+ @user = user
12
+ end
13
+
14
+ def call
15
+ create_entry
16
+ rescue StandardError
17
+ binding.pry
18
+ puts $ERROR_INFO
19
+ # TODO: more detail
20
+ errors.add(:base, :failure)
21
+ end
22
+
23
+ def create_entry
24
+ Wf::ApplicationRecord.transaction do
25
+ entry = form.entries.find_or_create_by!(user: user, workitem: workitem)
26
+ params.each do |field_id, field_value|
27
+ if field = entry.field_values.where(form: form, field_id: field_id).first
28
+ field.update!(value: field_value)
29
+ else
30
+ entry.field_values.create!(form: form, field_id: field_id, value: field_value)
31
+ end
32
+ end
33
+ entry.update_payload!
34
+ entry
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  # == Schema Information
4
3
  #
5
4
  # Table name: wf_entries
@@ -10,10 +9,12 @@
10
9
  # payload :json default("{}")
11
10
  # created_at :datetime not null
12
11
  # updated_at :datetime not null
12
+ # form_id :integer
13
13
  #
14
14
 
15
15
  module Wf
16
16
  class Entry < ApplicationRecord
17
+ belongs_to :form
17
18
  belongs_to :user, class_name: Wf::Workflow.user_class.to_s
18
19
  belongs_to :workitem
19
20
  has_many :field_values
@@ -40,14 +40,39 @@ module Wf
40
40
  "text[]": 28
41
41
  }
42
42
 
43
+ # TODO: array type
44
+ def field_type_for_view
45
+ case field_type
46
+ when "string"
47
+ "text_field"
48
+ when "integer"
49
+ "number_field"
50
+ when "date"
51
+ "date_field"
52
+ when "datetime"
53
+ "datetime_field"
54
+ when "boolean"
55
+ "radio_button"
56
+ when "text"
57
+ "text_area"
58
+ else
59
+ "text_field"
60
+ end
61
+ end
62
+
63
+ def array?
64
+ field_type.to_s.match(/^(\w+)(\[\])?$/)[2] == "[]"
65
+ end
66
+
43
67
  def type_for_cast
44
68
  type = field_type.to_s.match(/^(\w+)(\[\])?$/)[1]
45
- is_array = field_type.to_s.match(/^(\w+)(\[\])?$/)[2] == "[]"
46
- if is_array
47
- ActiveRecord::Type.lookup(type.to_sym, array: true)
69
+ if array?
70
+ ActiveRecord::Type.lookup(type.to_sym, adapter: :postgresql, array: true)
48
71
  else
49
- ActiveRecord::Type.lookup(type.to_sym)
72
+ ActiveRecord::Type.lookup(type.to_sym, adapter: :postgresql)
50
73
  end
51
74
  end
75
+
76
+ delegate :cast, to: :type_for_cast
52
77
  end
53
78
  end
@@ -1,30 +1,47 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  # == Schema Information
4
3
  #
5
4
  # Table name: wf_field_values
6
5
  #
7
- # id :integer not null, primary key
8
- # workflow_id :integer
9
- # transition_id :integer
10
- # form_id :integer
11
- # field_id :integer
12
- # value :text
13
- # created_at :datetime not null
14
- # updated_at :datetime not null
15
- # entry_id :integer
6
+ # id :integer not null, primary key
7
+ # form_id :integer
8
+ # field_id :integer
9
+ # value :text
10
+ # created_at :datetime not null
11
+ # updated_at :datetime not null
12
+ # entry_id :integer
16
13
  #
17
14
 
18
15
  module Wf
19
16
  class FieldValue < ApplicationRecord
20
- belongs_to :workflow, optional: true
21
- belongs_to :transition, optional: true
22
17
  belongs_to :form
23
18
  belongs_to :field
24
19
  belongs_to :entry
25
20
 
26
21
  def value_after_cast
27
- field.type_for_cast.cast(value)
22
+ ov = self[:value]
23
+ if field.array? && !ov.is_a?(Array)
24
+ v = begin
25
+ JSON.parse(ov)
26
+ rescue StandardError
27
+ []
28
+ end
29
+ field.type_for_cast.cast(v)
30
+ else
31
+ field.type_for_cast.cast(ov)
32
+ end
33
+ end
34
+
35
+ def value=(v)
36
+ self[:value] = if field.array?
37
+ Array(v.as_json)
38
+ else
39
+ v
40
+ end
41
+ end
42
+
43
+ def value
44
+ value_after_cast
28
45
  end
29
46
  end
30
47
  end
@@ -14,5 +14,6 @@
14
14
  module Wf
15
15
  class Form < ApplicationRecord
16
16
  has_many :fields, dependent: :destroy
17
+ has_many :entries
17
18
  end
18
19
  end
@@ -39,7 +39,7 @@ module Wf
39
39
  def value_after_cast
40
40
  field = fieldable
41
41
  if fieldable
42
- fieldable.type_for_cast.cast(value)
42
+ fieldable.cast(value)
43
43
  else
44
44
  # TODO
45
45
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  # == Schema Information
4
3
  #
5
4
  # Table name: wf_transitions
@@ -22,6 +21,7 @@
22
21
  # hold_timeout_callback :string default("Wf::Callbacks::HoldTimeoutDefault")
23
22
  # assignment_callback :string default("Wf::Callbacks::AssignmentDefault")
24
23
  # unassignment_callback :string default("Wf::Callbacks::UnassignmentDefault")
24
+ # form_type :string default("Wf::Form")
25
25
  #
26
26
 
27
27
  module Wf
@@ -31,7 +31,7 @@ module Wf
31
31
  has_many :transition_static_assignments
32
32
  has_many :static_parties, through: :transition_static_assignments, source: "party"
33
33
  has_many :workitems
34
- belongs_to :form, optional: true
34
+ belongs_to :form, optional: true, polymorphic: true
35
35
 
36
36
  enum trigger_type: {
37
37
  user: 0,
@@ -13,7 +13,6 @@
13
13
  # created_at :datetime not null
14
14
  # updated_at :datetime not null
15
15
  #
16
-
17
16
  module Wf
18
17
  class Workflow < ApplicationRecord
19
18
  has_many :places, dependent: :destroy
@@ -59,13 +58,25 @@ module Wf
59
58
  [Wf::Callbacks::HoldTimeoutDefault]
60
59
  end
61
60
 
61
+ def self.form_class
62
+ "::Wf::Form"
63
+ end
64
+
65
+ def self.entry_class
66
+ "::Wf::Entry"
67
+ end
68
+
69
+ def self.field_class
70
+ "::Wf::Field"
71
+ end
72
+
62
73
  def self.user_class
63
- ::Wf::User
74
+ "::Wf::User"
64
75
  end
65
76
 
66
77
  def self.org_classes
67
78
  {
68
- group: ::Wf::Group
79
+ group: "::Wf::Group"
69
80
  }
70
81
  end
71
82
 
@@ -81,10 +92,26 @@ module Wf
81
92
  # todo: remove color hex to const.
82
93
  def do_validate!
83
94
  msgs = []
84
- msgs << "must have start place" if places.start.blank?
95
+ start_place = places.start.first
96
+ end_place = places.end.first
97
+ msgs << "must have start place" if start_place.blank?
85
98
  msgs << "must have only one start place" if places.start.count > 1
86
- msgs << "must have end place" if places.end.blank?
99
+ msgs << "must have end place" if end_place.blank?
87
100
  msgs << "must have only one end place" if places.end.count > 1
101
+ msgs << "must not have discrete transition" if transitions.any? { |t| !t.arcs.in.exists? }
102
+ if start_place && end_place
103
+ rgl = to_rgl
104
+ places.each do |p|
105
+ msgs << "start place can not reach #{p.name}" unless rgl.path?(start_place.to_gid.to_s, p.to_gid.to_s)
106
+ msgs << "#{p.name} can not reach end_place" unless rgl.path?(p.to_gid.to_s, end_place.to_gid.to_s)
107
+ end
108
+
109
+ transitions.each do |t|
110
+ msgs << "start place can not reach #{t.name}" unless rgl.path?(start_place.to_gid.to_s, t.to_gid.to_s)
111
+ msgs << "#{t.name} can not reach end_place" unless rgl.path?(t.to_gid.to_s, end_place.to_gid.to_s)
112
+ end
113
+ end
114
+
88
115
  if msgs.present?
89
116
  update_columns(is_valid: false, error_msg: msgs.join("\n"))
90
117
  else
@@ -93,8 +120,8 @@ module Wf
93
120
  end
94
121
 
95
122
  def to_graph(wf_case = nil)
96
- fontfamily = 'system, -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, Segoe UI Symbol'
97
- fontfamily_monospace = 'SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace'
123
+ fontfamily = "system, -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, Segoe UI Symbol"
124
+ fontfamily_monospace = "SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace"
98
125
  graph = GraphViz.new(name, type: :digraph, rankdir: "LR", splines: true, ratio: :auto)
99
126
  free_token_places = if wf_case
100
127
  wf_case.tokens.free.map(&:place_id)
@@ -104,16 +131,16 @@ module Wf
104
131
  pg_mapping = {}
105
132
  places.order("place_type ASC").each do |p|
106
133
  if p.start?
107
- fillcolor = '#ffe7ba'
108
- textcolor = '#fa8c16'
134
+ fillcolor = "#ffe7ba"
135
+ textcolor = "#fa8c16"
109
136
  shape = :doublecircle
110
137
  elsif p.end?
111
- fillcolor = '#dff2ef'
112
- textcolor = '#29c0b1'
138
+ fillcolor = "#dff2ef"
139
+ textcolor = "#29c0b1"
113
140
  shape = :doublecircle
114
141
  else
115
- fillcolor = '#fbdbe1'
116
- textcolor = '#ff3366'
142
+ fillcolor = "#fbdbe1"
143
+ textcolor = "#ff3366"
117
144
  shape = :circle
118
145
  end
119
146
 
@@ -144,9 +171,9 @@ module Wf
144
171
 
145
172
  tg_mapping = {}
146
173
  transitions.each do |t|
147
- tg = graph.add_nodes(t.name, label: t.name, shape: :box, style: :filled, fillcolor: "#d6ddfa", color: '#d6ddfa',
148
- fontcolor: '#2c50ed', fontname: fontfamily,
149
- href: Wf::Engine.routes.url_helpers.edit_workflow_transition_path(self, t))
174
+ tg = graph.add_nodes(t.name, label: t.name, shape: :box, style: :filled, fillcolor: "#d6ddfa", color: "#d6ddfa",
175
+ fontcolor: "#2c50ed", fontname: fontfamily,
176
+ href: Wf::Engine.routes.url_helpers.edit_workflow_transition_path(self, t))
150
177
  tg_mapping[t] = tg
151
178
  end
152
179
 
@@ -166,8 +193,8 @@ module Wf
166
193
  labelfontcolor: :red,
167
194
  arrowhead: :vee,
168
195
  fontsize: 10,
169
- color: '#53585c',
170
- fontcolor: '#53585c',
196
+ color: "#53585c",
197
+ fontcolor: "#53585c",
171
198
  fontname: fontfamily_monospace,
172
199
  href: Wf::Engine.routes.url_helpers.edit_workflow_arc_path(self, arc)
173
200
  )
@@ -181,8 +208,8 @@ module Wf
181
208
  labelfontcolor: :red,
182
209
  arrowhead: :vee,
183
210
  fontsize: 10,
184
- color: '#53585c',
185
- fontcolor: '#53585c',
211
+ color: "#53585c",
212
+ fontcolor: "#53585c",
186
213
  fontname: fontfamily_monospace,
187
214
  href: Wf::Engine.routes.url_helpers.edit_workflow_arc_path(self, arc)
188
215
  )
@@ -197,5 +224,25 @@ module Wf
197
224
  graph.output(svg: path)
198
225
  File.read(path)
199
226
  end
227
+
228
+ def to_rgl
229
+ graph = RGL::DirectedAdjacencyGraph.new
230
+ places.order("place_type ASC").each do |p|
231
+ graph.add_vertex(p.to_gid.to_s)
232
+ end
233
+
234
+ transitions.each do |t|
235
+ graph.add_vertex(t.to_gid.to_s)
236
+ end
237
+
238
+ arcs.order("direction desc").each do |arc|
239
+ if arc.in?
240
+ graph.add_edge(arc.place.to_gid.to_s, arc.transition.to_gid.to_s)
241
+ else
242
+ graph.add_edge(arc.transition.to_gid.to_s, arc.place.to_gid.to_s)
243
+ end
244
+ end
245
+ graph
246
+ end
200
247
  end
201
248
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  # == Schema Information
4
3
  #
5
4
  # Table name: wf_workitems
@@ -8,8 +7,6 @@
8
7
  # case_id :integer
9
8
  # workflow_id :integer
10
9
  # transition_id :integer
11
- # targetable_type :string
12
- # targetable_id :string
13
10
  # state :integer default("0")
14
11
  # enabled_at :datetime
15
12
  # started_at :datetime
@@ -28,12 +25,11 @@ module Wf
28
25
  belongs_to :workflow
29
26
  belongs_to :transition
30
27
  belongs_to :case
31
- belongs_to :targetable, optional: true
32
28
  belongs_to :holding_user, foreign_key: :holding_user_id, class_name: Workflow.user_class.to_s, optional: true
33
29
  has_many :workitem_assignments
34
30
  has_many :parties, through: :workitem_assignments, source: "party"
35
31
  has_many :comments
36
- has_many :entries
32
+ has_many :entries, class_name: Wf::Workflow.entry_class.to_s
37
33
 
38
34
  enum state: {
39
35
  enabled: 0,
@@ -18,7 +18,7 @@
18
18
 
19
19
  <div class="form-group">
20
20
  <%= f.label :fieldable, class: "label" %>
21
- <%= f.select :fieldable, options_for_select(@arc.transition.form&.fields&.map {|x| [x.name, x.to_global_id]} || []), {}, class: "form-control custom-select", placeholder: "fieldable" %>
21
+ <%= f.select :fieldable, options_for_select(@arc.transition.form&.fields&.map {|x| [x.name, x.to_global_id]} || [], selected: f.object&.fieldable&.to_global_id), {}, class: "form-control custom-select", placeholder: "fieldable" %>
22
22
  </div>
23
23
 
24
24
  <div class="form-group">
@@ -42,8 +42,8 @@
42
42
  </div>
43
43
 
44
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" %>
45
+ <%= f.label :form, class: "label" %>
46
+ <%= f.select :form, options_for_select(Wf::Workflow.form_class.constantize.all.map{|x| [x.name, x.to_global_id]} || [], selected: f.object&.form&.to_global_id), {include_blank: 'user can input from custom form?'}, class: "form-control custom-select", placeholder: "Form" %>
47
47
  </div>
48
48
 
49
49
  <div class="form-group">
@@ -25,7 +25,11 @@
25
25
  <td><%= link_to workflow.name, workflow_path(workflow) %></td>
26
26
  <td><%= workflow.description %></td>
27
27
  <td><%= workflow.is_valid? %></td>
28
- <td><%= workflow.error_msg %></td>
28
+ <td>
29
+ <pre>
30
+ <%= workflow.error_msg %>
31
+ </pre>
32
+ </td>
29
33
  <td class="text-right">
30
34
  <%= link_to 'Delete Workflow', workflow_path(workflow), remote: true, method: :delete, data: {confirm: 'confirm?'}, class: 'btn btn-link btn-sm text-danger' %>
31
35
  <%= link_to 'Create Transition', new_workflow_transition_path(workflow), class: 'btn btn-link btn-sm' %>
@@ -31,7 +31,11 @@
31
31
 
32
32
  <tr>
33
33
  <th scope="row">Error Msg</th>
34
- <td><%= @workflow.error_msg %></td>
34
+ <td>
35
+ <pre>
36
+ <%= @workflow.error_msg %>
37
+ </pre>
38
+ </td>
35
39
  </tr>
36
40
  </tbody>
37
41
  </table>
@@ -21,7 +21,11 @@
21
21
  <% @workitem.transition.form.fields.each do |field| %>
22
22
  <div class="form-group">
23
23
  <%= ff.label field.name, class: "label" %>
24
- <%= ff.text_field field.id, class: "form-control" %>
24
+ <% if field.array? %>
25
+ <%= ff.select field.id, {}, {}, multiple: true, class: "form-control select2" %>
26
+ <% else %>
27
+ <%= ff.send(field.field_type_for_view, field.id, class: "form-control") %>
28
+ <% end %>
25
29
  </div>
26
30
  <% end %>
27
31
  <% end %>
@@ -30,4 +34,14 @@
30
34
  <div class="form-group">
31
35
  <%= f.submit class: "btn btn-primary", value: "Done", data: {disable_with: 'Waiting...'} %>
32
36
  </div>
33
- <% end %>
37
+ <% end %>
38
+
39
+ <script>
40
+ $(function() {
41
+ $(".select2").select2({
42
+ tags: [],
43
+ theme: "bootstrap4",
44
+ tokenSeparators: [',', ' ']
45
+ });
46
+ });
47
+ </script>
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoveTargetableFromWorkitem < ActiveRecord::Migration[6.0]
4
+ def change
5
+ remove_column :wf_workitems, :targetable_id
6
+ remove_column :wf_workitems, :targetable_type
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddFormable < ActiveRecord::Migration[6.0]
4
+ def change
5
+ add_column :wf_transitions, :form_type, :string, default: "Wf::Form"
6
+ add_index :wf_transitions, %i[form_type form_id]
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddFormIdForEntry < ActiveRecord::Migration[6.0]
4
+ def change
5
+ add_column :wf_entries, :form_id, :bigint, index: true
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoveWorkflowIdFromFormRelated < ActiveRecord::Migration[6.0]
4
+ def change
5
+ remove_column :wf_field_values, :transition_id
6
+ remove_column :wf_field_values, :workflow_id
7
+ end
8
+ end
data/lib/wf/engine.rb CHANGED
@@ -22,3 +22,10 @@ require "kaminari"
22
22
  require "simple_command"
23
23
  require "loaf"
24
24
  require "graphviz"
25
+ require "rgl/adjacency"
26
+ require "rgl/dijkstra"
27
+ require "rgl/topsort"
28
+ require "rgl/traversal"
29
+ require "rgl/path"
30
+ require "active_record/connection_adapters/postgresql_adapter.rb"
31
+ require "select2-rails"
data/lib/wf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wf
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: petri_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hooopo Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-08 00:00:00.000000000 Z
11
+ date: 2020-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pg
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +114,20 @@ dependencies:
100
114
  - - ">="
101
115
  - !ruby/object:Gem::Version
102
116
  version: 6.0.2.1
117
+ - !ruby/object:Gem::Dependency
118
+ name: rgl
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
103
131
  - !ruby/object:Gem::Dependency
104
132
  name: ruby-graphviz
105
133
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +142,20 @@ dependencies:
114
142
  - - ">="
115
143
  - !ruby/object:Gem::Version
116
144
  version: '0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: select2-rails-2020
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ type: :runtime
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
117
159
  - !ruby/object:Gem::Dependency
118
160
  name: simple_command
119
161
  requirement: !ruby/object:Gem::Requirement
@@ -209,6 +251,7 @@ files:
209
251
  - app/models/wf/case_command/clear_manual_assignments.rb
210
252
  - app/models/wf/case_command/clear_workitem_assignments.rb
211
253
  - app/models/wf/case_command/consume_token.rb
254
+ - app/models/wf/case_command/create_entry.rb
212
255
  - app/models/wf/case_command/enable_transitions.rb
213
256
  - app/models/wf/case_command/end_workitem_action.rb
214
257
  - app/models/wf/case_command/finish_workitem.rb
@@ -290,6 +333,10 @@ files:
290
333
  - db/migrate/20200130201641_init_some_data.rb
291
334
  - db/migrate/20200131200455_create_wf_entries.rb
292
335
  - db/migrate/20200201001543_add_target_field_name_for_guard.rb
336
+ - db/migrate/20200212120019_remove_targetable_from_workitem.rb
337
+ - db/migrate/20200213085258_add_formable.rb
338
+ - db/migrate/20200213125753_add_form_id_for_entry.rb
339
+ - db/migrate/20200213130900_remove_workflow_id_from_form_related.rb
293
340
  - lib/tasks/wf_tasks.rake
294
341
  - lib/wf.rb
295
342
  - lib/wf/engine.rb