meta_workflows 0.9.37 → 0.9.38

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 433a263b250c70c90cd887a326cc977dbf0397e63adf3beb5faaa602adcaabb8
4
- data.tar.gz: 68ae06cc925af8e09a7e1dcc0834882024efc216ff22aa45243fed536edaf5e1
3
+ metadata.gz: 41f8a51dc4bdc5ddf3b513a034d0a4481c8eef5227505510247121f829473770
4
+ data.tar.gz: d6399530d4ee920b1a9fbeace966de4bf67418701d05ed43f08db427682b81e1
5
5
  SHA512:
6
- metadata.gz: adfed074c3bc236c12083a139ee83276ac5b4095e32306f1dd3d60df9a596804831b7c6dcb840915f85f0cdf7f616678e917b6e9c189a3567ba42d17bd98d5dd
7
- data.tar.gz: 25799968079b725ef741e18a532deb60bace07355d633958c540af0c2b73bc3e64fd8e529d88f5237e8e37a48bf390159457e345097fde546060f8ea06cdff6f
6
+ metadata.gz: 86871631d147b96b6fec2f0c3b7a653ca559ad788eb313595c29e5f5c3599df8e30536cc6f764038ba414e4f62dcf35b70f91d438149bedf23584ec71e8e33f5
7
+ data.tar.gz: 1dbc0eefb31c16c734a9b3208ca5fabe6996a17eca99997e0d64da16ebc0c5e4c581009a1428b9bae5d3f564acd4e4ad772cfea87440710b9a1d05e270648811
@@ -20,6 +20,7 @@ module MetaWorkflows
20
20
  end
21
21
 
22
22
  def current_step_repetitions
23
+ # TODO: we should be albe to refactor this into a model method that does this internally
23
24
  @workflow_execution.step_repetitions(@workflow_execution.current_step)
24
25
  end
25
26
 
@@ -5,69 +5,6 @@ module MetaWorkflows
5
5
  include MetaWorkflows::FrameIdHelper
6
6
  include MetaWorkflows::PartialPathsHelper
7
7
  include MetaWorkflows::UiStateHelper
8
-
9
- def current_step_has_repetitions?(workflow_execution)
10
- workflow_execution.step_repetitions(workflow_execution.current_step).present?
11
- end
12
-
13
- def show_next_button?(workflow_execution)
14
- return false if current_step_has_repetitions?(workflow_execution)
15
-
16
- workflow_execution.step_advanceable?(workflow_execution.current_step)
17
- end
18
-
19
- def show_skip_button?(workflow_execution)
20
- return false if current_step_has_repetitions?(workflow_execution)
21
-
22
- workflow_execution.step_skippable?(workflow_execution.current_step)
23
- end
24
-
25
- def default_step_progress
26
- ['Thinking']
27
- end
28
-
29
- def show_structured_input?(local_assigns, structured_input_config)
30
- current_step = local_assigns[:current_step]
31
-
32
- (structured_input_config.present? && !local_assigns[:initial_load]) ||
33
- (local_assigns[:initial_load] && !current_step&.initial_execution?)
34
- end
35
-
36
- def current_step_and_config(active_execution, step_structured_input_config)
37
- if active_execution.present?
38
- [
39
- active_execution.workflow_steps.order(:step).last,
40
- step_structured_input_config
41
- ]
42
- else
43
- [nil, {}]
44
- end
45
- end
46
-
47
- # Consolidates all data fetching for the Lexi chat tray using service object
48
- def lexi_chat_data(record)
49
- LexiChatDataService.new(record).call
50
- end
51
-
52
- def structured_form_url(workflow_execution)
53
- workflow_execution ? meta_workflows.structured_human_path(workflow_execution.id) : '#'
54
- end
55
-
56
- def structured_chat_id(local_assigns)
57
- local_assigns[:chat_id] || local_assigns[:current_step]&.chat&.id
58
- end
59
-
60
- # Common locals for lexi chat input area
61
- def lexi_chat_input_locals(record, chat_data, wrapper_class)
62
- {
63
- record: record,
64
- workflow_execution: chat_data[:active_execution],
65
- current_step: chat_data[:current_step],
66
- structured_input_config: chat_data[:structured_input_config],
67
- chat_id: chat_data[:active_chat]&.id,
68
- is_structured_input: chat_data[:is_structured_input],
69
- wrapper_class: wrapper_class
70
- }
71
- end
8
+ include MetaWorkflows::WorkflowDataHelper
72
9
  end
