avo 2.0.0 → 2.1.2.pre1

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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +3 -3
  4. data/app/assets/builds/avo.css +8810 -0
  5. data/app/assets/builds/avo.js +423 -0
  6. data/app/assets/builds/avo.js.map +7 -0
  7. data/app/assets/stylesheets/avo.css +1 -1
  8. data/app/assets/svgs/save.svg +8 -1
  9. data/app/components/avo/actions_component.html.erb +1 -1
  10. data/app/components/avo/alert_component.html.erb +1 -1
  11. data/app/components/avo/alert_component.rb +6 -6
  12. data/app/components/avo/blank_field_component.html.erb +0 -0
  13. data/app/components/avo/blank_field_component.rb +4 -0
  14. data/app/components/avo/card_component.html.erb +7 -2
  15. data/app/components/avo/fields/badge_field/index_component.html.erb +1 -1
  16. data/app/components/avo/fields/boolean_field/index_component.html.erb +1 -1
  17. data/app/components/avo/fields/external_image_field/index_component.html.erb +1 -2
  18. data/app/components/avo/fields/file_field/index_component.html.erb +3 -3
  19. data/app/components/avo/fields/file_field/index_component.rb +11 -0
  20. data/app/components/avo/fields/gravatar_field/index_component.html.erb +1 -1
  21. data/app/components/avo/fields/progress_bar_field/index_component.html.erb +1 -1
  22. data/app/components/avo/index/field_wrapper_component.html.erb +1 -1
  23. data/app/components/avo/index/field_wrapper_component.rb +12 -1
  24. data/app/components/avo/index/resource_controls_component.html.erb +5 -1
  25. data/app/components/avo/index/resource_table_component.html.erb +1 -1
  26. data/app/components/avo/panel_component.html.erb +15 -5
  27. data/app/components/avo/panel_component.rb +9 -0
  28. data/app/components/avo/referrer_params_component.html.erb +4 -0
  29. data/app/components/avo/referrer_params_component.rb +9 -0
  30. data/app/components/avo/sidebar_component.html.erb +2 -0
  31. data/app/components/avo/sidebar_component.rb +3 -1
  32. data/app/components/avo/views/resource_edit_component.html.erb +14 -1
  33. data/app/components/avo/views/resource_new_component.html.erb +13 -0
  34. data/app/components/avo/views/resource_show_component.html.erb +11 -0
  35. data/app/components/avo/views/resource_show_component.rb +5 -0
  36. data/app/controllers/avo/application_controller.rb +1 -1
  37. data/app/controllers/avo/base_controller.rb +87 -37
  38. data/app/controllers/avo/dashboards_controller.rb +2 -6
  39. data/app/controllers/avo/search_controller.rb +5 -1
  40. data/app/helpers/avo/url_helpers.rb +6 -2
  41. data/app/javascript/avo.js +4 -3
  42. data/app/views/avo/actions/show.html.erb +1 -0
  43. data/app/views/avo/associations/new.html.erb +1 -0
  44. data/app/views/avo/dashboards/show.html.erb +4 -1
  45. data/app/views/avo/home/failed_to_load.html.erb +21 -1
  46. data/app/views/avo/partials/_sidebar_extra.html.erb +0 -0
  47. data/app/views/layouts/avo/application.html.erb +7 -0
  48. data/bin/dev +7 -6
  49. data/lib/avo/app.rb +8 -1
  50. data/lib/avo/base_action.rb +5 -4
  51. data/lib/avo/base_card.rb +175 -0
  52. data/lib/avo/base_resource.rb +34 -8
  53. data/lib/avo/configuration.rb +2 -0
  54. data/lib/avo/dashboards/base_dashboard.rb +37 -2
  55. data/lib/avo/dashboards/base_divider.rb +3 -1
  56. data/lib/avo/dashboards/chartkick_card.rb +1 -1
  57. data/lib/avo/dashboards/dashboard_card.rb +6 -0
  58. data/lib/avo/dashboards/partial_card.rb +1 -1
  59. data/lib/avo/fields/base_field.rb +19 -6
  60. data/lib/avo/fields/belongs_to_field.rb +1 -1
  61. data/lib/avo/fields/date_field.rb +1 -1
  62. data/lib/avo/fields/external_image_field.rb +2 -2
  63. data/lib/avo/fields_collector.rb +7 -2
  64. data/lib/avo/hosts/dashboard_card.rb +1 -0
  65. data/lib/avo/hosts/dashboard_visibility.rb +19 -0
  66. data/lib/avo/licensing/pro_license.rb +1 -0
  67. data/lib/avo/version.rb +1 -1
  68. data/lib/generators/avo/templates/dashboards/dashboard.tt +4 -1
  69. data/public/avo-assets/avo.css +55 -34
  70. data/public/avo-assets/avo.js +166 -165
  71. data/public/avo-assets/avo.js.map +3 -3
  72. metadata +15 -6
  73. data/app/views/avo/partials/_failed_state.html.erb +0 -16
  74. data/lib/avo/dashboards/base_card.rb +0 -151
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.0.0
4
+ version: 2.1.2.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-03-25 00:00:00.000000000 Z
12
+ date: 2022-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -234,6 +234,9 @@ files:
234
234
  - Gemfile.lock
