avo 2.3.1.pre.2 → 2.3.1.pre.5
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 +7 -1
- data/config/routes.rb +4 -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 +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6256e502b9bb22a7d924ea43f8d0f6d7dbe6a28f9ad58877515f8d0a6954d481
|
4
|
+
data.tar.gz: 17956bd16b76b1f7017b20cbff9f841e8a7b942d7ad5d73c3442658e8bcfb7f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfea2ebe1abcbfcea4dfaf340791f44c7691a1b9b41ccfea534218aab32c0c4ec283a5494cb0369025690a0e4c73da42b04c3351aa9a5acf81bc30cf47d5af88
|
7
|
+
data.tar.gz: 6078470d3fe8efdb049f4bc49735589b6db7fb55bafe1417bd0130d5046a4b60a20246cff2c65464b72c6977ecea8b4bf4d141c53b95129c8be816056f552c58
|
data/Gemfile.lock
CHANGED
data/app/assets/builds/avo.css
CHANGED
@@ -46,7 +46,9 @@
|
|
46
46
|
<% end %>
|
47
47
|
<dt class="font-semibold text-sm">Last fetched at</dt>
|
48
48
|
<dd><%= license.response['fetched_at'] %> <br>
|
49
|
+
<% if license.response['fetched_at'].present? %>
|
49
50
|
(<%= time_ago_in_words license.response['fetched_at'] %> ago)</dd>
|
51
|
+
<% end %>
|
50
52
|
<dt class="font-semibold text-sm">Cache store</dt>
|
51
53
|
<dd><%= Avo::App.cache_store.class.to_s %> - <%= Avo::App.cache_store.options.inspect %></dd>
|
52
54
|
</dl>
|
@@ -67,7 +69,11 @@
|
|
67
69
|
<div class="relative bg-white rounded shadow-panel p-4 space-y-4 col-span-2">
|
68
70
|
<div class="font-semibold">Debug report</div>
|
69
71
|
<div>
|
70
|
-
|
72
|
+
<% if defined?(ap) %>
|
73
|
+
<%== ap Avo::App.debug_report(request) %>
|
74
|
+
<% else %>
|
75
|
+
<pre><%== JSON.pretty_generate(Avo::App.debug_report(request)) %></pre>
|
76
|
+
<% end %>
|
71
77
|
</div>
|
72
78
|
<div class="flex justify-end">
|
73
79
|
<%= a_button icon: 'heroicons/outline/clipboard',
|
data/config/routes.rb
CHANGED
@@ -39,8 +39,10 @@ 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
|
+
post "/debug/refresh_license", to: "debug#refresh_license"
|
45
|
+
end
|
44
46
|
|
45
47
|
if Rails.env.development? or Rails.env.staging?
|
46
48
|
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