avo 2.3.1.pre.3 → 2.3.1.pre.6
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.css +6 -0
- data/app/views/avo/debug/index.html.erb +5 -17
- data/app/views/avo/debug/report.html.erb +21 -0
- data/config/routes.rb +5 -2
- data/lib/avo/app.rb +4 -2
- data/lib/avo/licensing/h_q.rb +8 -5
- data/lib/avo/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa5d2395db02e3b37f787b0680a4cae6748c99049f369d8e2a3db2fb6c2a2dd8
|
4
|
+
data.tar.gz: 4de2e1dcc865e6ebbc693ddefd4e5407f9d6a6c60f3c1153deeb8d7dcc6ba17b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 498b612171a47529d988c8ba89ac0330013afef141a0a4d74df9d41fe60b7d00543777be08b0fa35bf1a5972c06f512a2be76510f4b5a9fd90d779c7fc90a2e8
|
7
|
+
data.tar.gz: fefaff30ae62e0c5de60d64f3e5952bca7b1ae816d454613f3803ca268b2724505231dff2d9d9ce348a625a7ecf74fc9c669179fbbf03366f2c4c26a52c9b277
|
data/Gemfile.lock
CHANGED
data/app/assets/builds/avo.css
CHANGED
@@ -46,8 +46,8 @@
|
|
46
46
|
<% end %>
|
47
47
|
<dt class="font-semibold text-sm">Last fetched at</dt>
|
48
48
|
<dd><%= license.response['fetched_at'] %> <br>
|
49
|
-
|
50
|
-
|
49
|
+
<% if license.response['fetched_at'].present? %>
|
50
|
+
(<%= time_ago_in_words license.response['fetched_at'] %> ago)</dd>
|
51
51
|
<% end %>
|
52
52
|
<dt class="font-semibold text-sm">Cache store</dt>
|
53
53
|
<dd><%= Avo::App.cache_store.class.to_s %> - <%= Avo::App.cache_store.options.inspect %></dd>
|
@@ -67,21 +67,9 @@
|
|
67
67
|
</div>
|
68
68
|
</div>
|
69
69
|
<div class="relative bg-white rounded shadow-panel p-4 space-y-4 col-span-2">
|
70
|
-
<
|
71
|
-
|
72
|
-
|
73
|
-
</div>
|
74
|
-
<div class="flex justify-end">
|
75
|
-
<%= a_button icon: 'heroicons/outline/clipboard',
|
76
|
-
style: :primary,
|
77
|
-
data: {
|
78
|
-
controller: 'copy-to-clipboard',
|
79
|
-
action: "click->copy-to-clipboard#copy",
|
80
|
-
text: Avo::App.debug_report(request),
|
81
|
-
} do %>
|
82
|
-
Copy debug info
|
83
|
-
<% end %>
|
84
|
-
</div>
|
70
|
+
<turbo-frame id="debug-report" src="/admin/avo_private/debug/report" target="_top" class="block">
|
71
|
+
Loading...
|
72
|
+
</turbo-frame>
|
85
73
|
</div>
|
86
74
|
</div>
|
87
75
|
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<turbo-frame id="debug-report">
|
2
|
+
<div class="font-semibold">Debug report</div>
|
3
|
+
<div>
|
4
|
+
<% if defined?(ap) %>
|
5
|
+
<%== ap Avo::App.debug_report(request) %>
|
6
|
+
<% else %>
|
7
|
+
<pre><%== JSON.pretty_generate(Avo::App.debug_report(request)) %></pre>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
<div class="flex justify-end">
|
11
|
+
<%= a_button icon: 'heroicons/outline/clipboard',
|
12
|
+
style: :primary,
|
13
|
+
data: {
|
14
|
+
controller: 'copy-to-clipboard',
|
15
|
+
action: "click->copy-to-clipboard#copy",
|
16
|
+
text: Avo::App.debug_report(request),
|
17
|
+
} do %>
|
18
|
+
Copy debug info
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
</turbo-frame>
|
data/config/routes.rb
CHANGED
@@ -39,8 +39,11 @@ Avo::Engine.routes.draw do
|
|
39
39
|
delete "/:resource_name/:id/:related_name/:related_id", to: "associations#destroy", as: "associations_destroy"
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
scope "/avo_private", as: "avo_private" do
|
43
|
+
get "/debug", to: "debug#index", as: "debug_index"
|
44
|
+
get "/debug/report", to: "debug#report", as: "debug_report"
|
45
|
+
post "/debug/refresh_license", to: "debug#refresh_license"
|
46
|
+
end
|
44
47
|
|
45
48
|
if Rails.env.development? or Rails.env.staging?
|
46
49
|
scope "/avo_private", as: "avo_private" do
|
data/lib/avo/app.rb
CHANGED
@@ -105,13 +105,15 @@ module Avo
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def main_menu
|
108
|
-
return
|
108
|
+
return [] if Avo::App.license.lacks_with_trial(:menu_builder)
|
109
|
+
return [] if Avo.configuration.main_menu.nil?
|
109
110
|
|
110
111
|
Avo::Menu::Builder.parse_menu(&Avo.configuration.main_menu)
|
111
112
|
end
|
112
113
|
|
113
114
|
def profile_menu
|
114
|
-
return
|
115
|
+
return [] if Avo::App.license.lacks_with_trial(:menu_builder)
|
116
|
+
return [] if Avo.configuration.profile_menu.nil?
|
115
117
|
|
116
118
|
Avo::Menu::Builder.parse_menu(&Avo.configuration.profile_menu)
|
117
119
|
end
|
data/lib/avo/licensing/h_q.rb
CHANGED
@@ -6,6 +6,7 @@ module Avo
|
|
6
6
|
ENDPOINT = "https://avohq.io/api/v1/licenses/check".freeze unless const_defined?(:ENDPOINT)
|
7
7
|
CACHE_KEY = "avo.hq.response".freeze unless const_defined?(:CACHE_KEY)
|
8
8
|
REQUEST_TIMEOUT = 5 unless const_defined?(:REQUEST_TIMEOUT) # seconds
|
9
|
+
CACHE_TIME = 3600 unless const_defined?(:CACHE_TIME) # seconds
|
9
10
|
|
10
11
|
def initialize(current_request)
|
11
12
|
@current_request = current_request
|
@@ -60,8 +61,8 @@ module Avo
|
|
60
61
|
field_types: field_types,
|
61
62
|
**other_metadata(:actions),
|
62
63
|
**other_metadata(:filters),
|
63
|
-
main_menu_present: Avo
|
64
|
-
profile_menu_present: Avo
|
64
|
+
main_menu_present: Avo.configuration.main_menu.present?,
|
65
|
+
profile_menu_present: Avo.configuration.profile_menu.present?,
|
65
66
|
}
|
66
67
|
end
|
67
68
|
|
@@ -94,10 +95,12 @@ module Avo
|
|
94
95
|
|
95
96
|
return cache_and_return_error "Avo HQ Internal server error.", hq_response.body if hq_response.code == 500
|
96
97
|
|
97
|
-
|
98
|
+
if hq_response.code == 200
|
99
|
+
cache_response response: hq_response.parsed_response
|
100
|
+
end
|
98
101
|
end
|
99
102
|
|
100
|
-
def cache_response(
|
103
|
+
def cache_response(response: nil, time: CACHE_TIME)
|
101
104
|
response.merge!(
|
102
105
|
expiry: time,
|
103
106
|
fetched_at: Time.now,
|
@@ -135,7 +138,7 @@ module Avo
|
|
135
138
|
end
|
136
139
|
|
137
140
|
def cache_and_return_error(error, exception_message = "")
|
138
|
-
cache_response
|
141
|
+
cache_response response: {error: error, exception_message: exception_message}.stringify_keys, time: 5.minutes.to_i
|
139
142
|
end
|
140
143
|
|
141
144
|
def has_cached_response
|
data/lib/avo/version.rb
CHANGED
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: 2.3.1.pre.
|
4
|
+
version: 2.3.1.pre.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -1097,6 +1097,7 @@ files:
|
|
1097
1097
|
- app/views/avo/dashboards/card.html.erb
|
1098
1098
|
- app/views/avo/dashboards/show.html.erb
|
1099
1099
|
- app/views/avo/debug/index.html.erb
|
1100
|
+
- app/views/avo/debug/report.html.erb
|
1100
1101
|
- app/views/avo/home/_actions.html.erb
|
1101
1102
|
- app/views/avo/home/_docs.html.erb
|
1102
1103
|
- app/views/avo/home/_filters.html.erb
|