avo 1.22.3 → 1.24.0

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.

Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +4 -1
  4. data/README.md +6 -0
  5. data/app/assets/svgs/arrow-down.svg +3 -0
  6. data/app/assets/svgs/arrow-up.svg +3 -0
  7. data/app/assets/svgs/download-solid-reversed.svg +3 -0
  8. data/app/assets/svgs/download-solid.svg +3 -0
  9. data/app/assets/svgs/switch-vertical.svg +3 -0
  10. data/app/{views/avo/partials/_alert.html.erb → components/avo/alert_component.html.erb} +0 -0
  11. data/app/components/avo/alert_component.rb +11 -0
  12. data/app/components/avo/alerts_component.html.erb +3 -0
  13. data/app/components/avo/alerts_component.rb +5 -0
  14. data/app/components/avo/base_component.rb +7 -0
  15. data/app/components/avo/index/grid_item_component.html.erb +1 -1
  16. data/app/components/avo/index/ordering/base_component.rb +9 -0
  17. data/app/components/avo/index/ordering/button_component.html.erb +10 -0
  18. data/app/components/avo/index/ordering/button_component.rb +31 -0
  19. data/app/components/avo/index/ordering/buttons_component.html.erb +30 -0
  20. data/app/components/avo/index/ordering/buttons_component.rb +19 -0
  21. data/app/components/avo/index/resource_controls_component.html.erb +11 -4
  22. data/app/components/avo/index/resource_controls_component.rb +6 -1
  23. data/app/components/avo/index/table_row_component.html.erb +1 -1
  24. data/app/components/avo/navigation_link_component.rb +1 -1
  25. data/app/components/avo/resource_component.rb +1 -1
  26. data/app/{views/avo/partials/_turbo_frame_wrap.html.erb → components/avo/turbo_frame_wrapper_component.html.erb} +4 -2
  27. data/app/components/avo/turbo_frame_wrapper_component.rb +9 -0
  28. data/app/controllers/avo/application_controller.rb +14 -1
  29. data/app/controllers/avo/base_controller.rb +14 -2
  30. data/app/helpers/avo/application_helper.rb +1 -1
  31. data/app/helpers/avo/url_helpers.rb +4 -0
  32. data/app/javascript/js/application.js +4 -0
  33. data/app/javascript/js/controllers/modal_controller.js +9 -0
  34. data/app/javascript/js/controllers/search_controller.js +6 -1
  35. data/app/views/avo/actions/show.html.erb +7 -3
  36. data/app/views/layouts/avo/application.html.erb +1 -1
  37. data/config/routes.rb +3 -0
  38. data/lib/avo/base_action.rb +21 -0
  39. data/lib/avo/base_resource.rb +8 -0
  40. data/lib/avo/licensing/h_q.rb +55 -1
  41. data/lib/avo/licensing/pro_license.rb +1 -0
  42. data/lib/avo/version.rb +1 -1
  43. data/public/avo-assets/avo.css +4 -0
  44. data/public/avo-assets/avo.js +7645 -7375
  45. data/public/avo-assets/avo.js.map +3 -3
  46. metadata +19 -5
  47. data/app/views/avo/partials/_alerts.html.erb +0 -3
@@ -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
 
@@ -9,6 +9,7 @@ module Avo
9
9
  :global_search,
10
10
  :enhanced_search_results,
11
11
  :searchable_belongs_to,
12
+ :resource_ordering,
12
13
  ]
13
14
  end
14
15
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "1.22.3"
2
+ VERSION = "1.24.0"
3
3
  end
@@ -6791,6 +6791,10 @@ progress[value]::-moz-progress-bar{
6791
6791
  max-width:100%
6792
6792
  }
6793
6793
 
6794
+ .max-w-xs{
6795
+ max-width:20rem
6796
+ }
6797
+
6794
6798
  .flex-1{
6795
6799
  flex:1 1 0%
6796
6800
  }