73
10
  end
@@ -49,5 +49,9 @@ module MetaWorkflows
49
49
  def meta_lexi_chat_input_area
50
50
  'meta_workflows/lexi_chat_input_area'
51
51
  end
52
+
53
+ def structured_form_url(workflow_execution)
54
+ workflow_execution ? meta_workflows.structured_human_path(workflow_execution.id) : '#'
55
+ end
52
56
  end
53
57
  end
@@ -34,5 +34,30 @@ module MetaWorkflows
34
34
  def default_step_progress
35
35
  ['Thinking']
36
36
  end
37
+
38
+ def show_next_button?(workflow_execution)
39
+ return false if current_step_has_repetitions?(workflow_execution)
40
+
41
+ workflow_execution.step_advanceable?(workflow_execution.current_step)
42
+ end
43
+
44
+ def show_skip_button?(workflow_execution)
45
+ return false if current_step_has_repetitions?(workflow_execution)
46
+
47
+ workflow_execution.step_skippable?(workflow_execution.current_step)
48
+ end
49
+
50
+ def show_structured_input?(local_assigns, structured_input_config)
51
+ current_step = local_assigns[:current_step]
52
+
53
+ (structured_input_config.present? && !local_assigns[:initial_load]) ||
54
+ (local_assigns[:initial_load] && !current_step&.initial_execution?)
55
+ end
56
+
57
+ private
58
+
59
+ def current_step_has_repetitions?(workflow_execution)
60
+ workflow_execution.step_repetitions(workflow_execution.current_step).present?
61
+ end
37
62
  end
38
63
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MetaWorkflows
4
+ module WorkflowDataHelper
5
+ def current_step_and_config(active_execution, step_structured_input_config)
6
+ if active_execution.present?
7
+ [
8
+ active_execution.workflow_steps.order(:step).last,
9
+ step_structured_input_config
10
+ ]
11
+ else
12
+ [nil, {}]
13
+ end
14
+ end
15
+
16
+ def structured_chat_id(local_assigns)
17
+ local_assigns[:chat_id] || local_assigns[:current_step]&.chat&.id
18
+ end
19
+
20
+ # Consolidates all data fetching for the Lexi chat tray using service object
21
+ def lexi_chat_data(record)
22
+ LexiChatDataService.new(record).call
23
+ end
24
+
25
+ # Common locals for lexi chat input area
26
+ def lexi_chat_input_locals(record, chat_data, wrapper_class)
27
+ {
28
+ record: record,
29
+ workflow_execution: chat_data[:active_execution],
30
+ current_step: chat_data[:current_step],
31
+ structured_input_config: chat_data[:structured_input_config],
32
+ chat_id: chat_data[:active_chat]&.id,
33
+ is_structured_input: chat_data[:is_structured_input],
34
+ wrapper_class: wrapper_class
35
+ }
36
+ end
37
+ end
38
+ end
@@ -3,7 +3,7 @@
3
3
  module MetaWorkflows
4
4
  MAJOR = 0
5
5
  MINOR = 9
6
- PATCH = 37 # this is automatically incremented by the build process
6
+ PATCH = 38 # this is automatically incremented by the build process
7
7
 
8
8
  VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_workflows
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.37
4
+ version: 0.9.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Medovyy
@@ -147,6 +147,7 @@ files:
147
147
  - app/helpers/meta_workflows/partial_paths_helper.rb
148
148
  - app/helpers/meta_workflows/status_badge_helper.rb
149
149
  - app/helpers/meta_workflows/ui_state_helper.rb
150
+ - app/helpers/meta_workflows/workflow_data_helper.rb
150
151
  - app/jobs/meta_workflows/application_job.rb
151
152
  - app/jobs/meta_workflows/concerns/error_handling.rb
152
153
  - app/jobs/meta_workflows/concerns/workflow_params_mergeable.rb