avo 3.1.1 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/builds/avo.base.css +4 -0
- data/app/components/avo/fields/has_one_field/show_component.rb +1 -0
- data/lib/avo/concerns/has_items.rb +7 -4
- data/lib/avo/dynamic_router.rb +5 -29
- data/lib/avo/resources/resource_manager.rb +16 -24
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +0 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58201ebf40ea090bc7ff03e588ae9dba48c913c4d39b16eaa4d0068a99c45211
|
4
|
+
data.tar.gz: 2c3efea520399494770be31f454086cc4ea6aa24eaa16c735099ef336e059e8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ab96094a881dea361ab8c88817030bf277dc737e70f5f273da59545f1db19e6145aaa14877db6bc6b8aa91347df5c2099a1c57183dc52f6ed10dd896831f852
|
7
|
+
data.tar.gz: 404d1af6a00033fc33b3e242fb5e10a1c9a66a0b79771615586466848c6022a3a495ca6ec3e890d394f8c3f5c02c28817c30f30e6563dd443aa1cf0cdd7a7084
|
data/Gemfile.lock
CHANGED
@@ -41,6 +41,7 @@ class Avo::Fields::HasOneField::ShowComponent < Avo::Fields::ShowComponent
|
|
41
41
|
args = {
|
42
42
|
via_relation: association_id,
|
43
43
|
via_relation_class: @resource.model_class.to_s,
|
44
|
+
via_resource_class: @resource.class,
|
44
45
|
via_record_id: @resource.record.to_param,
|
45
46
|
via_association_type: :has_one
|
46
47
|
}
|
@@ -101,6 +101,13 @@ module Avo
|
|
101
101
|
if item.is_sidebar?
|
102
102
|
fields << extract_fields(item)
|
103
103
|
end
|
104
|
+
else
|
105
|
+
# When `item.is_main_panel? == true` then also `item.is_panel? == true`
|
106
|
+
# But when only_root == true we want to extract main_panel items
|
107
|
+
# In all other circumstances items will get extracted when checking for `item.is_panel?`
|
108
|
+
if item.is_main_panel?
|
109
|
+
fields << extract_fields(item)
|
110
|
+
end
|
104
111
|
end
|
105
112
|
|
106
113
|
if item.is_field?
|
@@ -110,10 +117,6 @@ module Avo
|
|
110
117
|
if item.is_row?
|
111
118
|
fields << extract_fields(tab)
|
112
119
|
end
|
113
|
-
|
114
|
-
if item.is_main_panel?
|
115
|
-
fields << extract_fields(item)
|
116
|
-
end
|
117
120
|
end
|
118
121
|
|
119
122
|
fields.flatten
|
data/lib/avo/dynamic_router.rb
CHANGED
@@ -1,39 +1,15 @@
|
|
1
1
|
module Avo
|
2
2
|
class DynamicRouter
|
3
|
-
def self.eager_load(entity)
|
4
|
-
paths = Avo::ENTITIES.fetch entity
|
5
|
-
|
6
|
-
return unless paths.present?
|
7
|
-
|
8
|
-
pathname = Rails.root.join(*paths)
|
9
|
-
if pathname.directory?
|
10
|
-
Rails.autoloaders.main.eager_load_dir(pathname.to_s)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
3
|
def self.routes
|
15
4
|
Avo::Engine.routes.draw do
|
16
5
|
scope "resources", as: "resources" do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
Avo::Resources::ResourceManager.fetch_resources
|
24
|
-
.select do |resource|
|
25
|
-
resource != :BaseResource
|
26
|
-
end
|
27
|
-
.select do |resource|
|
28
|
-
resource.is_a? Class
|
29
|
-
end
|
30
|
-
.map do |resource|
|
31
|
-
resources resource.route_key do
|
32
|
-
member do
|
33
|
-
get :preview
|
34
|
-
end
|
6
|
+
Avo::Resources::ResourceManager.fetch_resources.map do |resource|
|
7
|
+
resources resource.route_key do
|
8
|
+
member do
|
9
|
+
get :preview
|
35
10
|
end
|
36
11
|
end
|
12
|
+
end
|
37
13
|
end
|
38
14
|
end
|
39
15
|
end
|
@@ -8,7 +8,6 @@ module Avo
|
|
8
8
|
class << self
|
9
9
|
def build
|
10
10
|
instance = new
|
11
|
-
instance.init_resources
|
12
11
|
instance.check_bad_resources
|
13
12
|
instance
|
14
13
|
end
|
@@ -35,37 +34,30 @@ module Avo
|
|
35
34
|
# "FishResource",
|
36
35
|
# ]
|
37
36
|
def fetch_resources
|
38
|
-
|
39
|
-
|
37
|
+
if Avo.configuration.resources.present?
|
38
|
+
load_configured_resources
|
40
39
|
else
|
41
|
-
|
40
|
+
load_resources_namespace
|
42
41
|
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
BaseResource.descendants
|
44
|
+
end
|
45
|
+
|
46
|
+
def load_resources_namespace
|
47
|
+
Rails.autoloaders.main.eager_load_namespace(Avo::Resources)
|
48
|
+
end
|
49
|
+
|
50
|
+
def load_configured_resources
|
51
|
+
raise 'Resources configuration must be an array' unless Avo.configuration.resources.is_a? Array
|
52
|
+
|
53
|
+
Avo.configuration.resources.each do |resource|
|
54
|
+
resource.to_s.safe_constantize
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
53
58
|
|
54
59
|
def initialize
|
55
|
-
@resources =
|
56
|
-
end
|
57
|
-
|
58
|
-
def init_resources
|
59
|
-
self.resources = self.class.fetch_resources
|
60
|
-
.reject do |resource|
|
61
|
-
# Remove the BaseResource. We only need the descendants
|
62
|
-
resource == Avo::BaseResource
|
63
|
-
end
|
64
|
-
.uniq do |klass|
|
65
|
-
# On invalid resource configuration the resource classes get duplicated in `ObjectSpace`
|
66
|
-
# We need to de-duplicate them
|
67
|
-
klass.name
|
68
|
-
end
|
60
|
+
@resources = self.class.fetch_resources
|
69
61
|
end
|
70
62
|
|
71
63
|
def check_bad_resources
|
data/lib/avo/version.rb
CHANGED
data/lib/avo.rb
CHANGED
@@ -18,16 +18,6 @@ module Avo
|
|
18
18
|
IN_DEVELOPMENT = ENV["AVO_IN_DEVELOPMENT"] == "1"
|
19
19
|
PACKED = !IN_DEVELOPMENT
|
20
20
|
COOKIES_KEY = "avo"
|
21
|
-
ENTITIES = {
|
22
|
-
cards: ["app", "avo", "cards"],
|
23
|
-
scopes: ["app", "avo", "scopes"],
|
24
|
-
fields: ["app", "avo", "fields"],
|
25
|
-
filters: ["app", "avo", "filters"],
|
26
|
-
actions: ["app", "avo", "actions"],
|
27
|
-
resources: ["app", "avo", "resources"],
|
28
|
-
dashboards: ["app", "avo", "dashboards"],
|
29
|
-
resource_tools: ["app", "avo", "resource_tools"]
|
30
|
-
}
|
31
21
|
|
32
22
|
class LicenseVerificationTemperedError < StandardError; end
|
33
23
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-12-
|
12
|
+
date: 2023-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|