avo 3.1.1 → 3.1.2
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.
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 +8 -0
- data/app/assets/builds/avo.base.js +60 -29
- data/app/assets/builds/avo.base.js.map +3 -3
- data/app/components/avo/fields/has_one_field/show_component.rb +1 -0
- 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
@@ -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
|
}
|
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.2
|
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-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|