235
235
  - README.md
236
236
  - Rakefile
237
+ - app/assets/builds/avo.css
238
+ - app/assets/builds/avo.js
239
+ - app/assets/builds/avo.js.map
237
240
  - app/assets/config/avo_manifest.js
238
241
  - app/assets/stylesheets/avo.css
239
242
  - app/assets/stylesheets/css/active-storage.css
@@ -781,6 +784,8 @@ files:
781
784
  - app/components/avo/alert_component.html.erb
782
785
  - app/components/avo/alert_component.rb
783
786
  - app/components/avo/base_component.rb
787
+ - app/components/avo/blank_field_component.html.erb
788
+ - app/components/avo/blank_field_component.rb
784
789
  - app/components/avo/button_component.html.erb
785
790
  - app/components/avo/button_component.rb
786
791
  - app/components/avo/card_component.html.erb
@@ -981,6 +986,8 @@ files:
981
986
  - app/components/avo/panel_component.rb
982
987
  - app/components/avo/profile_item_component.html.erb
983
988
  - app/components/avo/profile_item_component.rb
989
+ - app/components/avo/referrer_params_component.html.erb
990
+ - app/components/avo/referrer_params_component.rb
984
991
  - app/components/avo/resource_component.rb
985
992
  - app/components/avo/show/field_wrapper_component.html.erb
986
993
  - app/components/avo/show/field_wrapper_component.rb
@@ -1072,7 +1079,6 @@ files:
1072
1079
  - app/views/avo/home/failed_to_load.html.erb
1073
1080
  - app/views/avo/home/index.html.erb
1074
1081
  - app/views/avo/partials/_custom_tools_alert.html.erb
1075
- - app/views/avo/partials/_failed_state.html.erb
1076
1082
  - app/views/avo/partials/_footer.html.erb
1077
1083
  - app/views/avo/partials/_global_search.html.erb
1078
1084
  - app/views/avo/partials/_head.html.erb
@@ -1082,6 +1088,7 @@ files:
1082
1088
  - app/views/avo/partials/_navbar.html.erb
1083
1089
  - app/views/avo/partials/_resource_search.html.erb
1084
1090
  - app/views/avo/partials/_scripts.html.erb
1091
+ - app/views/avo/partials/_sidebar_extra.html.erb
1085
1092
  - app/views/avo/partials/_sortable_component.html.erb
1086
1093
  - app/views/avo/partials/_table_header.html.erb
1087
1094
  - app/views/avo/partials/_view_toggle_button.html.erb
@@ -1117,12 +1124,13 @@ files:
1117
1124
  - lib/avo/action_model.rb
1118
1125
  - lib/avo/app.rb
1119
1126
  - lib/avo/base_action.rb
1127
+ - lib/avo/base_card.rb
1120
1128
  - lib/avo/base_resource.rb
1121
1129
  - lib/avo/configuration.rb
1122
- - lib/avo/dashboards/base_card.rb
1123
1130
  - lib/avo/dashboards/base_dashboard.rb
1124
1131
  - lib/avo/dashboards/base_divider.rb
1125
1132
  - lib/avo/dashboards/chartkick_card.rb
1133
+ - lib/avo/dashboards/dashboard_card.rb
1126
1134
  - lib/avo/dashboards/metric_card.rb
1127
1135
  - lib/avo/dashboards/partial_card.rb
1128
1136
  - lib/avo/dynamic_router.rb
@@ -1173,6 +1181,7 @@ files:
1173
1181
  - lib/avo/grid_fields/title_field.rb
1174
1182
  - lib/avo/has_context.rb
1175
1183
  - lib/avo/hosts/dashboard_card.rb
1184
+ - lib/avo/hosts/dashboard_visibility.rb
1176
1185
  - lib/avo/hosts/ordering.rb
1177
1186
  - lib/avo/licensing/community_license.rb
1178
1187
  - lib/avo/licensing/h_q.rb
@@ -1276,9 +1285,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1276
1285
  version: 2.4.0
1277
1286
  required_rubygems_version: !ruby/object:Gem::Requirement
1278
1287
  requirements:
1279
- - - ">="
1288
+ - - ">"
1280
1289
  - !ruby/object:Gem::Version
1281
- version: '0'
1290
+ version: 1.3.1
1282
1291
  requirements: []
1283
1292
  rubygems_version: 3.3.3
1284
1293
  signing_key:
@@ -1,16 +0,0 @@
1
- <%
2
- classes = 'absolute inset-auto left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2'
3
- label = t 'avo.failed_to_load'
4
- %>
5
- <div class="relative flex-1 py-12">
6
- <div class="relative block text-gray-300 h-40 w-full">
7
- <%= svg 'avocado', class: "#{classes} h-20 text-gray-400" %>
8
- <%= svg 'code', class: "#{classes} h-8 -ml-20 -mt-12" %>
9
- <%= svg 'fire', class: "#{classes} h-8 -ml-10 -mt-24" %>
10
- <%= svg 'color-swatch', class: "#{classes} h-8 ml-8 -mt-24" %>
11
- <%= svg 'globe', class: "#{classes} h-8 ml-20 -mt-12" %>
12
- <%= svg 'library', class: "#{classes} h-8 -ml-20 mt-4" %>
13
- <%= svg 'photograph', class: "#{classes} h-8 ml-20 mt-4" %>
14
- </div>
15
- <div class="relative block text-center text-lg text-gray-400 font-semibold -mt-10"><%= label %> <%= params[:turbo_frame].to_s.humanize.downcase if params[:turbo_frame].present? %></div>
16
- </div>
@@ -1,151 +0,0 @@
1
- module Avo
2
- module Dashboards
3
- class BaseCard
4
- class_attribute :id
5
- class_attribute :label
6
- class_attribute :description
7
- class_attribute :cols, default: 1
8
- class_attribute :rows, default: 1
9
- class_attribute :initial_range
10
- class_attribute :ranges, default: []
11
- class_attribute :refresh_every
12
- class_attribute :display_header, default: true
13
- # private
14
- class_attribute :result_data
15
- class_attribute :query_block
16
-
17
- attr_accessor :dashboard
18
- attr_accessor :params
19
-
20
- delegate :context, to: ::Avo::App
21
-
22
- class << self
23
- def query(&block)
24
- self.query_block = block
25
- end
26
- end
27
-
28
- def initialize(dashboard:)
29
- @dashboard = dashboard
30
- end
31
-
32
- def label
33
- return self.class.label.to_s if self.class.label.to_s.present?
34
-
35
- self.class.id.to_s.humanize
36
- end
37
-
38
- def translated_range(range)
39
- return "#{range} days" if range.is_a? Integer
40
-
41
- case range
42
- when "MTD"
43
- "Month to date"
44
- when "QTD"
45
- "Quarter to date"
46
- when "YTD"
47
- "Year to date"
48
- when "TODAY"
49
- "Today"
50
- else
51
- range
52
- end
53
- end
54
-
55
- def parsed_ranges
56
- return unless ranges.present?
57
-
58
- ranges.map { |range| [translated_range(range), range] }
59
- end
60
-
61
- def turbo_frame
62
- "#{dashboard.id}_#{id}"
63
- end
64
-
65
- def frame_url(enforced_range: nil)
66
- enforced_range ||= initial_range || ranges.first
67
- "#{Avo::App.root_path}/dashboards/#{dashboard.id}/cards/#{id}?turbo_frame=#{turbo_frame}&range=#{enforced_range}"
68
- end
69
-
70
- def card_classes
71
- result = ""
72
-
73
- result += case self.class.cols.to_i
74
- when 1
75
- " sm:col-span-1"
76
- when 2
77
- " sm:col-span-2"
78
- when 3
79
- " sm:col-span-3"
80
- when 4
81
- " sm:col-span-4"
82
- when 5
83
- " sm:col-span-5"
84
- when 6
85
- " sm:col-span-6"
86
- else
87
- " sm:col-span-1"
88
- end
89
-
90
- result += case self.class.rows.to_i
91
- when 1
92
- " h-36"
93
- when 2
94
- " h-72"
95
- when 3
96
- " h-[27rem]"
97
- when 4
98
- " h-[36rem]"
99
- when 5
100
- " h-[45rem]"
101
- when 6
102
- " h-[54rem]"
103
- end
104
-
105
- result
106
- end
107
-
108
- def type
109
- return :metric if self.class.superclass == ::Avo::Dashboards::MetricCard
110
- return :chartkick if self.class.superclass == ::Avo::Dashboards::ChartkickCard
111
- return :partial if self.class.superclass == ::Avo::Dashboards::PartialCard
112
- end
113
-
114
- def compute_result
115
- Avo::Hosts::DashboardCard.new(card: self, dashboard: dashboard, params: params, context: context, range: range)
116
- .compute_result
117
-
118
- self
119
- end
120
-
121
- def hydrate(dashboard: nil, params: nil)
122
- @dashboard = dashboard if dashboard.present?
123
- @params = params if params.present?
124
-
125
- self
126
- end
127
-
128
- def range
129
- return params[:range] if params.present? && params[:range].present?
130
-
131
- return initial_range if initial_range.present?
132
-
133
- ranges.first
134
- end
135
-
136
- def result(data)
137
- self.result_data = data
138
-
139
- self
140
- end
141
-
142
- def is_card?
143
- true
144
- end
145
-
146
- def is_divider?
147
- false
148
- end
149
- end
150
- end
151
- end