easy_flow 0.32.1 → 0.34.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/easy_flow/canvas.js +1 -1
  3. data/app/controllers/concerns/easy_flow/manage/draws_canvas.rb +5 -2
  4. data/app/controllers/easy_flow/flows_controller.rb +3 -0
  5. data/app/controllers/easy_flow/manage/canvas_controller.rb +26 -12
  6. data/app/controllers/easy_flow/manage/flows_controller.rb +1 -0
  7. data/app/javascript/easy_flow/canvas/Canvas.jsx +15 -8
  8. data/app/javascript/easy_flow/canvas/Connector.jsx +5 -5
  9. data/app/javascript/easy_flow/canvas/ConnectorLayer.jsx +3 -3
  10. data/app/javascript/easy_flow/canvas/Panel.jsx +19 -4
  11. data/app/javascript/easy_flow/canvas/StepCard.jsx +15 -4
  12. data/app/javascript/easy_flow/canvas/TypePicker.jsx +2 -2
  13. data/app/javascript/easy_flow/canvas/changes.js +6 -0
  14. data/app/javascript/easy_flow/canvas/flowSender.js +10 -1
  15. data/app/javascript/easy_flow/canvas/useFlow.js +3 -2
  16. data/app/models/easy_flow/canvas.rb +23 -13
  17. data/app/models/easy_flow/change.rb +11 -1
  18. data/app/models/easy_flow/data_step.rb +33 -0
  19. data/app/models/easy_flow/definition.rb +5 -0
  20. data/app/models/easy_flow/document.rb +11 -0
  21. data/app/models/easy_flow/inputs.rb +24 -0
  22. data/app/models/easy_flow/progress/kept.rb +4 -0
  23. data/app/models/easy_flow/progress/loose.rb +4 -0
  24. data/app/models/easy_flow/read_data.rb +11 -0
  25. data/app/models/easy_flow/runner.rb +9 -1
  26. data/app/models/easy_flow/step_type/declaration.rb +5 -1
  27. data/app/models/easy_flow/step_type.rb +3 -2
  28. data/app/models/easy_flow/unconnected_steps.rb +44 -0
  29. data/app/models/easy_flow/write_data.rb +11 -0
  30. data/app/views/easy_flow/flows/refused.html.erb +3 -0
  31. data/app/views/easy_flow/manage/flows/show.html.erb +5 -1
  32. data/lib/easy_flow/engine.rb +2 -0
  33. data/lib/easy_flow/host.rb +17 -3
  34. data/lib/easy_flow/version.rb +1 -1
  35. data/lib/easy_flow.rb +1 -1
  36. data/the_local/agents/easy_flow-develop.md +30 -3
  37. data/the_local/agents/easy_flow-info.md +11 -1
  38. data/the_local/agents/easy_flow-install.md +23 -5
  39. data/the_local/interface.yml +6 -0
  40. metadata +7 -1
@@ -20,6 +20,7 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
20
20
  - `EasyFlow.draws_with` — the partial that draws a visitor's step when the step's type names none. Defaults to the engine's own `easy_flow/steps/choosing`.
21
21
  - `EasyFlow.file_store` — the object that keeps a file a visitor uploads at a File upload step and names it again later. Defaults to none, and with none set an uploaded file is refused with `EasyFlow::NoFileStore`.
22
22
  - `EasyFlow.picture_store` — the object that keeps a picture an admin adds to a question step on the canvas, for the flow it belongs to, and gives the address the picture is loaded from. Defaults to none, and with none set an admin who chooses a picture is told pictures cannot be added yet.
23
+ - `EasyFlow.data_source` — the object that says what Read data and Write data steps can read and write, and carries each one out. Defaults to none, and with none set those steps offer no choices.
23
24
  - `EasyFlow.check` — turns on an optional flow check: `:unrouted_value`, `:unfollowed_path` or `:dead_end`.
24
25
  - `/manage/flows` — the admin pages, under each mount path, where flows are listed, created, drawn on the canvas, previewed and published.
25
26
 
@@ -46,7 +47,7 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
46
47
  host.visitor_authorization_method = :easy_flow_visitor_permitted?
47
48
  host.refusal_method = :refuse_flow
48
49
  host.owner_method = :current_account
49
- host.offers = %i[question checklist multiple_select fill_in_the_blank file_upload condition switch compare compare_two_values all_or_any count wait flow_step]
50
+ host.offers = %i[question checklist multiple_select fill_in_the_blank file_upload condition switch compare compare_two_values all_or_any count read_data write_data wait flow_step]
50
51
  end
