easy_flow 0.49.0 → 0.50.0

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/easy_flow/canvas.js +3 -1
  3. data/app/controllers/concerns/easy_flow/manage/draws_canvas.rb +4 -3
  4. data/app/controllers/easy_flow/manage/canvas_controller.rb +11 -2
  5. data/app/javascript/easy_flow/canvas/Canvas.jsx +34 -55
  6. data/app/javascript/easy_flow/canvas/Control.jsx +3 -2
  7. data/app/javascript/easy_flow/canvas/Inspector.jsx +2 -1
  8. data/app/javascript/easy_flow/canvas/flowSender.js +12 -2
  9. data/app/javascript/easy_flow/canvas/reading.js +33 -18
  10. data/app/javascript/easy_flow/canvas/topBar.js +8 -0
  11. data/app/models/easy_flow/all_or_any.rb +2 -0
  12. data/app/models/easy_flow/canvas.rb +21 -2
  13. data/app/models/easy_flow/compare.rb +9 -0
  14. data/app/models/easy_flow/compare_two_values.rb +13 -0
  15. data/app/models/easy_flow/condition.rb +1 -0
  16. data/app/models/easy_flow/count.rb +8 -0
  17. data/app/models/easy_flow/data_step.rb +1 -0
  18. data/app/models/easy_flow/document.rb +1 -0
  19. data/app/models/easy_flow/draft_status.rb +11 -2
  20. data/app/models/easy_flow/flow_step.rb +6 -0
  21. data/app/models/easy_flow/play_flows.rb +1 -0
  22. data/app/models/easy_flow/settings.rb +46 -6
  23. data/app/models/easy_flow/steps/checklist.rb +1 -0
  24. data/app/models/easy_flow/steps/file_upload.rb +1 -0
  25. data/app/models/easy_flow/steps/fill_in_the_blank.rb +1 -0
  26. data/app/models/easy_flow/steps/multiple_select.rb +1 -0
  27. data/app/models/easy_flow/steps/question.rb +5 -0
  28. data/app/models/easy_flow/switch.rb +2 -0
  29. data/app/models/easy_flow/wait.rb +8 -0
  30. data/app/views/easy_flow/manage/flows/_top_bar.html.erb +2 -2
  31. data/lib/easy_flow/engine.rb +1 -3
  32. data/lib/easy_flow/host.rb +12 -0
  33. data/lib/easy_flow/version.rb +1 -1
  34. data/the_local/agents/easy_flow-develop.md +4 -4
  35. data/the_local/agents/easy_flow-info.md +5 -3
  36. data/the_local/agents/easy_flow-install.md +3 -2
  37. metadata +22 -1
@@ -1,37 +1,52 @@
1
1
  const byPlace = (a, b) => a.row - b.row || a.column - b.column
2
2
 
3
+ const holdersOf = (nodes) => new Map(nodes.flatMap((group) => (group.holds || []).map((id) => [ id, group.id ])))
4
+
3
5
  export const readingOrder = (nodes) => {
4
6
  const placed = [ ...nodes ].sort(byPlace)
5
- const held = placed.filter((node) => nodes.some((group) => group.holds?.includes(node.id)))
7
+ const holders = holdersOf(nodes)
8
+ const held = new Map(nodes.filter((node) => node.holds).map((group) => [ group.id, [] ]))
9
+ placed.filter((node) => holders.has(node.id)).forEach((node) => held.get(holders.get(node.id)).push(node))
6
10
 
7
- return placed.filter((node) => !held.includes(node))
8
- .flatMap((node) => [ node, ...held.filter((step) => node.holds?.includes(step.id)) ])
11
+ return placed.filter((node) => !holders.has(node.id)).flatMap((node) => [ node, ...(held.get(node.id) || []) ])
9
12
  }
10
13
 
11
14
  export const blocksOf = (nodes) => {
15
+ const holders = holdersOf(nodes)
12
16
  const ordered = readingOrder(nodes)
13
- const held = (step) => ordered.some((group) => group.holds?.includes(step.id))
14
-
15
- return ordered.filter((node) => !held(node)).reduce((blocks, node) => {
16
- if (node.holds) return [ ...blocks, { group: node, steps: ordered.filter((step) => node.holds.includes(step.id)) } ]
17
+ const blocks = []
18
+ const boxes = new Map()
17
19
 
20
+ ordered.filter((node) => !holders.has(node.id)).forEach((node) => {
18
21
  const last = blocks[blocks.length - 1]
19
- if (last && !last.group) return [ ...blocks.slice(0, -1), { steps: [ ...last.steps, node ] } ]
20
- return [ ...blocks, { steps: [ node ] } ]
21
- }, [])
22
+ if (node.holds) boxes.set(node.id, blocks[blocks.push({ group: node, steps: [] }) - 1])
23
+ else if (last && !last.group) last.steps.push(node)
24
+ else blocks.push({ steps: [ node ] })
25
+ })
26
+ ordered.filter((node) => holders.has(node.id)).forEach((node) => boxes.get(holders.get(node.id))?.steps.push(node))
27
+
28
+ return blocks
22
29
  }
23
30
 
24
- const nextAfter = (ordered, node) => ordered[ordered.findIndex((step) => step.id === node.id) + 1]?.id
31
+ const nameOf = (step) => (step?.placeholder ? "nowhere yet" : step?.label)
25
32
 
