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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18e1805ff89ebee46cd3c45191d38f8a8953e09f3521df78f8ef922ff471065c
4
- data.tar.gz: 8a290c25c54ddf3d3a0708f4f859df219d9c5766c331bafbaffbe5320e3b50a2
3
+ metadata.gz: aa5d2395db02e3b37f787b0680a4cae6748c99049f369d8e2a3db2fb6c2a2dd8
4
+ data.tar.gz: 4de2e1dcc865e6ebbc693ddefd4e5407f9d6a6c60f3c1153deeb8d7dcc6ba17b
5
5
  SHA512:
6
- metadata.gz: 4288cfcdc4072c1e6916a0ea1da1d93369544198e4aa0f91a018ba2ed656bdf9bf4f80493a96eedf4dea956c7258c6021f7badbbc954784c2dfbefedce32673b
7
- data.tar.gz: 205ccbae96213b426456acfa1495a00cd383a8fdf7e270a29979a046623bc0907caa85a43b9a0d4eb0207a5b705437bb974ef6d9a80cae66fabab74279420881
6
+ metadata.gz: 498b612171a47529d988c8ba89ac0330013afef141a0a4d74df9d41fe60b7d00543777be08b0fa35bf1a5972c06f512a2be76510f4b5a9fd90d779c7fc90a2e8
7
+ data.tar.gz: fefaff30ae62e0c5de60d64f3e5952bca7b1ae816d454613f3803ca268b2724505231dff2d9d9ce348a625a7ecf74fc9c669179fbbf03366f2c4c26a52c9b277
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.3.1.pre.3)
4
+ avo (2.3.1.pre.6)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -8526,6 +8526,12 @@ trix-editor {
8526
8526
  padding-top:1rem
8527
8527
  }
8528
8528
 
8529
+ @media print{
8530
+ .print\:hidden{
8531
+ display:none
8532
+ }
8533
+ }
8534
+
8529
8535
  @media (min-width: 495px){
8530
8536
  .xs\:grid-cols-2{
8531
8537
  grid-template-columns:repeat(2, minmax(0, 1fr))
@@ -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
- <% if license.response['fetched_at'].present? %>
50
- (<%= time_ago_in_words license.response['fetched_at'] %> ago)</dd>
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
- <div class="font-semibold">Debug report</div>
71
- <div>
72
- <%== ap Avo::App.debug_report(request) %>
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
- get "/debug", to: "debug#index", as: "debug_index"
43
- post "/debug/refresh_license", to: "debug#refresh_license"
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 nil if Avo::App.license.lacks_with_trial(:menu_builder)
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 nil if Avo::App.license.lacks_with_trial(:menu_builder)
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
@@ -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::App.main_menu.present?,
64
- profile_menu_present: Avo::App.profile_menu.present?,
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
- cache_response 1.hour.to_i, hq_response.parsed_response if hq_response.code == 200
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(time, 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 5.minutes.to_i, {error: error, exception_message: exception_message}.stringify_keys
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
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.3.1.pre.3" unless const_defined?(:VERSION)
2
+ VERSION = "2.3.1.pre.6" unless const_defined?(:VERSION)
3
3
  end
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.3
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