51
52
  ```
52
53
 
@@ -57,6 +58,10 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
57
58
  - `refusal_method` — a method on the base controller, called with the refusal error when a visitor is refused or a flow is unpublished or withdrawn. With none set, the response is `404 Not Found`.
58
59
  - `owner_method` — a method on the base controller, called with no arguments, returning the record whose flows the current request works with, such as the signed-in account. When set, the admin pages list, create and edit only that record's flows, a visitor runs only that record's flows, and two records may each hold a flow with the same slug. With none set, every flow in the host is shared by everyone who reaches it. Ask the developer whether each host's flows belong to one record or are shared.
59
60
  - `offers` — the step types this host's admins can add from the canvas palette, as a list of step type names. With none set, every registered step type is offered. The engine's own names are `question`, `checklist`, `multiple_select`, `fill_in_the_blank`, `file_upload`, `condition`, `switch`, `compare`, `compare_two_values`, `all_or_any`, `count`, `wait`, `flow_step` and `play_flows`, `file_upload` being the File upload step, which needs the file store from step 10, `compare_two_values` being the Compare two values step, which compares the outputs of two earlier steps, `all_or_any` being the All of or Any of step, which decides whether all or any of several such comparisons hold, `count` being the Count step, which counts how often an earlier step was answered, `wait` being the Wait step, which holds a run until a time counted from an earlier answer or until a date, `flow_step` being the Flow step, which names one of the same host's flows, and `play_flows` being the Play flows step, which lists several of the same host's flows for a visitor to play in the order they choose. A step type the app declares is named by the id it was declared with, or after its class when it is a step class, so `Steps::Notify` is `notify`. The End step is offered whether it is listed or not, and the Start step is never offered. Ask the developer which step types each host should offer.
61
+ - `always_show_insert_buttons` — set to `true` to show each connection's button for inserting a step on this host's canvas without the pointer over the connection. A connection's label then sits to the right of the line so the button does not cover it. With none set, the button shows only with the pointer over the connection.
62
+ - `hide_step_type_codes` — set to `true` to hide step type code names on this host's canvas. The add menu then 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 none set, the add menu and step boxes show the code names. The settings panel shows a step's id and code name either way.
63
+ - `publish_note` — a sentence shown directly under the Publish button in this host's flow panel. It is shown as plain text. With none set, the panel shows no note.
64
+ - `back_link` — a hash with a `label` and an `address`, such as `{ label: "Games", address: "/admin/games" }`, that shows a button with that label and address in this host's builder header in place of `All flows`. The header then has no `All flows` button. A hash missing either key raises `ArgumentError` when the host is declared, and a blank value is not refused. The address is used as written and is not checked, so it comes from the app's own configuration and never from a request. With none set, the header shows `All flows`.
60
65
 
61
66
  Each method named here must exist on the base controller. Ask the developer to point at it or write it. Do not invent its logic.
62
67
  8. Mount the engine in `config/routes.rb`, once per host. The host name in `defaults` must match a name declared in step 7. When there is more than one mount, give each an `as:` name:
@@ -100,14 +105,26 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
100
105
  - The store answers `url_of(reference)`, called with a reference `keep` returned. It returns the address a page loads the picture from.
101
106
  - The store refuses a file it will not keep, such as one that is not an image or is too large, by raising `EasyFlow::PictureRefused` with the message the admin should see. The canvas shows that message and leaves the step's picture as it was.
102
107
  - With no store set, an admin who chooses a picture on the canvas is told "Pictures cannot be added yet. Ask the app's developer to set up a picture store." and the step is left unchanged.
103
- 11. Leave `EasyFlow.check` out unless the developer asks for it. The engine already turns on `:unrouted_value`, `:unfollowed_path` and `:dead_end` at boot. Any other name raises `EasyFlow::UnknownCheck` when the app boots.
104
- 12. Check that the app loads Active Job (`require "rails/all"` or `require "active_job/railtie"` in `config/application.rb`) and has a queue adapter that runs jobs from the `default` queue. When a run started by a Flow step, or by a step type of the app's own that starts another flow, ends, the engine records its output in the run it was started from and queues a job on `default` that moves that run on. If no adapter runs that queue, the run that holds the step stays at it until its visitor next loads its page. If `config.active_job.queue_adapter` is not set for an environment, ask the developer which adapter to use there.
105
- 13. Check `config.time_zone` in `config/application.rb`. A Wait step's time of day and date, and the "Hour completed" and "Weekday completed" outputs every completed step offers, are read in that zone, and with none set it is UTC. If it is not set, ask the developer which zone the app's admins mean when they write a time.
106
- 14. Start the server and open `<mount path>/manage/flows` for each host.
108
+ 11. Ask the developer whether any host will offer the Read data or Write data step, and if so, what a flow may read and write and how the app carries each one out. Set the object that answers in the initializer:
109
+
110
+ ```ruby
111
+ EasyFlow.data_source = FlowData.new
112
+ ```
113
+
114
+ - The object answers `reads`, a list of strings naming what a flow can read.
115
+ - The object answers `writes`, a list of strings naming what a flow can write.
116
+ - The object answers `carry_out(name, values)`, called with one of those names and a hash of the step's input values, with string keys as the admin named them. What it returns is the step's answer. What it raises is the step's failure.
117
+ - A step whose name is no longer on its list records a failure and does not call `carry_out`.
118
+ - Read data and Write data need a flow that keeps every answer as it is given. In a flow that keeps nothing or keeps the run only once it finishes, the visitor is told "Data can only be read or written in a flow that saves its runs." when the run reaches the step and cannot go on, and the app is not called.
119
+ 12. Leave `EasyFlow.check` out unless the developer asks for it. The engine already turns on `:unrouted_value`, `:unfollowed_path` and `:dead_end` at boot. Any other name raises `EasyFlow::UnknownCheck` when the app boots.
120
+ 13. Check that the app loads Active Job (`require "rails/all"` or `require "active_job/railtie"` in `config/application.rb`) and has a queue adapter that runs jobs from the `default` queue. When a run started by a Flow step, or by a step type of the app's own that starts another flow, ends, the engine records its output in the run it was started from and queues a job on `default` that moves that run on. If no adapter runs that queue, the run that holds the step stays at it until its visitor next loads its page. If `config.active_job.queue_adapter` is not set for an environment, ask the developer which adapter to use there.
121
+ 14. Check `config.time_zone` in `config/application.rb`. A Wait step's time of day and date, and the "Hour completed" and "Weekday completed" outputs every completed step offers, are read in that zone, and with none set it is UTC. If it is not set, ask the developer which zone the app's admins mean when they write a time.
122
+ 15. Start the server and open `<mount path>/manage/flows` for each host.
107
123
 
108
124
  ## Conventions
109
125
 
110
126
  - After install, check that `<mount path>/manage/flows` shows the flow list and that a new flow opens on the canvas. If the canvas is blank, check that the admin layout calls `yield :head`.
127
+ - After install, add a step to a flow without connecting it and press Publish. Check that the flow panel names the step, that Cancel changes nothing, and that accepting publishes the flow without it and the history shows `Removed unconnected` with its name.
111
128
  - After publishing a flow, check that `<mount path>/<slug>` shows it to a visitor who passes the host's visitor authorization method.
112
129
  - After publishing a flow with a question or a checklist whose answer has info text, check that the visitor's page shows an info button on that answer. If it does not, compare the app's `keystone_ui` version with the one in step 2.
113
130
  - After install, check that an End step selected on the canvas shows an output setting. An admin fills it in on each End step, and it needs no migration and no setting in the initializer.
@@ -145,6 +162,7 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
145
162
  - After filling in a Wait step, check its name on the canvas. With a date set it is named by the date alone, and the run waits until that date. Otherwise, with a time of day set, it is named by that time followed by "after" and the step it counts from, and the run waits until that time of day first comes after the step was answered. Otherwise it is named by the minutes, as "1 minute after" or "<n> minutes after" followed by the step it counts from, and the run waits that many minutes past the answer. With none of the three set it has no name of its own, and a visitor held at it sees "Waiting for Wait."
146
163
  - The engine queues no job for a Wait step. After publishing a flow with a Wait step, check that a visitor held at it sees "Waiting for" followed by the step's name, and that a stored run moves on when the visitor's page is loaded after its time has come. Moving a run on with no visitor present belongs to the `easy_flow-develop` local.
147
164
  - After publishing a flow with a Wait step whose "What this keeps of a run" detail is "Nothing" or "The whole run once it finishes", check that a visitor held at it sees a "Check again" button, and that pressing it after the time has come carries their answers and completion times forward and moves them past the Wait step.
165
+ - After setting `EasyFlow.data_source`, check that a Read data step on the canvas offers the object's `reads` and a Write data step offers its `writes`. Publish a flow set to save each step, connect each step's `passed` and `failed` connections, and check a run follows `passed` when `carry_out` answers and `failed` when it raises.
148
166
  - After setting `EasyFlow.file_store`, publish a flow with a File upload step whose "What this keeps of a run" detail is "Every answer as it is given", upload a file as a visitor, and check that the completion page shows the name the store gives it.
149
167
  - A File upload step takes a file only in a flow that keeps every answer as it is given. In a flow that keeps nothing or keeps the run only once it finishes, the visitor is told "A file can only be uploaded in a flow that saves its runs." and cannot go on with a file chosen.
150
168
  - A File upload step's "Accepted file types" setting is a comma-separated list of extensions, such as `.pdf, .png`. A file of another kind is refused with a message naming the accepted kinds and is never passed to the file store.
@@ -8,6 +8,7 @@ install:
8
8
  - EasyFlow.draws_with
9
9
  - EasyFlow.file_store
10
10
  - EasyFlow.picture_store
11
+ - EasyFlow.data_source
11
12
  - EasyFlow.check
12
13
  - /manage/flows
13
14
 
@@ -16,6 +17,7 @@ develop:
16
17
  - EasyFlow.step
17
18
  - labels_answer_by
18
19
  - outputs_named_by
20
+ - EasyFlow::Inputs
19
21
  - host.allowed_answers=
20
22
  - EasyFlow::FlowsController
21
23
  - hosted_by
@@ -48,6 +50,10 @@ sources:
48
50
  - app/models/easy_flow/count.rb
49
51
  - app/models/easy_flow/compare_two_values.rb
50
52
  - app/models/easy_flow/all_or_any.rb
53
+ - app/models/easy_flow/read_data.rb
54
+ - app/models/easy_flow/write_data.rb
55
+ - app/models/easy_flow/data_step.rb
56
+ - app/models/easy_flow/inputs.rb
51
57
  - app/models/easy_flow/wait.rb
52
58
  - app/models/easy_flow/completed_at.rb
53
59
  - app/models/easy_flow/step_type.rb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.1
4
+ version: 0.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider
@@ -112,6 +112,7 @@ files:
112
112
  - app/models/easy_flow/completed_at.rb
113
113
  - app/models/easy_flow/condition.rb
114
114
  - app/models/easy_flow/count.rb
115
+ - app/models/easy_flow/data_step.rb
115
116
  - app/models/easy_flow/definition.rb
116
117
  - app/models/easy_flow/digest.rb
117
118
  - app/models/easy_flow/document.rb
@@ -119,6 +120,7 @@ files:
119
120
  - app/models/easy_flow/edge.rb
120
121
  - app/models/easy_flow/edit_history.rb
121
122
  - app/models/easy_flow/flow_step.rb
123
+ - app/models/easy_flow/inputs.rb
122
124
  - app/models/easy_flow/layout.rb
123
125
  - app/models/easy_flow/name.rb
124
126
  - app/models/easy_flow/node.rb
@@ -128,6 +130,7 @@ files:
128
130
  - app/models/easy_flow/progress/kept.rb
129
131
  - app/models/easy_flow/progress/loose.rb
130
132
  - app/models/easy_flow/question_runner.rb
133
+ - app/models/easy_flow/read_data.rb
131
134
  - app/models/easy_flow/registry.rb
132
135
  - app/models/easy_flow/run.rb
133
136
  - app/models/easy_flow/runner.rb
@@ -143,11 +146,14 @@ files:
143
146
  - app/models/easy_flow/steps/question.rb
144
147
  - app/models/easy_flow/switch.rb
145
148
  - app/models/easy_flow/terminal.rb
149
+ - app/models/easy_flow/unconnected_steps.rb
146
150
  - app/models/easy_flow/validator.rb
147
151
  - app/models/easy_flow/version.rb
148
152
  - app/models/easy_flow/violation.rb
149
153
  - app/models/easy_flow/wait.rb
154
+ - app/models/easy_flow/write_data.rb
150
155
  - app/views/easy_flow/flows/complete.html.erb
156
+ - app/views/easy_flow/flows/refused.html.erb
151
157
  - app/views/easy_flow/flows/show.html.erb
152
158
  - app/views/easy_flow/flows/step.html.erb
153
159
  - app/views/easy_flow/manage/definitions/edit.html.erb