26
- export const branchesOf = (node, edges, nodes) => {
27
- const next = nextAfter(readingOrder(nodes), node)
33
+ const joins = new WeakMap()
28
34
 
29
- return edges.filter((edge) => edge.source === node.id && (edge.label || edge.target !== next))
35
+ const joinsOf = (edges) => {
36
+ if (!joins.has(edges)) joins.set(edges, new Map([ ...edges ].reverse().map((edge) => [ `${edge.source}\n${edge.target}`, edge ])))
37
+ return joins.get(edges)
30
38
  }
31
39
 
32
- const nameOf = (step) => (step?.placeholder ? "nowhere yet" : step?.label)
40
+ export const joining = (edges, before, after) => joinsOf(edges).get(`${before.id}\n${after.id}`)
41
+
42
+ export const branchLinesOf = (steps, edges, nodes) => {
43
+ const ordered = readingOrder(steps)
44
+ const next = new Map(ordered.map((step, at) => [ step.id, ordered[at + 1]?.id ]))
45
+ const names = new Map(nodes.map((node) => [ node.id, nameOf(node) ]))
46
+ const lines = Object.fromEntries(steps.map((step) => [ step.id, [] ]))
33
47
 
34
- export const branchLine = (edge, nodes) =>
35
- [ edge.label, "→", nameOf(nodes.find((node) => node.id === edge.target)) ].filter(Boolean).join(" ")
48
+ edges.filter((edge) => lines[edge.source] && (edge.label || edge.target !== next.get(edge.source)))
49
+ .forEach((edge) => lines[edge.source].push([ edge.label, "→", names.get(edge.target) ].filter(Boolean).join(" ")))
36
50
 
37
- export const joining = (edges, before, after) => edges.find((edge) => edge.source === before.id && edge.target === after.id)
51
+ return lines
52
+ }
@@ -0,0 +1,8 @@
1
+ export const barPressed = ({ send, onPress }) => (event) => {
2
+ const button = event.target.closest?.("[data-bar-action]")
3
+ if (!button) return
4
+
5
+ button.closest("details")?.removeAttribute("open")
6
+ onPress()
7
+ if (button.dataset.barPath) send(button.dataset.barPath, "POST")
8
+ }
@@ -16,6 +16,8 @@ module EasyFlow
16
16
 
17
17
  output :result, type: :boolean, values: [ true, false ]
18
18
 
19
+ summarizes_by { |node| Array(node.config["comparisons"]).size.then { |count| "#{node.config["join"]} #{count} #{"comparison".pluralize(count)}" } }
20
+
19
21
  def route(node, state, times)
20
22
  comparisons = Array(node.config["comparisons"])
21
23
  return false if comparisons.empty?
@@ -20,11 +20,26 @@ module EasyFlow
20
20
  end
21
21
 
22
22
  def drawn_step(node)
23
- { "id" => node.id, "type" => node.type, "type_name" => step_type_for(node)&.step_name, "label" => label_for(node), "summary" => step_type_for(node)&.summary_of(node), "details" => step_type_for(node)&.details_of(node).to_a, "links" => step_type_for(node)&.links_of(node).to_a,
23
+ { "id" => node.id, "type" => node.type, "type_name" => step_type_for(node)&.step_name, "label" => label_for(node), "summary" => summary_of(node), "details" => drawn_by_type(node, :details_of).to_a, "links" => drawn_by_type(node, :links_of).to_a,
24
24
  "config" => node.config.merge(kept_values(node)), "ports" => [], "ends_here" => ends_here?(node), "begins_here" => begins_here?(node),
25
25
  "starts_a_flow" => starts_a_flow?(node), "holds" => holds(node), "opens" => opens(node), "loose" => loose?(node), "choices" => choices_for(node), "record_choices" => record_choices_for(node), "placeholder" => false, "picture_url" => picture_url(node), **placed[node.id] }
26
26
  end
27
27
 
28
+ def summary_of(node)
29
+ drawn_safely(node, :summary_of) { (@host&.summarizes?(node.type) ? @host : step_type_for(node))&.summary_of(node) }
30
+ end
31
+
32
+ def drawn_by_type(node, part)
33
+ drawn_safely(node, part) { step_type_for(node)&.public_send(part, node) }
34
+ end
35
+
36
+ def drawn_safely(node, part)
37
+ yield
38
+ rescue StandardError => error
39
+ Rails.logger.error("EasyFlow could not draw step #{node.id}'s #{part}: #{error.class}: #{error.message}")
40
+ nil
41
+ end
42
+
28
43
  def picture_url(node)
29
44
  EasyFlow.picture_url(node.config["picture"]) if node.config["picture"].present?
30
45
  end
@@ -164,7 +179,11 @@ module EasyFlow
164
179
 
165
180
  def choices_for(node)
166
181
  naming_steps(node).index_with { earlier_than(node) }.merge(naming_flows(node).index_with { offered_flows })
167
- .merge(drawn_by(node)).merge(named_outputs_by(node))
182
+ .merge(drawn_by(node)).merge(named_outputs_by(node)).merge(worked_out_choices(node))
183
+ end
184
+
185
+ def worked_out_choices(node)
186
+ drawn_safely(node, :options) { step_type_for(node)&.settings&.worked_out_choices(node.config) }.to_h.transform_keys(&:to_s)
168
187
  end
169
188
 
170
189
  def record_choices_for(node)
@@ -13,6 +13,15 @@ module EasyFlow
13
13
 
14
14
  output :result, type: :boolean, values: [ true, false ]
15
15
 
16
+ summarizes_by { |node| [ node.config.values_at("step", "output").compact_blank.join("."), node.config["comparison"], Compare.amount_of(node.config["amount"]) ].compact_blank.join(" ") }
17
+
18
+ def self.amount_of(value)
19
+ number = Float(value.to_s, exception: false)
20
+ return value if number.nil?
21
+
22
+ number == number.round ? number.to_i.to_s : number.to_s
23
+ end
24
+
16
25
  def route(node, state, times)
17
26
  number = Float(CompletedAt.value_of(state, times, *node.config.values_at("step", "output")).to_s, exception: false)
18
27
  return false if number.nil?
@@ -15,6 +15,19 @@ module EasyFlow
15
15
 
16
16
  output :result, type: :boolean, values: [ true, false ]
17
17
 
18
+ summarizes_by { |node| CompareTwoValues.summarized(node.config) }
19
+
20
+ def self.summarized(config)
21
+ [ config.values_at("step", "output").compact_blank.join("."), config["comparison"], compared_with(config) ].compact_blank.join(" ")
22
+ end
23
+
24
+ def self.compared_with(config)
25
+ amount = Compare.amount_of(config["amount"])
26
+ return amount if config["other_step"].blank?
27
+
28
+ [ config.values_at("other_step", "other_output").compact_blank.join("."), ("+ #{amount}" if amount.present?) ].compact.join(" ")
29
+ end
30
+
18
31
  def route(node, state, times)
19
32
  first = number(CompletedAt.value_of(state, times, *node.config.values_at("step", "output")))
20
33
  second = node.config["other_step"].present? ? number(CompletedAt.value_of(state, times, *node.config.values_at("other_step", "other_output"))) : 0.0
@@ -12,6 +12,7 @@ module EasyFlow
12
12
  output :result, type: :boolean, values: [ true, false ]
13
13
 
14
14
  names_by { |node| node.config.values_at("step", "comparison", "answer").compact_blank.join(" ").presence }
15
+ summarizes_by { |node| [ node.config.values_at("step", "output").compact_blank.join("."), *node.config.values_at("comparison", "answer") ].compact_blank.join(" ") }
15
16
 
16
17
  def route(node, state)
17
18
  answer = state[node.config["step"]]
@@ -11,6 +11,14 @@ module EasyFlow
11
11
  output :count, type: :integer
12
12
 
13
13
  names_by { |node| [ "Count", *node.config.values_at("step", "answer") ].compact_blank.join(" ") }
14
+ summarizes_by { |node| Count.summarized(node.config) }
15
+
16
+ def self.summarized(config)
17
+ return if config["step"].blank?
18
+
19
+ counted = config.values_at("step", "output").compact_blank.join(".")
20
+ config["answer"].blank? ? "counts every answer to #{counted}" : "counts #{counted} is #{config["answer"]}"
21
+ end
14
22
 
15
23
  def process(node, state)
16
24
  visits(node, state).count { |answer| counted?(node, answer) }
@@ -9,6 +9,7 @@ module EasyFlow
9
9
 
10
10
  setting(:values, type: :list, label: "Values it reports") { setting :name, type: :string, required: true }
11
11
  outputs_named_by :values
12
+ summarizes_by { |node| Array(node.config["values"]).filter_map { |value| value["name"].presence }.then { |names| "reports #{names.join(", ")}" if names.any? } }
12
13
 
13
14
  output :result, values: %w[passed failed]
14
15
  output :reason
@@ -99,6 +99,7 @@ module EasyFlow
99
99
 
100
100
  def group(id, into:)
101
101
  raise InvalidEdit, "#{into} cannot hold steps" if into && (into == id || !holds_steps?(node(into)))
102
+ raise InvalidEdit, "#{id} is a group step and cannot go inside another group step" if into && holds_steps?(node(id))
102
103
 
103
104
  regrouped = released(id).map do |node|
104
105
  node["id"] == into ? node.merge("holds" => Array(node["holds"]) + [ id ]) : node
@@ -9,15 +9,24 @@ module EasyFlow
9
9
  end
10
10
 
11
11
  def publishes
12
- return @flow.current_definition_version.number if @flow.current_definition_version && @flow.versioned?
12
+ return version.number if version && @flow.document == version.definition
13
13
 
14
14
  @flow.definition_versions.maximum(:number).to_i + 1
15
15
  end
16
16
 
17
+ def number
18
+ version&.number
19
+ end
20
+
17
21
  private
18
22
 
23
+ def version
24
+ return @version if defined?(@version)
25
+
26
+ @version = @flow.current_definition_version
27
+ end
28
+
19
29
  def based_on
20
- version = @flow.current_definition_version
21
30
  version ? "draft from v#{version.number}" : "new draft"
22
31
  end
23
32
 
@@ -14,6 +14,12 @@ module EasyFlow
14
14
  waits_until { |_node, _state| false }
15
15
 
16
16
  names_by { |node| ChosenFlow.of(node).name }
17
+ summarizes_by { |node| FlowStep.steps_in(node)&.then { |count| "#{count} #{"step".pluralize(count)}" } }
18
+
19
+ def self.steps_in(node)
20
+ version = ChosenFlow.of(node).version
21
+ Array(version.definition.to_h["nodes"]).count { |step| %w[start terminal].exclude?(step["type"]) } if version
22
+ end
17
23
 
18
24
  def self.endings_of(node)
19
25
  version = ChosenFlow.of(node).version
@@ -8,6 +8,7 @@ module EasyFlow
8
8
  setting :flows, type: :flows, required: true
9
9
 
10
10
  names_by :question
11
+ summarizes_by { |node| Array(node.config["flows"]).size.then { |count| "offers #{count} #{"flow".pluralize(count)}" } }
11
12
  awaits_input
12
13
 
13
14
  plays_the_picked_flow
@@ -1,5 +1,14 @@
1
1
  module EasyFlow
2
2
  class Settings
3
+ class OptionsUnavailable < StandardError
4
+ attr_reader :setting
5
+
6
+ def initialize(setting, cause)
7
+ @setting = setting
8
+ super("#{setting} options could not be worked out: #{cause.class}: #{cause.message}")
9
+ end
10
+ end
11
+
3
12
  attr_reader :fields, :labels, :explanations, :record_fields, :record_labels, :record_explanations, :record_choices, :record_outputs_of, :record_required, :drawn_from, :outputs_of
4
13
 
5
14
  def initialize(fields: {}, labels: {}, explanations: {}, record_fields: {}, record_labels: {}, record_explanations: {}, record_choices: {}, record_outputs_of: {}, record_required: {}, choices: {},
@@ -24,7 +33,30 @@ module EasyFlow
24
33
  end
25
34
 
26
35
  def choices
27
- @choices.transform_values { |offered| offered.respond_to?(:call) ? offered.call : offered }
36
+ @choices.transform_values { |offered| depends_on_settings?(offered) ? [] : worked_out(offered) }
37
+ end
38
+
39
+ def choices_for(config)
40
+ choices.merge(worked_out_choices(config))
41
+ end
42
+
43
+ def worked_out_choices(config)
44
+ @choices.select { |_name, offered| depends_on_settings?(offered) }.to_h do |name, offered|
45
+ [ name, offered.call(config.to_h) ]
46
+ rescue StandardError => error
47
+ raise OptionsUnavailable.new(labels[name], error)
48
+ end
49
+ end
50
+
51
+ def strays(config)
52
+ worked_out_choices(config).filter_map do |name, offered|
53
+ chosen = config.to_h[name.to_s]
54
+ name.to_s if chosen.present? && values_of(offered).exclude?(chosen)
55
+ end
56
+ end
57
+
58
+ def cleared(config)
59
+ config.to_h.merge(strays(config).index_with(nil))
28
60
  end
29
61
 
30
62
  def kept_values(config)
@@ -66,17 +98,25 @@ module EasyFlow
66
98
  end
67
99
 
68
100
  def objections(config)
69
- config.to_h.flat_map { |name, value| objections_to(name.to_sym, value) }.compact
101
+ offered = choices_for(config)
102
+ config.to_h.flat_map { |name, value| objections_to(name.to_sym, value, offered) }.compact
70
103
  end
71
104
 
72
105
  private
73
106
 
74
- def objections_to(name, value)
75
- [ unoffered(name, value), over_limit(name, value), refused(name, value) ]
107
+ def worked_out(offered)
108
+ offered.respond_to?(:call) ? offered.call : offered
109
+ end
110
+
111
+ def depends_on_settings?(offered)
112
+ offered.respond_to?(:arity) && offered.arity == 1
113
+ end
114
+
115
+ def objections_to(name, value, offered)
116
+ [ unoffered(name, value, offered[name]), over_limit(name, value), refused(name, value) ]
76
117
  end
77
118
 
78
- def unoffered(name, value)
79
- offered = choices[name]
119
+ def unoffered(name, value, offered)
80
120
  return unless offered
81
121
 
82
122
  stray = Array(value).find { |chosen| values_of(offered).exclude?(chosen) }
@@ -14,6 +14,7 @@ module EasyFlow
14
14
  end
15
15
 
16
16
  names_by :question
17
+ summarizes_by { |node| Question.summarized(node.config) }
17
18
  awaits_input
18
19
  drawn_by "easy_flow/steps/ticking"
19
20
  answer_check { |node, value| "Tick at least one to go on." if node.config["required"] && Array(value).compact_blank.empty? }
@@ -12,6 +12,7 @@ module EasyFlow
12
12
  setting :required, type: :boolean
13
13
 
14
14
  names_by :question
15
+ summarizes_by { |node| FileUpload.accepted_extensions(node).then { |extensions| "accepts #{extensions.join(", ")}" if extensions.any? } }
15
16
  awaits_input
16
17
  drawn_by "easy_flow/steps/uploading"
17
18
  answer_check { |node, value| FileUpload.problem_with(node, value) }
@@ -20,6 +20,7 @@ module EasyFlow
20
20
  end
21
21
 
22
22
  names_by :question
23
+ summarizes_by { |node| Array(node.config["accepted_answers"]).size.then { |count| "accepts #{count} #{"answer".pluralize(count)}" } }
23
24
  awaits_input
24
25
  drawn_by "easy_flow/steps/typing"
25
26
  answer_check { |node, value| "Type an answer to go on." if node.config["required"] && value.blank? }
@@ -16,6 +16,7 @@ module EasyFlow
16
16
  end
17
17
 
18
18
  names_by :question
19
+ summarizes_by { |node| Question.summarized(node.config) }
19
20
  awaits_input
20
21
  drawn_by "easy_flow/steps/ticking"
21
22
  answer_check { |node, value| "Pick at least one answer to go on." if node.config["required"] && Array(value).compact_blank.empty? }
@@ -20,6 +20,7 @@ module EasyFlow
20
20
  output :answer, type: :string, label: "Answer", values: ->(node) { Question.offered(node.config) }
21
21
 
22
22
  names_by :question
23
+ summarizes_by { |node| Question.summarized(node.config) }
23
24
  awaits_input
24
25
  answer_check { |node, value| "Fill this in to go on." if node.config["required"] && value.blank? }
25
26
 
@@ -29,6 +30,10 @@ module EasyFlow
29
30
  step.to_h["question"] || step.to_h["text"]
30
31
  end
31
32
 
33
+ def self.summarized(step)
34
+ answers_of(step).size.then { |count| "#{count} #{"answer".pluralize(count)}" }
35
+ end
36
+
32
37
  def self.answers_of(step)
33
38
  Array(step.to_h["answers"] || step.to_h["options"])
34
39
  end
@@ -8,6 +8,8 @@ module EasyFlow
8
8
 
9
9
  output :choice, type: :string, label: "Choice", from: :step
10
10
 
11
+ summarizes_by { |node| "branches on #{node.config["step"]}" if node.config["step"].present? }
12
+
11
13
  def route(node, state)
12
14
  state[node.config["step"]]
13
15
  end
@@ -10,6 +10,7 @@ module EasyFlow
10
10
  setting :date, type: :string, label: "Date, as YYYY-MM-DD"
11
11
 
12
12
  names_by { |node| Wait.named(node.config) }
13
+ summarizes_by { |node| Wait.summarized(node.config) }
13
14
 
14
15
  waits_until { |node, _state, times| Wait.held_until(node, times)&.then { |held| held <= Time.current } || false }
15
16
 
@@ -20,6 +21,13 @@ module EasyFlow
20
21
  "#{waited} after #{config["step"]}" if waited
21
22
  end
22
23
 
24
+ def self.summarized(config)
25
+ until_then = config["date"].presence || config["time_of_day"].presence
26
+ return "waits until #{until_then}" if until_then
27
+
28
+ "waits #{config["minutes"]} #{"minute".pluralize(config["minutes"].to_i)}" if config["minutes"].present?
29
+ end
30
+
23
31
  def self.held_until(node, times)
24
32
  from = times[node.config["step"]]
25
33
  return Time.zone.parse(node.config["date"]) if node.config["date"].present?
@@ -28,8 +28,8 @@
28
28
  <% actions << { label: "Try it", href: flow_routes.manage_flow_preview_path(flow) } %>
29
29
  <% flow_host.editor_buttons_for(flow).each { |button| actions << { label: button.label, href: button.address } } %>
30
30
  <% if showing == :canvas %>
31
- <% actions << { label: "Save draft", data: { bar_action: "save_draft" } } %>
32
- <% actions << { label: "Publish v#{EasyFlow::DraftStatus.new(flow).publishes}", data: { bar_action: "publish" }, primary: true } %>
31
+ <% actions << { label: "Save draft", data: { bar_action: "save_draft", bar_path: "/versions" } } %>
32
+ <% actions << { label: "Publish v#{EasyFlow::DraftStatus.new(flow).publishes}", data: { bar_action: "publish", bar_path: "/publish" }, primary: true } %>
33
33
  <% end %>
34
34
 
35
35
  <div class="ml-auto hidden flex-wrap items-center gap-2 sm:flex">
@@ -1,3 +1,4 @@
1
+ require "keystone_ui"
1
2
  require "keystone_ui-react"
2
3
 
3
4
  module EasyFlow
@@ -5,9 +6,6 @@ module EasyFlow
5
6
  isolate_namespace EasyFlow
6
7
 
7
8
  initializer "easy_flow.tailwind" do
8
- next unless Gem.loaded_specs.key?("keystone_ui")
9
-
10
- require "keystone_ui"
11
9
  KeystoneUi.configuration.tailwind_sources << root.join("app/views/**/*.erb").to_s
12
10
  KeystoneUi.configuration.tailwind_sources << root.join("app/javascript/**/*.{js,jsx}").to_s
13
11
  KeystoneUi.configuration.tailwind_sources << root.join("app/assets/builds/easy_flow/*.js").to_s
@@ -85,6 +85,18 @@ module EasyFlow
85
85
  @step_groups || {}
86
86
  end
87
87
 
88
+ def summaries=(summaries)
89
+ @summaries = summaries.to_h.transform_keys(&:to_s)
90
+ end
91
+
92
+ def summarizes?(step_type)
93
+ @summaries.to_h.key?(step_type.to_s)
94
+ end
95
+
96
+ def summary_of(node)
97
+ @summaries.to_h[node.type.to_s]&.call(node).presence
98
+ end
99
+
88
100
  def explanation_for(step_type, setting)
89
101
  @setting_explanations.to_h.dig(step_type.to_s, setting.to_s).presence
90
102
  end
@@ -1,3 +1,3 @@
1
1
  module EasyFlow
2
- VERSION = "0.49.0"
2
+ VERSION = "0.50.0"
3
3
  end
@@ -83,7 +83,7 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
83
83
  4. Ask the developer which hosts' admins should be able to add the type. A registered type is in a host's palette, the step types an admin can add on that host's canvas, only when the host names no list of offered step types or its list includes the type's id. A type that declares `ends_here` is in every host's palette, and a type that declares `begins_here` is in none. When a host that names a list should offer the new type, add the type's id to that host's list through `easy_flow-install`. Leaving a type off a host's list only keeps admins from adding it there, and a step of that type already in one of the host's flows is still drawn and run, and still opens with all its settings and can be saved.
84
84
  5. Use these words to declare the type. Each is called once at class level (or inside the `EasyFlow.step` block):
85
85
  - `step_name "<label>"` — the name admins see on the canvas. Defaults to the id.
86
- - `setting :name, type:, label:, explanation:, options:, required:, optional:, limit:, check:, from:, outputs_of:, kept_on:, attribute:` — a field the admin fills in on the canvas. `type` is one of `:string`, `:integer`, `:float`, `:boolean`, `:select`, `:multi_select`, `:radio_cards`, `:previous_step`, `:from_step`, `:list`, `:flow`, or boot raises `EasyFlow::UnknownFieldType`. A `:select`, `:multi_select` or `:radio_cards` must pass `options:`, or boot raises the same error. A `:radio_cards` setting is drawn in the step's settings as one keystone radio card per option, side by side with each card taking an equal share of the row, and one card per row when the panel is too narrow; its `options:` are hashes `{ value:, label:, hint: }`, as a fixed array or a lambda that works them out from the app's records (`options: -> { Release.aliases.map { |release| { value: release.alias, label: "#{release.alias} → #{release.version}", hint: release.stats_line } } }`), the chosen card's `value` is stored in `node.config`, and a saved value that is not one of the options' values is refused. `options:` is either an array of strings, or a lambda taking no arguments that returns one; the lambda is called each time the canvas is opened and each time an admin saves the step's settings, so the options follow the app's data without a restart (`options: -> { Region.order(:name).pluck(:code) }`). A saved setting whose value is no longer among the options is refused the next time the admin saves that step. When the options come from the app's records, ask the developer which records, which column is stored as the value, and whether the list must differ by account or host, since the lambda is passed nothing and the same list is offered everywhere the type is used. A `:list` must take a block of `setting` calls describing one entry. `:previous_step` lets the admin pick an earlier step, and is required unless declared with `optional: true`. Ask the developer whether a step of the type may be left without that earlier step, and when it may, declare `optional: true` and handle a blank value in the type's code. `outputs_of: :<setting>` offers the outputs of the step chosen in that setting, and `from: :<setting>` offers the values of the output chosen in that setting; either one makes the type `:from_step`. A required setting left blank shows a warning on the step's card that the step `needs a value for <label>`, and saving the flow as a new version and publishing it are refused until the admin fills it in. An `outputs_of:` setting left blank is flagged and refused the same way once the setting it reads names a step, whether or not it is declared `required:`. Inside a `:list` entry, a blank required setting, or a blank `outputs_of:` setting whose step is picked, shows `needs a value for <label> in <list label> entry <n>` for the entry at position `n` counting from 1. `optional:` has no effect inside a `:list` entry, where a `:previous_step` is required only when declared `required: true`. `:flow` lets the admin pick one of the flows the admin's list shows on the same host, offered by title, and is stored in `node.config` as that flow's id as a string. A `:flow` setting is not checked on save against the flows offered, so code that reads it looks the flow up through the host and handles a blank or unknown id. `limit:` is the most values a `:multi_select` takes. `check:` is a lambda given the value that returns an error message, or `nil` when the value is acceptable. `label:` defaults to the name humanized. `explanation:` is an optional sentence shown under the setting in the step's settings, inside a `:list` entry as well, and a setting with none shows nothing there. A host can replace it with its own through `setting_explanations`, set through `easy_flow-install`. `kept_on:` and `attribute:` keep the setting's value on one of the app's own records instead of in the flow; see "Keep a setting on one of the app's records".
86
+ - `setting :name, type:, label:, explanation:, options:, required:, optional:, limit:, check:, from:, outputs_of:, kept_on:, attribute:` — a field the admin fills in on the canvas. `type` is one of `:string`, `:integer`, `:float`, `:boolean`, `:select`, `:multi_select`, `:radio_cards`, `:previous_step`, `:from_step`, `:list`, `:flow`, or boot raises `EasyFlow::UnknownFieldType`. A `:select`, `:multi_select` or `:radio_cards` must pass `options:`, or boot raises the same error. A `:radio_cards` setting is drawn in the step's settings as one keystone radio card per option, side by side with each card taking an equal share of the row, and one card per row when the panel is too narrow; its `options:` are hashes `{ value:, label:, hint: }`, as a fixed array or a lambda that works them out from the app's records (`options: -> { Release.aliases.map { |release| { value: release.alias, label: "#{release.alias} → #{release.version}", hint: release.stats_line } } }`), the chosen card's `value` is stored in `node.config`, and a saved value that is not one of the options' values is refused. A `:radio_cards` lambda that takes one argument is given the step's settings as a hash and works out the cards from them, such as `options: ->(config) { Agent.find_by(name: config["agent"])&.aliases.to_a.map { |release| { value: release.alias, label: "#{release.alias} → #{release.version}", hint: release.stats_line } } }`, so an alias the chosen agent does not have gets no card. The canvas works the cards out again each time the admin saves the step, so they change as soon as the other setting is saved, without reloading the page. When a save leaves the chosen card no longer among them, the choice is cleared instead of refused, and the settings panel shows a notice such as "Cleared Alias because candidate is not offered for the step's other settings." When the lambda raises, the canvas still opens and the setting shows no cards, and the error is written to the app's log. When it raises while the admin saves the step, the error is written to the log and the save is refused, and the settings panel says the setting "could not be worked out, so the change was not saved." The palette offers no cards for such a setting, since it has no step's settings to work them out from. `options:` is either an array of strings, or a lambda taking no arguments that returns one; the lambda is called each time the canvas is opened and each time an admin saves the step's settings, so the options follow the app's data without a restart (`options: -> { Region.order(:name).pluck(:code) }`). A saved setting whose value is no longer among the options is refused the next time the admin saves that step. When the options come from the app's records, ask the developer which records, which column is stored as the value, and whether the list must differ by account or host, since the lambda is passed nothing and the same list is offered everywhere the type is used. A `:list` must take a block of `setting` calls describing one entry. `:previous_step` lets the admin pick an earlier step, and is required unless declared with `optional: true`. Ask the developer whether a step of the type may be left without that earlier step, and when it may, declare `optional: true` and handle a blank value in the type's code. `outputs_of: :<setting>` offers the outputs of the step chosen in that setting, and `from: :<setting>` offers the values of the output chosen in that setting; either one makes the type `:from_step`. A required setting left blank shows a warning on the step's card that the step `needs a value for <label>`, and saving the flow as a new version and publishing it are refused until the admin fills it in. An `outputs_of:` setting left blank is flagged and refused the same way once the setting it reads names a step, whether or not it is declared `required:`. Inside a `:list` entry, a blank required setting, or a blank `outputs_of:` setting whose step is picked, shows `needs a value for <label> in <list label> entry <n>` for the entry at position `n` counting from 1. `optional:` has no effect inside a `:list` entry, where a `:previous_step` is required only when declared `required: true`. `:flow` lets the admin pick one of the flows the admin's list shows on the same host, offered by title, and is stored in `node.config` as that flow's id as a string. A `:flow` setting is not checked on save against the flows offered, so code that reads it looks the flow up through the host and handles a blank or unknown id. `limit:` is the most values a `:multi_select` takes. `check:` is a lambda given the value that returns an error message, or `nil` when the value is acceptable. `label:` defaults to the name humanized. `explanation:` is an optional sentence shown under the setting in the step's settings, inside a `:list` entry as well, and a setting with none shows nothing there. A host can replace it with its own through `setting_explanations`, set through `easy_flow-install`. `kept_on:` and `attribute:` keep the setting's value on one of the app's own records instead of in the flow; see "Keep a setting on one of the app's records".
87
87
  - `output :name, type:, label:, values:, from:` — a value the step records. `type` is one of `:string`, `:integer`, `:float`, `:boolean`, or boot raises `EasyFlow::UnknownOutputType`. `values:` is an array or a lambda taking the node, listing the values the output can take; the canvas offers these as the connections leaving the step, so a type that routes must declare them. `from: :<setting>` takes the values from the step chosen in that setting. A Condition step requires the admin to pick one of the earlier step's outputs, so a type whose answer admins should test with a Condition declares at least one `output`, with `values:` so the Condition offers answers to pick.
88
88
  - `outputs_named_by :<list setting>` — adds one output for each entry an admin enters in that `:list` setting, named by the entry's `name`, so the setting's entry block must declare `setting :name, type: :string`. Ask the developer whether the admin or the type decides the names of the values the step records. Do not pick.
89
89
  - The named outputs follow any outputs the type declares with `output`, in the order the admin entered them. An entry with a blank `name` adds none.
@@ -105,11 +105,11 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
105
105
 
106
106
  Here `CheckResult.for` is the app's own lookup.
107
107
  - `names_by :setting` or `names_by { |node| ... }` — what the step is called on the canvas, from a setting or computed.
108
- - `summarizes_by { |node| ... }` — the one line the step's card shows under its name on the canvas, worked out from the step's settings, such as `summarizes_by { |node| "role: #{node.config['role']} · #{node.config['hours']}h" }`. Return a short phrase, or `nil` or `""` to show no line. Without it the card shows no summary, and a step with problems shows its error count in the summary's place. The block is called every time the canvas is drawn, so it must not be slow and must not change anything, and like `names_by` its `node.config` holds no kept setting. Ask the developer what an admin should read about a step of this type without opening it.
108
+ - `summarizes_by { |node| ... }` — the one line the step's card shows under its name on the canvas, worked out from the step's settings, such as `summarizes_by { |node| "role: #{node.config['role']} · #{node.config['hours']}h" }`. Return a short phrase, or `nil` or `""` to show no line. Without it the card shows no summary, and a step with problems shows its error count in the summary's place. easy_flow's own step types already give a summary, such as "tests.result is not passed" on a Condition step or "waits 5 minutes" on a Wait step, and a host replaces any type's summary, its own or easy_flow's, through the host's `summaries`, set through `easy_flow-install`. The block is called every time the canvas is drawn, so it must not be slow and must not change anything, and like `names_by` its `node.config` holds no kept setting. Ask the developer what an admin should read about a step of this type without opening it.
109
109
  - `shows_values(heading = nil, columns: false) { |node| ... }` — a read-only section of the step settings panel, shown under the step's editable settings. The block returns a hash of labels to values, such as `shows_values("Inputs") { |node| { "brief" => "load_brief.out.brief" } }`, and each value is shown as text in a monospace font. Without `columns:` each label sits beside its value with the labels in one column. With `columns: true` the pairs sit two to a row, each label above its value, such as `shows_values(columns: true) { |node| { "Timeout" => "90s", "Retry" => "3" } }`. Declare it several times for several sections, which are shown in the order declared. Nothing in a section can be edited from the panel.
110
110
  - `shows_code(heading = nil) { |node| ... }` — a read-only section of the step settings panel holding code blocks. The block returns a hash of summary lines to code, such as `shows_code("Schemas") { |node| { "input_schema" => node.config["input_schema"].to_s } }`. Each block is closed until its summary line is clicked, and a line wider than the panel scrolls sideways inside its block.
111
111
  - `links_to { |node| ... }` — buttons at the foot of the step settings panel, side by side above Delete step. The block returns a list of hashes each with a `label` and an `address`, such as `links_to { |node| [ { label: "Open agent", address: "/agents/#{node.config['agent']}" } ] }`. Each address is used as written.
112
- - The blocks of `shows_values`, `shows_code` and `links_to` are called every time the canvas is drawn, so they must not be slow and must not change anything. Ask the developer what an admin should read about a step of this type in its settings without being able to change it, and which pages it should link to.
112
+ - The blocks of `shows_values`, `shows_code` and `links_to` are called every time the canvas is drawn, so they must not be slow and must not change anything. When the block of `summarizes_by`, `shows_values`, `shows_code` or `links_to` raises an error, the canvas still opens, that step is drawn without the summary, sections or links that failed, and the error is written to the app's log. Ask the developer what an admin should read about a step of this type in its settings without being able to change it, and which pages it should link to.
113
113
  - `awaits_input` — the visitor is shown this step and submits an answer to it.
114
114
  - `waits_until { |node, state| ... }` or `waits_until { |node, state, times| ... }` — the run stops at this step until the block returns a truthy value. See step 8.
115
115
  - `answer_check { |node, value| ... }` — checks a submitted answer before it is recorded. `value` is the submitted string, an array of strings when the input submits several values, or `nil` or `""` when the input sent nothing. An array may hold blank strings. Return a message to refuse the answer, or `nil` to accept it. Without it every answer is accepted, including a blank one. For a file input, see step 7.
@@ -187,7 +187,7 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
187
187
  - `holds_steps` — a step of the type holds other steps of the same flow, such as a "for each" step. Ask the developer what the step should do with the steps it holds when a run reaches it. Do not pick, since the engine does nothing with them at run time.
188
188
  - On the canvas, a step of the type is drawn as a dashed box around the steps it holds, with a header line at its top in place of a step card. The header is the type's id followed by each filled-in setting as `<name>: <value>`, or `<name> <value>` for an `integer` or `float` setting, joined by ` · `, leaving out a blank setting and a setting whose value is a list or an array. On a host that hides step type codes, set through `easy_flow-install`, the header uses the type's `step_name` and each setting's label instead.
189
189
  - Clicking the header opens the step's settings. The header shows none of the error counts a step card shows, and has none of a card's buttons for starting a connection.
190
- - An admin puts a step in the box by dragging it onto the box, and takes it out by dragging it onto the canvas outside the box. A step is held by one group step at a time, a group step cannot hold itself, and a step cannot be moved into a step whose type does not declare `holds_steps`. Moving a step in or out leaves every connection as it was.
190
+ - An admin puts a step in the box by dragging it onto the box, and takes it out by dragging it onto the canvas outside the box. A step is held by one group step at a time, a group step cannot hold itself or be put inside another group step, and a step cannot be moved into a step whose type does not declare `holds_steps`. Moving a step in or out leaves every connection as it was.
191
191
  - The ids of the steps held are kept in the flow's document under `holds` on the group step, so `node.config["holds"]` is an array of step ids, in the order they were moved in, or is missing when no step was ever moved in. Read it with `Array(node.config["holds"])`. Removing a held step takes its id out of the list, and saving the group step's settings keeps the list as it was.
192
192
  - The type must not declare a setting named `holds`, since a value saved under that name is dropped.
193
193
  - A run follows connections only. A run reaching a step of a type that declares none of `awaits_input`, `process`, `route` or `waits_until` passes on along its connection, and the steps it holds run once, where their connections place them, like any other steps.
@@ -55,7 +55,7 @@ easy_flow declares no commands of its own for this local. Its surface is split b
55
55
  - **Display** — what a step type hands the visitor's page to draw a step, such as its question text and its answers. A step type may build its display from the step alone, or from the step and the visitor's stored run, so the same step can show something different to each visitor. There is no stored run in an admin's preview or in a flow that carries its answers in the page, and the display is then built without one. A host can draw a single-choice, multiple-select or fill-in-the-blank step with an answer already chosen by passing it as `chosen`, and the step is drawn blank when none is passed.
56
56
  - **Answer check** — a rule a step type may carry that looks at a visitor's answer and, when the answer is not acceptable, returns the message the visitor sees. A step type with no such rule accepts every answer.
57
57
  - **Setting** — one field an admin fills in when configuring a step on the canvas. A step type may give a setting a one-sentence explanation, which shows under it in the step's settings. It is text, a whole number, a decimal, a yes or no, a pick from a list, a pick from a few choices drawn as radio cards side by side with a hint under each, several picks from a list, an earlier step, an earlier step's output, another flow of the same host, or a list of entries that each hold their own fields. A setting can be required, limited to a number of picks, or checked by a rule the step type supplies.
58
- - **Options** — the values a pick-from-a-list setting offers, and for a radio card setting each value's label and hint. They are either a fixed list written into the step type, or a lookup the app provides that is read each time the canvas or a save asks for them, so they can come from the app's own data. A saved value that is not among the options is refused.
58
+ - **Options** — the values a pick-from-a-list setting offers, and for a radio card setting each value's label and hint. They are either a fixed list written into the step type, or a lookup the app provides that is read each time the canvas or a save asks for them, so they can come from the app's own data. A radio card setting's lookup may also be given the step's other settings, so its cards follow another setting, such as an agent's own aliases following the agent chosen. Its cards change as soon as the admin saves that other setting, without reloading the page. A saved value that is not among the options is refused, except that a radio card choice the step's other settings no longer offer is cleared on save, and the settings panel says it was cleared.
59
59
  - **Kept setting** — a setting whose value lives on one of the app's own records rather than in the flow. The step type says how to find that record from the step's other settings and which of its attributes holds the value. The canvas shows the value read from the record, and saving the step's settings writes it straight to the record, so the flow's document and its versions never hold it and undo or publishing does not change it. When no record is found, nothing is written. When the record refuses a value, the save is refused with the record's own error and none of the step's kept settings are written.
60
60
  - **Output** — a value a step records into the run, with a type and a label. Later steps read outputs, and a setting that points at an earlier step offers that step's known values on the canvas. A step type may also take further outputs from a list setting, one for each entry the admin gives a name, labelled with that name written as a phrase, such as "First reading" for `first_reading`. An entry left without a name adds no output. Those outputs are offered wherever the step's declared outputs are, such as when a Condition, Compare, Compare two values, All of or Any of or Count step picks which output to read.
61
61
  - **Chosen output** — which of an earlier step's outputs a step reads. Every built-in step that names an earlier step and then reads one of its outputs asks the admin to pick that output, as does a step type of the app's own whose output setting points at a step setting. Once the earlier step is named, a step with no output picked is reported as missing that setting, and the same holds for each comparison in an All of or Any of list, for its first step and for its second step. A step that names no earlier step, such as a Compare two values step with its second step left empty, is not asked for that step's output.
@@ -96,13 +96,13 @@ easy_flow declares no commands of its own for this local. Its surface is split b
96
96
  - **Waiting step** — a step whose type carries a rule saying whether what it waits for has happened, such as a payment clearing or a document being signed. A run that reaches it stops there, and the visitor sees "Waiting for" followed by the step's name, with no form to submit. Once the rule says it has happened, the run moves past the step the next time the visitor's page is loaded or the app moves the run on, and the step is recorded as `true`.
97
97
  - **Check again** — a button a visitor sees under the "Waiting for" line in a flow that carries its answers in the page. It loads the step page again with the answers and their completion times, so the run moves past a waiting step whose rule now says it has happened, such as a Wait step whose time has come. A stored run shows no such button, since loading its page again does the same.
98
98
  - **Group step** — a step whose type is declared as holding steps, such as an app's own "for each" step. The canvas draws it as a dashed box with a header line at the top and the steps it holds inside. The header line is the step type's code followed by each filled-in setting as `name: value`, or `name value` for a number setting, joined by ` · `. It sits right above the first step the box holds, and the connection from the group step to a step it holds is not drawn. A host that hides step type codes shows the type's name and the settings' labels instead. Clicking the header opens the step's settings, and a connection drawn into a group step ends at the top of its box.
99
- - **Holding a step** — an admin puts a step in a group step by dragging it onto the group's box, and takes it out by dragging it onto the canvas outside the box. Moving a step in or out changes only which steps the group holds and leaves every connection as it was. The group step lists the ids of the steps it holds under `holds` in the flow's document. Removing a step takes it out of the group that held it, and a step cannot be put in itself or in a step whose type does not hold steps. A run reaching a group step passes straight on along its connection, and the steps it holds run once like any other steps.
99
+ - **Holding a step** — an admin puts a step in a group step by dragging it onto the group's box, and takes it out by dragging it onto the canvas outside the box. Moving a step in or out changes only which steps the group holds and leaves every connection as it was. The group step lists the ids of the steps it holds under `holds` in the flow's document. Removing a step takes it out of the group that held it, and a step cannot be put in itself or in a step whose type does not hold steps, and a group step cannot be put in another group step. A run reaching a group step passes straight on along its connection, and the steps it holds run once like any other steps.
100
100
  - **Registry** — the list of step types the app has registered, alongside the built-in ones. A step whose type is not registered is not shown or run as that type, and its answers are not checked.
101
101
  - **Host** — a named part of the app that owns a set of flows. A host sets the visitor layout and the admin layout, how admins are authenticated, how visitors are authorized, how a refusal is answered, and optionally which step types it offers and which answers it allows a step in a run. Flows are always looked up through a host, so one host never sees another's flows.
102
102
  - **Offered step types** — the list of step types a host names for its admins to add. A host that names no list offers every registered step type. The list only narrows the palette.
103
103
  - **Allowed answers** — a rule a host may carry that looks at a step and the answers given so far in a run and names the answer values that step allows. When it names nothing for a step, the step offers every answer. When it names several, a question or checklist offers only those. When it names exactly one, the step records that answer without being shown, and when it names none, the step is passed over and records a blank answer. This holds in a stored run, a run moved on outside a visitor's request, a flow that carries its answers in the page, and an admin's preview. Going back skips the steps the host filled in and returns to the last step the visitor was shown.
104
104
  - **Always-visible insert buttons** — a setting a host may turn on, `always_show_insert_buttons`, that shows each connection's button for inserting a step on its canvas without the pointer over the connection, with the connection's label moved to the right of the line. It is off by default, and with it off the button shows only with the pointer over the connection.
105
- - **Step card** — the box that draws one step on the canvas. It shows the step's name, the one-line summary the step's type works out from its settings under the name when the type declares one, and the step's type code under those, or above the name on a left-to-right canvas. A step with problems is bordered in red and its card counts them under the name, such as "1 error" or "2 errors", in place of the summary, and the sentence for each problem is in the Validation tab of the drawer under the canvas rather than on the card.
105
+ - **Step card** — the box that draws one step on the canvas. It shows the step's name, the one-line summary the step's type works out from its settings under the name when the type declares one or the host replaces it, and the step's type code under those, or above the name on a left-to-right canvas. A step with problems is bordered in red and its card counts them under the name, such as "1 error" or "2 errors", in place of the summary, and the sentence for each problem is in the Validation tab of the drawer under the canvas rather than on the card.
106
106
  - **Hidden step type codes** — a setting a host may turn on, `hide_step_type_codes`, that hides step type code names on its canvas. The add menu lists each step type by its name alone, and a step's box shows its step type's name in place of the code name, with a step that has no name of its own headed by its step type's name. It is off by default, and with it off the add menu and step boxes show the code names. The settings panel shows a step's id and code name either way.
107
107
  - **Canvas direction** — a setting a host may set, `canvas_direction`, to `:left_to_right` to lay its canvas out left to right in place of top to bottom. Steps sit as compact cards in rows joined by short lines, a row that reaches the edge of the canvas goes on in a new row, each branch or loop that leads anywhere but the step beside it is written on its step's card with the step it leads to, a group step's box takes a row of its own, and a phone-width screen shows one step per row. Top to bottom is the default.
108
108
  - **Step list** — a list beside the editing canvas, on screens 640 pixels and wider, of every step type the host offers, with a search field that keeps only the types whose name holds what was typed. A host may set `step_groups`, a hash of headings each with the step types listed under it, in the host's order, and the types it puts in no group are listed above the first heading. Clicking a type adds the step unconnected, as the add menu does, and dragging a type onto a connection inserts the step on that connection. On a phone the list is hidden and the add menu is the way to add steps.
@@ -112,6 +112,8 @@ easy_flow declares no commands of its own for this local. Its surface is split b
112
112
  - **Top bar** — the bar across the top of the canvas and of the definition text page. From left to right it shows the back link, the flow's name, the draft's status, such as `draft from v14 · unsaved 2 changes` or `new draft · unsaved 0 changes` for a flow with no version yet, and a Canvas / Text switch between the canvas and the definition text. On the canvas its buttons are `This flow`, `Try it`, the host's editor buttons, `Save draft` and a `Publish` button naming the version it will create, such as `Publish v15`. `Save draft` creates a version as the panel's Create version does, and both open the flow panel with the result. The status and the Publish label follow each change made on the canvas. The definition text page's bar shows `Try it` and the host's editor buttons, and the page keeps its own Save button. On a screen narrower than 640 pixels the back link, name, status and switch wrap onto more lines, and the buttons are reached from an actions menu in the bar.
113
113
  - **Editor buttons** — a setting a host may set, `editor_buttons`, holding a list of buttons each with a label and an address, or a callable that takes the flow being shown and returns that list, whose buttons the top bar shows before `Save draft`, such as Run tests and Dry-run. The app decides what each address does. With none set, the bar shows no extra buttons.
114
114
  - **On publish** — a setting a host may set, `on_publish`, holding a callable that takes a flow. easy_flow calls it each time a new version of one of that host's flows goes live, from the canvas's Publish button or from the app calling publish. Publishing a version that is already live does not call it. With none set, nothing is called.
115
+ - **Built-in summaries** — the summary line easy_flow's own step types give their cards. A Question, Checklist or Multiple select step shows how many answers it offers, such as "3 answers", and a Fill in the blank step how many answers it accepts. A File upload step shows the file types it accepts. A Condition, Compare or Compare two values step shows the comparison it makes, such as "tests.result is not passed". An All of or Any of step shows which must hold and how many comparisons it has, such as "all of 2 comparisons". A Count step shows what it counts, a Switch step the step it branches on, and a Read data or Write data step the values it reports. A Wait step shows how long it waits, such as "waits 5 minutes" or "waits until 09:00". A Flow step shows how many steps the version it runs holds, and a Play flows step how many flows it offers. Start and End steps show none.
116
+ - **Host summaries** — a setting a host may set, `summaries`, giving its own summary block for any step type, including easy_flow's own. Its line shows on the card in place of the step type's own, and a block that returns nothing shows no line. A block that raises is drawn without a summary, the error is written to the log, and the flow still opens.
115
117
  - **Host setting explanations** — a setting a host may set, `setting_explanations`, giving its own explanation for one setting of one step type, including a setting inside a list. It shows in place of the step type's own. A setting it gives none for shows the step type's own, and with none set nothing changes.
116
118
  - **Flow panel** — the panel the top bar's `This flow`, `Save draft` and `Publish` buttons open on the canvas, on every host. It shows Create version and Publish, the message saying what the last of them did or why it was refused, and the list of changes since the last version. Several saves to the same step in a row show as one line in the changes list, named by the step's latest name. A save, a move and any other change each keep their own line, and the history of versions still lists every change a version captured.
117
119
  - **Drawer** — the panel under the editing canvas, on every host, with a row of tabs. Its first tab is Validation, followed by the number of problems the flow has when it has any. Validation lists one row per check: an `error` row for each problem with the step's id and a sentence naming the step by its name, or by its step type's name when it has none, and saying what to do to clear it, then an `ok` row for each check that found nothing. Clicking a row that names a step selects that step and opens its settings. A host may set `drawer_tabs` to add its own tabs after Validation, each with a label, an optional count such as `12/12` and its own content. On a phone the drawer shows only its tabs until one is tapped, an open drawer covers the canvas, and tapping the open tab again closes it.