avo 1.22.3 → 1.24.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.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +4 -1
- data/README.md +6 -0
- data/app/assets/svgs/arrow-down.svg +3 -0
- data/app/assets/svgs/arrow-up.svg +3 -0
- data/app/assets/svgs/download-solid-reversed.svg +3 -0
- data/app/assets/svgs/download-solid.svg +3 -0
- data/app/assets/svgs/switch-vertical.svg +3 -0
- data/app/{views/avo/partials/_alert.html.erb → components/avo/alert_component.html.erb} +0 -0
- data/app/components/avo/alert_component.rb +11 -0
- data/app/components/avo/alerts_component.html.erb +3 -0
- data/app/components/avo/alerts_component.rb +5 -0
- data/app/components/avo/base_component.rb +7 -0
- data/app/components/avo/index/grid_item_component.html.erb +1 -1
- data/app/components/avo/index/ordering/base_component.rb +9 -0
- data/app/components/avo/index/ordering/button_component.html.erb +10 -0
- data/app/components/avo/index/ordering/button_component.rb +31 -0
- data/app/components/avo/index/ordering/buttons_component.html.erb +30 -0
- data/app/components/avo/index/ordering/buttons_component.rb +19 -0
- data/app/components/avo/index/resource_controls_component.html.erb +11 -4
- data/app/components/avo/index/resource_controls_component.rb +6 -1
- data/app/components/avo/index/table_row_component.html.erb +1 -1
- data/app/components/avo/navigation_link_component.rb +1 -1
- data/app/components/avo/resource_component.rb +1 -1
- data/app/{views/avo/partials/_turbo_frame_wrap.html.erb → components/avo/turbo_frame_wrapper_component.html.erb} +4 -2
- data/app/components/avo/turbo_frame_wrapper_component.rb +9 -0
- data/app/controllers/avo/application_controller.rb +14 -1
- data/app/controllers/avo/base_controller.rb +14 -2
- data/app/helpers/avo/application_helper.rb +1 -1
- data/app/helpers/avo/url_helpers.rb +4 -0
- data/app/javascript/js/application.js +4 -0
- data/app/javascript/js/controllers/modal_controller.js +9 -0
- data/app/javascript/js/controllers/search_controller.js +6 -1
- data/app/views/avo/actions/show.html.erb +7 -3
- data/app/views/layouts/avo/application.html.erb +1 -1
- data/config/routes.rb +3 -0
- data/lib/avo/base_action.rb +21 -0
- data/lib/avo/base_resource.rb +8 -0
- data/lib/avo/licensing/h_q.rb +55 -1
- data/lib/avo/licensing/pro_license.rb +1 -0
- data/lib/avo/version.rb +1 -1
- data/public/avo-assets/avo.css +4 -0
- data/public/avo-assets/avo.js +7645 -7375
- data/public/avo-assets/avo.js.map +3 -3
- metadata +19 -5
- data/app/views/avo/partials/_alerts.html.erb +0 -3
data/lib/avo/licensing/h_q.rb
CHANGED
@@ -23,6 +23,12 @@ module Avo
|
|
23
23
|
|
24
24
|
begin
|
25
25
|
perform_and_cache_request
|
26
|
+
rescue Errno::EHOSTUNREACH => exception
|
27
|
+
cache_and_return_error "HTTP host not reachable error.", exception.message
|
28
|
+
rescue Errno::ECONNRESET => exception
|
29
|
+
cache_and_return_error "HTTP connection reset error.", exception.message
|
30
|
+
rescue Errno::ECONNREFUSED => exception
|
31
|
+
cache_and_return_error "HTTP connection refused error.", exception.message
|
26
32
|
rescue HTTParty::Error => exception
|
27
33
|
cache_and_return_error "HTTP client error.", exception.message
|
28
34
|
rescue Net::OpenTimeout => exception
|
@@ -71,7 +77,55 @@ module Avo
|
|
71
77
|
environment: Rails.env,
|
72
78
|
ip: current_request.ip,
|
73
79
|
host: current_request.host,
|
74
|
-
port: current_request.port
|
80
|
+
port: current_request.port,
|
81
|
+
app_name: app_name
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
def app_name
|
86
|
+
Rails.application.class.to_s.split("::").first
|
87
|
+
rescue
|
88
|
+
nil
|
89
|
+
end
|
90
|
+
|
91
|
+
def avo_metadata
|
92
|
+
resources = App.resources
|
93
|
+
field_definitions = resources.map(&:get_field_definitions)
|
94
|
+
fields_count = field_definitions.map(&:count).sum
|
95
|
+
fields_per_resource = sprintf("%0.01f", fields_count / (resources.count + 0.0))
|
96
|
+
|
97
|
+
field_types = {}
|
98
|
+
custom_fields_count = 0
|
99
|
+
field_definitions.each do |fields|
|
100
|
+
fields.each do |field|
|
101
|
+
field_types[field.type] ||= 0
|
102
|
+
field_types[field.type] += 1
|
103
|
+
|
104
|
+
custom_fields_count += 1 if field.custom?
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
{
|
109
|
+
resources_count: resources.count,
|
110
|
+
fields_count: fields_count,
|
111
|
+
fields_per_resource: fields_per_resource,
|
112
|
+
custom_fields_count: custom_fields_count,
|
113
|
+
field_types: field_types,
|
114
|
+
**other_metadata(:actions),
|
115
|
+
**other_metadata(:filters),
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
def other_metadata(type = :actions)
|
120
|
+
resources = App.resources
|
121
|
+
|
122
|
+
types = resources.map(&:"get_#{type}")
|
123
|
+
type_count = types.flatten.uniq.count
|
124
|
+
type_per_resource = sprintf("%0.01f", types.map(&:count).sum / (resources.count + 0.0))
|
125
|
+
|
126
|
+
{
|
127
|
+
"#{type}_count": type_count,
|
128
|
+
"#{type}_per_resource": type_per_resource,
|
75
129
|
}
|
76
130
|
end
|
77
131
|
|
data/lib/avo/version.rb
CHANGED