easy_flow 0.7.0 → 0.8.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.
- checksums.yaml +4 -4
- data/app/controllers/concerns/easy_flow/hosted.rb +6 -0
- data/app/controllers/easy_flow/flows_controller.rb +2 -2
- data/app/controllers/easy_flow/manage/canvas_controller.rb +1 -1
- data/app/controllers/easy_flow/manage/definitions_controller.rb +2 -2
- data/app/controllers/easy_flow/manage/flows_controller.rb +6 -6
- data/app/controllers/easy_flow/manage/previews_controller.rb +1 -1
- data/app/controllers/easy_flow/manage/versions_controller.rb +1 -1
- data/app/models/easy_flow/definition.rb +3 -1
- data/db/migrate/20261001120000_add_owner_to_easy_flow_definitions.rb +10 -0
- data/lib/easy_flow/host.rb +1 -1
- data/lib/easy_flow/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c42186355c5aff4867710d2b43d50543a34be2ce290c9748bea1ab11b540e21c
|
|
4
|
+
data.tar.gz: e0a902db995da05a8fed9e1c8f841b90f252277f31e2867d59a43a7855bcfa03
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 907fdb2b8760253cf3eea079d3dbbd92d23050d296b9c1166b8150dd5d6cff1e52b1b5f069a65b2111786808bfbcf9e097125f92b60a7e725dc958cde58b73df
|
|
7
|
+
data.tar.gz: 7db26de4465197e8983fd84c44f2bb2cc78cd79d4a999606adf11b8fa49a3af68699d19b96fa0686355bd53f5b0eaac93126627d7c37eb9b6aa2cb7c3dacc880
|
|
@@ -17,5 +17,11 @@ module EasyFlow
|
|
|
17
17
|
def flow_host
|
|
18
18
|
@flow_host ||= EasyFlow.host_named(self.class.named_flow_host || request.path_parameters[:easy_flow_host])
|
|
19
19
|
end
|
|
20
|
+
|
|
21
|
+
def hosted_flows
|
|
22
|
+
return flow_host.flows unless flow_host.owner_method
|
|
23
|
+
|
|
24
|
+
flow_host.flows.where(owner: send(flow_host.owner_method))
|
|
25
|
+
end
|
|
20
26
|
end
|
|
21
27
|
end
|
|
@@ -91,13 +91,13 @@ module EasyFlow
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def admitted_run
|
|
94
|
-
found = Run.where(flow:
|
|
94
|
+
found = Run.where(flow: hosted_flows).find(params[:id])
|
|
95
95
|
|
|
96
96
|
Admission.of_run(found, permitted: permitted?(found.flow))
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
def flow
|
|
100
|
-
@stored_flow ||= admit(
|
|
100
|
+
@stored_flow ||= admit(hosted_flows.find_by(slug: params[:slug]))
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def flowing_definition(flow)
|
|
@@ -2,11 +2,11 @@ module EasyFlow
|
|
|
2
2
|
module Manage
|
|
3
3
|
class DefinitionsController < BaseController
|
|
4
4
|
def edit
|
|
5
|
-
@flow =
|
|
5
|
+
@flow = hosted_flows.find(params[:flow_id])
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def update
|
|
9
|
-
@flow =
|
|
9
|
+
@flow = hosted_flows.find(params[:flow_id])
|
|
10
10
|
@flow.edit_history.edit_document(JSON.parse(params.require(:definition)))
|
|
11
11
|
redirect_to manage_flow_path(@flow), notice: "Definition saved."
|
|
12
12
|
end
|
|
@@ -7,7 +7,7 @@ module EasyFlow
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def create
|
|
10
|
-
@flow =
|
|
10
|
+
@flow = hosted_flows.new(create_params)
|
|
11
11
|
|
|
12
12
|
if @flow.save
|
|
13
13
|
redirect_to manage_flow_path(@flow), notice: "Flow created."
|
|
@@ -18,29 +18,29 @@ module EasyFlow
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def show
|
|
21
|
-
@flow =
|
|
21
|
+
@flow = hosted_flows.find(params[:id])
|
|
22
22
|
@canvas = canvas_payload(@flow)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def edit
|
|
26
|
-
@flow =
|
|
26
|
+
@flow = hosted_flows.find(params[:id])
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def update
|
|
30
|
-
@flow =
|
|
30
|
+
@flow = hosted_flows.find(params[:id])
|
|
31
31
|
@flow.update!(flow_params)
|
|
32
32
|
redirect_to manage_flow_path(@flow), notice: "Saved."
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def destroy
|
|
36
|
-
|
|
36
|
+
hosted_flows.find(params[:id]).destroy!
|
|
37
37
|
redirect_to manage_flows_path, notice: "Flow removed."
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
private
|
|
41
41
|
|
|
42
42
|
def ordered_flows
|
|
43
|
-
|
|
43
|
+
hosted_flows.order(:slug)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def create_params
|
|
@@ -6,6 +6,8 @@ module EasyFlow
|
|
|
6
6
|
enum :kind, { scored: "scored", guide: "guide" }
|
|
7
7
|
enum :persists, { unsaved: "unsaved", each_step: "each_step", on_finish: "on_finish" }
|
|
8
8
|
|
|
9
|
+
belongs_to :owner, polymorphic: true, optional: true
|
|
10
|
+
|
|
9
11
|
validates :host, :slug, presence: true
|
|
10
12
|
|
|
11
13
|
after_initialize :begin_the_flow, if: :new_record?
|
|
@@ -18,7 +20,7 @@ module EasyFlow
|
|
|
18
20
|
has_many :definition_versions, class_name: "EasyFlow::Version", foreign_key: :flow_id, dependent: :destroy
|
|
19
21
|
|
|
20
22
|
def self.upsert_definition(definition, host:)
|
|
21
|
-
find_or_initialize_by(host: host, slug: definition["slug"]).tap do |flow|
|
|
23
|
+
find_or_initialize_by(host: host, owner: nil, slug: definition["slug"]).tap do |flow|
|
|
22
24
|
flow.save!
|
|
23
25
|
flow.record_definition(definition) unless flow.definition == definition
|
|
24
26
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class AddOwnerToEasyFlowDefinitions < ActiveRecord::Migration[8.1]
|
|
2
|
+
def change
|
|
3
|
+
add_reference :easy_flow_definitions, :owner, polymorphic: true, index: false
|
|
4
|
+
remove_index :easy_flow_definitions, [ :host, :slug ], unique: true, name: "index_easy_flow_definitions_on_host_and_slug"
|
|
5
|
+
add_index :easy_flow_definitions, [ :host, :slug ], unique: true, where: "owner_id IS NULL",
|
|
6
|
+
name: "index_easy_flow_definitions_on_host_and_slug"
|
|
7
|
+
add_index :easy_flow_definitions, [ :host, :owner_type, :owner_id, :slug ], unique: true, where: "owner_id IS NOT NULL",
|
|
8
|
+
name: "index_easy_flow_definitions_on_host_owner_and_slug"
|
|
9
|
+
end
|
|
10
|
+
end
|
data/lib/easy_flow/host.rb
CHANGED
|
@@ -2,7 +2,7 @@ module EasyFlow
|
|
|
2
2
|
class Host
|
|
3
3
|
attr_reader :name
|
|
4
4
|
attr_writer :layout, :admin_layout, :offers
|
|
5
|
-
attr_accessor :admin_authentication_method, :visitor_authorization_method, :refusal_method
|
|
5
|
+
attr_accessor :admin_authentication_method, :visitor_authorization_method, :refusal_method, :owner_method
|
|
6
6
|
|
|
7
7
|
def initialize(name)
|
|
8
8
|
@name = name.to_s
|
data/lib/easy_flow/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tylercschneider
|
|
@@ -137,6 +137,7 @@ files:
|
|
|
137
137
|
- db/migrate/20260924120100_create_easy_flow_versions.rb
|
|
138
138
|
- db/migrate/20260924120200_create_easy_flow_runs.rb
|
|
139
139
|
- db/migrate/20260924130000_add_host_to_easy_flow_definitions.rb
|
|
140
|
+
- db/migrate/20261001120000_add_owner_to_easy_flow_definitions.rb
|
|
140
141
|
- lib/easy_flow.rb
|
|
141
142
|
- lib/easy_flow/engine.rb
|
|
142
143
|
- lib/easy_flow/host.rb
|