forest_admin_agent 1.0.0.pre.beta.71 → 1.0.0.pre.beta.72

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ea6f67ffc5dc116dac48722300bd5fa6a0c40ca82b5f8af91d6efa657bb803a
4
- data.tar.gz: 6985f9c28c16899cb14da10ce069e757eb62020d0eba7a657c27594e96eb01e2
3
+ metadata.gz: c94f2a856dbe3fb0b7ab5968ccb91d1f1ea0894d84b60a9076a5a8fd98b5663a
4
+ data.tar.gz: 63706206c126f7fb68807e94ccf6b971b40a47f52eb37094c190d5694b874dd8
5
5
  SHA512:
6
- metadata.gz: 9f2a571ab36bb1d331b8f2f783086e2089b2bdc2bd009208ad06aec5e520e6ad8227074c5eb4a2026148fa9f5687c8e9d20767ddb7782ce2d2c6bb98b0a5102a
7
- data.tar.gz: 7aa16376f63c8ce874b8426cd2842a02300f71a75545db9b26e034d5acb93ed26b44a8485da976df4ea461d369e0b0f05d2a80f3618eadc4da1dbc26943ccfdd
6
+ metadata.gz: f77e8e90b43a20e9a3b8ca08b98670d4a2f7ee4489cbfb26da5f1be11255d7048882a0a9aede0dc1ae9589d693adc4b0f89add527fc42e5884407fe7a16ab761
7
+ data.tar.gz: 51a25721acb463d04e93d31f86d4c595b91c887540c0c8bb272a9440fecfa410760578962dd2bf561f1d6bb6add323302d5779b5a9b25059ee04bd8b12434f27
@@ -29,7 +29,6 @@ module ForestAdminAgent
29
29
  action = collection.schema[:actions][name]
30
30
  action_index = collection.schema[:actions].keys.index(name)
31
31
  slug = get_action_slug(name)
32
-
33
32
  form_elements = extract_fields_and_layout(collection.get_form(nil, name))
34
33
  if action.static_form?
35
34
  fields = build_fields(collection, form_elements[:fields])
@@ -72,6 +71,14 @@ module ForestAdminAgent
72
71
  component: field.component.camelize(:lower),
73
72
  fields: field.fields.map { |f| build_layout_schema(f) }
74
73
  }
74
+ elsif field.component == 'Page'
75
+ return {
76
+ **field.to_h,
77
+ component: field.component.camelize(:lower),
78
+ elements: field.elements.map do |f|
79
+ build_layout_schema(f)
80
+ end
81
+ }
75
82
  end
76
83
 
77
84
  { **field.to_h, component: field.component.camelize(:lower) }
@@ -135,18 +142,15 @@ module ForestAdminAgent
135
142
  def self.extract_fields_and_layout(form)
136
143
  fields = []
137
144
  layout = []
138
-
139
145
  form&.each do |element|
140
146
  if element.type == Actions::FieldType::LAYOUT
141
- if element.component == 'Row'
142
- extract = extract_fields_and_layout(element.fields)
143
- element.fields = extract[:layout]
147
+ if %w[Page Row].include?(element.component)
148
+ extract = extract_fields_and_layout_for_component(element)
144
149
  layout << element
145
150
  fields.concat(extract[:fields])
146
151
  else
147
152
  layout << element
148
153
  end
149
-
150
154
  else
151
155
  fields << element
152
156
  # frontend rule
@@ -156,6 +160,13 @@ module ForestAdminAgent
156
160
 
157
161
  { fields: fields, layout: layout }
158
162
  end
163
+
164
+ def self.extract_fields_and_layout_for_component(element)
165
+ key = element.component == 'Page' ? :elements : :fields
166
+ extract = extract_fields_and_layout(element.public_send(key))
167
+ element.public_send(:"#{key}=", extract[:layout])
168
+ extract
169
+ end
159
170
  end
160
171
  end
161
172
  end
@@ -7,7 +7,7 @@ module ForestAdminAgent
7
7
  class SchemaEmitter
8
8
  LIANA_NAME = "agent-ruby"
9
9
 
10
- LIANA_VERSION = "1.0.0-beta.71"
10
+ LIANA_VERSION = "1.0.0-beta.72"
11
11
 
12
12
  def self.get_serialized_schema(datasource)
13
13
  schema_path = Facades::Container.cache(:schema_path)
@@ -1,3 +1,3 @@
1
1
  module ForestAdminAgent
2
- VERSION = "1.0.0-beta.71"
2
+ VERSION = "1.0.0-beta.72"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.71
4
+ version: 1.0.0.pre.beta.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-10-04 00:00:00.000000000 Z
12
+ date: 2024-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport