avo 2.3.1.pre.1 → 2.3.1.pre.2
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 +3 -1
- data/app/assets/builds/avo.css +18 -5
- data/app/assets/builds/avo.js +58 -58
- data/app/assets/builds/avo.js.map +3 -3
- data/app/components/avo/sidebar/base_item_component.rb +1 -1
- data/app/components/avo/sidebar/group_component.html.erb +15 -13
- data/app/components/avo/sidebar/section_component.html.erb +1 -1
- data/app/components/avo/sidebar_component.html.erb +1 -1
- data/app/components/avo/views/resource_index_component.html.erb +19 -21
- data/app/controllers/avo/actions_controller.rb +1 -1
- data/app/controllers/avo/application_controller.rb +5 -1
- data/app/controllers/avo/base_controller.rb +9 -14
- data/app/controllers/avo/debug_controller.rb +24 -0
- data/app/javascript/js/controllers/copy_to_clipboard_controller.js +37 -0
- data/app/javascript/js/controllers/filter_controller.js +1 -11
- data/app/javascript/js/controllers/multiple_select_filter_controller.js +1 -3
- data/app/javascript/js/controllers/select_filter_controller.js +1 -1
- data/app/javascript/js/controllers.js +2 -0
- data/app/views/avo/base/_boolean_filter.html.erb +14 -1
- data/app/views/avo/base/_multiple_select_filter.html.erb +13 -2
- data/app/views/avo/base/_select_filter.html.erb +9 -1
- data/app/views/avo/base/_text_filter.html.erb +10 -2
- data/app/views/avo/debug/index.html.erb +87 -0
- data/config/routes.rb +4 -1
- data/lib/avo/app.rb +18 -0
- data/lib/avo/filters/base_filter.rb +2 -17
- data/lib/avo/filters/boolean_filter.rb +0 -12
- data/lib/avo/filters/multiple_select_filter.rb +0 -15
- data/lib/avo/filters/text_filter.rb +0 -4
- data/lib/avo/licensing/h_q.rb +53 -48
- data/lib/avo/licensing/license.rb +8 -0
- data/lib/avo/licensing/license_manager.rb +4 -0
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/initializer/avo.tt +23 -3
- data/public/avo-assets/avo.css +18 -5
- data/public/avo-assets/avo.js +58 -58
- data/public/avo-assets/avo.js.map +3 -3
- metadata +5 -2
data/lib/avo/licensing/h_q.rb
CHANGED
@@ -13,13 +13,62 @@ module Avo
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def response
|
16
|
-
|
16
|
+
make_request
|
17
|
+
end
|
18
|
+
|
19
|
+
def fresh_response
|
20
|
+
make_request(fresh: true)
|
21
|
+
end
|
22
|
+
|
23
|
+
def payload
|
24
|
+
{
|
25
|
+
license: Avo.configuration.license,
|
26
|
+
license_key: Avo.configuration.license_key,
|
27
|
+
avo_version: Avo::VERSION,
|
28
|
+
rails_version: Rails::VERSION::STRING,
|
29
|
+
ruby_version: RUBY_VERSION,
|
30
|
+
environment: Rails.env,
|
31
|
+
ip: current_request.ip,
|
32
|
+
host: current_request.host,
|
33
|
+
port: current_request.port,
|
34
|
+
app_name: app_name
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def avo_metadata
|
39
|
+
resources = App.resources
|
40
|
+
field_definitions = resources.map(&:get_field_definitions)
|
41
|
+
fields_count = field_definitions.map(&:count).sum
|
42
|
+
fields_per_resource = sprintf("%0.01f", fields_count / (resources.count + 0.0))
|
43
|
+
|
44
|
+
field_types = {}
|
45
|
+
custom_fields_count = 0
|
46
|
+
field_definitions.each do |fields|
|
47
|
+
fields.each do |field|
|
48
|
+
field_types[field.type] ||= 0
|
49
|
+
field_types[field.type] += 1
|
50
|
+
|
51
|
+
custom_fields_count += 1 if field.custom?
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
{
|
56
|
+
resources_count: resources.count,
|
57
|
+
fields_count: fields_count,
|
58
|
+
fields_per_resource: fields_per_resource,
|
59
|
+
custom_fields_count: custom_fields_count,
|
60
|
+
field_types: field_types,
|
61
|
+
**other_metadata(:actions),
|
62
|
+
**other_metadata(:filters),
|
63
|
+
main_menu_present: Avo::App.main_menu.present?,
|
64
|
+
profile_menu_present: Avo::App.profile_menu.present?,
|
65
|
+
}
|
17
66
|
end
|
18
67
|
|
19
68
|
private
|
20
69
|
|
21
|
-
def
|
22
|
-
return cached_response if has_cached_response
|
70
|
+
def make_request(fresh: false)
|
71
|
+
return cached_response if has_cached_response && !fresh
|
23
72
|
|
24
73
|
begin
|
25
74
|
perform_and_cache_request
|
@@ -51,13 +100,12 @@ module Avo
|
|
51
100
|
def cache_response(time, response)
|
52
101
|
response.merge!(
|
53
102
|
expiry: time,
|
103
|
+
fetched_at: Time.now,
|
54
104
|
**payload
|
55
105
|
).stringify_keys!
|
56
106
|
|
57
107
|
@cache_store.write(CACHE_KEY, response, expires_in: time)
|
58
108
|
|
59
|
-
@hq_response = response
|
60
|
-
|
61
109
|
response
|
62
110
|
end
|
63
111
|
|
@@ -67,55 +115,12 @@ module Avo
|
|
67
115
|
HTTParty.post ENDPOINT, body: payload.to_json, headers: {'Content-type': "application/json"}, timeout: REQUEST_TIMEOUT
|
68
116
|
end
|
69
117
|
|
70
|
-
def payload
|
71
|
-
{
|
72
|
-
license: Avo.configuration.license,
|
73
|
-
license_key: Avo.configuration.license_key,
|
74
|
-
avo_version: Avo::VERSION,
|
75
|
-
rails_version: Rails::VERSION::STRING,
|
76
|
-
ruby_version: RUBY_VERSION,
|
77
|
-
environment: Rails.env,
|
78
|
-
ip: current_request.ip,
|
79
|
-
host: current_request.host,
|
80
|
-
port: current_request.port,
|
81
|
-
app_name: app_name
|
82
|
-
}
|
83
|
-
end
|
84
|
-
|
85
118
|
def app_name
|
86
119
|
Rails.application.class.to_s.split("::").first
|
87
120
|
rescue
|
88
121
|
nil
|
89
122
|
end
|
90
123
|
|
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
124
|
def other_metadata(type = :actions)
|
120
125
|
resources = App.resources
|
121
126
|
|
data/lib/avo/version.rb
CHANGED
@@ -3,6 +3,9 @@ Avo.configure do |config|
|
|
3
3
|
## == Routing ==
|
4
4
|
config.root_path = '/<%= options[:path] %>'
|
5
5
|
|
6
|
+
# Where should the user be redirected when he hits the `/<%= options[:path] %>` url
|
7
|
+
# config.home_path = nil
|
8
|
+
|
6
9
|
## == Licensing ==
|
7
10
|
config.license = 'community' # change this to 'pro' when you add the license key
|
8
11
|
# config.license_key = ENV['AVO_LICENSE_KEY']
|
@@ -26,6 +29,7 @@ Avo.configure do |config|
|
|
26
29
|
# create: 'create?',
|
27
30
|
# destroy: 'destroy?',
|
28
31
|
# }
|
32
|
+
# config.raise_error_on_missing_policy = false
|
29
33
|
|
30
34
|
## == Localization ==
|
31
35
|
# config.locale = 'en-US'
|
@@ -45,14 +49,30 @@ Avo.configure do |config|
|
|
45
49
|
# config.search_debounce = 300
|
46
50
|
# config.view_component_path = "app/components"
|
47
51
|
# config.display_license_request_timeout_error = true
|
52
|
+
# config.disabled_features = []
|
48
53
|
|
49
54
|
|
50
|
-
# Where should the user be redirected when he hits the `/<%= options[:path] %>` url
|
51
|
-
# config.home_path = nil
|
52
|
-
|
53
55
|
## == Breadcrumbs ==
|
54
56
|
# config.display_breadcrumbs = true
|
55
57
|
# config.set_initial_breadcrumbs do
|
56
58
|
# add_breadcrumb "Home", '/<%= options[:path] %>'
|
57
59
|
# end
|
60
|
+
|
61
|
+
## == Menus ==
|
62
|
+
# config.main_menu = -> {
|
63
|
+
# section "Dashboards", icon: "dashboards" do
|
64
|
+
# all_dashboards
|
65
|
+
# end
|
66
|
+
|
67
|
+
# section "Resources", icon: "resources" do
|
68
|
+
# all_resources
|
69
|
+
# end
|
70
|
+
|
71
|
+
# section "Tools", icon: "tools" do
|
72
|
+
# all_tools
|
73
|
+
# end
|
74
|
+
# }
|
75
|
+
# config.profile_menu = -> {
|
76
|
+
# link "Profile", path: "/<%= options[:path] %>/profile", icon: "user-circle"
|
77
|
+
# }
|
58
78
|
end
|
data/public/avo-assets/avo.css
CHANGED
@@ -6280,6 +6280,14 @@ progress[value]::-moz-progress-bar{
|
|
6280
6280
|
z-index:60
|
6281
6281
|
}
|
6282
6282
|
|
6283
|
+
.col-span-1{
|
6284
|
+
grid-column:span 1 / span 1
|
6285
|
+
}
|
6286
|
+
|
6287
|
+
.col-span-2{
|
6288
|
+
grid-column:span 2 / span 2
|
6289
|
+
}
|
6290
|
+
|
6283
6291
|
.col-span-full{
|
6284
6292
|
grid-column:1 / -1
|
6285
6293
|
}
|
@@ -7476,6 +7484,11 @@ progress[value]::-moz-progress-bar{
|
|
7476
7484
|
line-height:1
|
7477
7485
|
}
|
7478
7486
|
|
7487
|
+
.text-xl{
|
7488
|
+
font-size:1.25rem;
|
7489
|
+
line-height:1.75rem
|
7490
|
+
}
|
7491
|
+
|
7479
7492
|
.text-2xl{
|
7480
7493
|
font-size:1.5rem;
|
7481
7494
|
line-height:2rem
|
@@ -7669,6 +7682,11 @@ progress[value]::-moz-progress-bar{
|
|
7669
7682
|
color:rgb(30 41 59 / var(--tw-text-opacity))
|
7670
7683
|
}
|
7671
7684
|
|
7685
|
+
.text-red-600{
|
7686
|
+
--tw-text-opacity:1;
|
7687
|
+
color:rgb(220 38 38 / var(--tw-text-opacity))
|
7688
|
+
}
|
7689
|
+
|
7672
7690
|
.text-gray-300{
|
7673
7691
|
--tw-text-opacity:1;
|
7674
7692
|
color:rgb(183 187 194 / var(--tw-text-opacity))
|
@@ -7684,11 +7702,6 @@ progress[value]::-moz-progress-bar{
|
|
7684
7702
|
color:rgb(0 0 0 / var(--tw-text-opacity))
|
7685
7703
|
}
|
7686
7704
|
|
7687
|
-
.text-red-600{
|
7688
|
-
--tw-text-opacity:1;
|
7689
|
-
color:rgb(220 38 38 / var(--tw-text-opacity))
|
7690
|
-
}
|
7691
|
-
|
7692
7705
|
.text-slate-600{
|
7693
7706
|
--tw-text-opacity:1;
|
7694
7707
|
color:rgb(71 85 105 / var(--tw-text-opacity))
|