avo 2.18.1.pre.1.eagerloaddirs → 2.18.1
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 +3 -3
- data/Gemfile.lock +72 -74
- data/{public/avo-assets → app/assets/svgs}/placeholder.svg +0 -0
- data/app/components/avo/base_component.rb +0 -16
- data/app/components/avo/fields/index_component.rb +3 -4
- data/app/components/avo/index/grid_item_component.rb +2 -2
- data/app/components/avo/index/resource_controls_component.rb +2 -2
- data/app/components/avo/index/table_row_component.html.erb +1 -1
- data/app/components/avo/item_switcher_component.html.erb +1 -1
- data/app/components/avo/resource_component.rb +1 -1
- data/app/components/avo/resource_sidebar_component.rb +6 -1
- data/app/components/avo/tab_group_component.rb +1 -1
- data/app/controllers/avo/application_controller.rb +0 -6
- data/app/controllers/avo/cards_controller.rb +35 -0
- data/app/views/avo/{dashboards/cards → cards}/_chartkick_card.html.erb +0 -0
- data/app/views/avo/{dashboards/cards → cards}/_metric_card.html.erb +0 -0
- data/app/views/avo/{dashboards/cards → cards}/chartkick_missing.html.erb +0 -0
- data/app/views/avo/{dashboards/cards → cards}/show.html.erb +0 -0
- data/avo.gemspec +1 -1
- data/config/routes.rb +2 -2
- data/db/factories.rb +0 -5
- data/lib/avo/app.rb +1 -11
- data/lib/avo/base_action.rb +2 -2
- data/lib/avo/base_resource.rb +6 -3
- data/lib/avo/concerns/has_fields.rb +0 -2
- data/lib/avo/configuration/branding.rb +1 -1
- data/lib/avo/dynamic_router.rb +15 -16
- data/lib/avo/engine.rb +9 -1
- data/lib/avo/fields/base_field.rb +1 -1
- data/lib/avo/fields/has_base_field.rb +0 -2
- data/lib/avo/panel.rb +1 -4
- data/lib/avo/services/authorization_clients/nil_client.rb +37 -0
- data/lib/avo/services/authorization_service.rb +11 -1
- data/lib/avo/sidebar.rb +31 -1
- data/lib/avo/tab.rb +22 -5
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +2 -9
- data/public/avo-assets/avo.base.css +10 -10
- metadata +13 -13
- data/app/controllers/avo/dashboards/cards_controller.rb +0 -37
- data/lib/avo/concerns/visible_items.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7079bc6f71897afdcc083d49d88255d5a3e903e130a9c054e069976dc9038bc0
|
4
|
+
data.tar.gz: c618bf337578ddc521f6be2c92eb1c1bfc76f4e7956c5f4a7393e31326f49f02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b32f335e16778be0647bd74c1579f5842d01b74c836655040d165e64bcb5325a7f23b43bb01a31f455af6f58ae3ecac968cb301e8737d4d36734f2ea1d88dcd
|
7
|
+
data.tar.gz: c9a37f010a3b138f64f7f10d31b077a94f06d48539bffb635f6b6e0d35d2d56b76d2b25cd34e31e189fbf72911a91b52910bb341391a13edff6b6c79cac3c48f
|
data/Gemfile
CHANGED
@@ -102,12 +102,14 @@ group :test do
|
|
102
102
|
gem "launchy", require: false
|
103
103
|
|
104
104
|
gem "test-prof"
|
105
|
+
|
106
|
+
gem "sprockets-rails"
|
105
107
|
end
|
106
108
|
|
107
109
|
gem "rubocop"
|
108
110
|
gem "rubocop-shopify", require: false
|
109
111
|
|
110
|
-
gem "zeitwerk"
|
112
|
+
gem "zeitwerk", "~> 2.3"
|
111
113
|
|
112
114
|
gem "httparty"
|
113
115
|
|
@@ -158,8 +160,6 @@ gem "chartkick"
|
|
158
160
|
|
159
161
|
# Avo file filed requires this gem
|
160
162
|
gem "activestorage"
|
161
|
-
# Required by Avo
|
162
|
-
gem "sprockets-rails"
|
163
163
|
|
164
164
|
# Avo file filed requires this gem
|
165
165
|
# Use Active Storage variant
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (2.18.1
|
4
|
+
avo (2.18.1)
|
5
5
|
actionview (>= 6.0)
|
6
6
|
active_link_to
|
7
7
|
activerecord (>= 6.0)
|
@@ -15,7 +15,7 @@ PATH
|
|
15
15
|
pagy
|
16
16
|
turbo-rails
|
17
17
|
view_component
|
18
|
-
zeitwerk
|
18
|
+
zeitwerk
|
19
19
|
|
20
20
|
GEM
|
21
21
|
remote: https://rubygems.org/
|
@@ -88,8 +88,8 @@ GEM
|
|
88
88
|
activerecord (>= 6.0, < 7.1)
|
89
89
|
acts_as_list (1.0.4)
|
90
90
|
activerecord (>= 4.2)
|
91
|
-
addressable (2.8.
|
92
|
-
public_suffix (>= 2.0.2, <
|
91
|
+
addressable (2.8.0)
|
92
|
+
public_suffix (>= 2.0.2, < 5.0)
|
93
93
|
annotate (3.2.0)
|
94
94
|
activerecord (>= 3.2, < 8.0)
|
95
95
|
rake (>= 10.4, < 14.0)
|
@@ -100,22 +100,22 @@ GEM
|
|
100
100
|
ast (2.4.2)
|
101
101
|
awesome_print (1.9.2)
|
102
102
|
aws-eventstream (1.2.0)
|
103
|
-
aws-partitions (1.
|
104
|
-
aws-sdk-core (3.
|
103
|
+
aws-partitions (1.551.0)
|
104
|
+
aws-sdk-core (3.125.5)
|
105
105
|
aws-eventstream (~> 1, >= 1.0.2)
|
106
106
|
aws-partitions (~> 1, >= 1.525.0)
|
107
107
|
aws-sigv4 (~> 1.1)
|
108
|
-
jmespath (~> 1
|
109
|
-
aws-sdk-kms (1.
|
110
|
-
aws-sdk-core (~> 3, >= 3.
|
108
|
+
jmespath (~> 1.0)
|
109
|
+
aws-sdk-kms (1.53.0)
|
110
|
+
aws-sdk-core (~> 3, >= 3.125.0)
|
111
111
|
aws-sigv4 (~> 1.1)
|
112
|
-
aws-sdk-s3 (1.
|
113
|
-
aws-sdk-core (~> 3, >= 3.
|
112
|
+
aws-sdk-s3 (1.111.3)
|
113
|
+
aws-sdk-core (~> 3, >= 3.125.0)
|
114
114
|
aws-sdk-kms (~> 1)
|
115
115
|
aws-sigv4 (~> 1.4)
|
116
|
-
aws-sigv4 (1.
|
116
|
+
aws-sigv4 (1.4.0)
|
117
117
|
aws-eventstream (~> 1, >= 1.0.2)
|
118
|
-
bcrypt (3.1.
|
118
|
+
bcrypt (3.1.16)
|
119
119
|
better_html (2.0.1)
|
120
120
|
actionview (>= 6.0)
|
121
121
|
activesupport (>= 6.0)
|
@@ -131,7 +131,7 @@ GEM
|
|
131
131
|
railties (>= 5.0)
|
132
132
|
builder (3.2.4)
|
133
133
|
bump (0.10.0)
|
134
|
-
bundler-integrity (1.0.
|
134
|
+
bundler-integrity (1.0.7)
|
135
135
|
byebug (11.1.3)
|
136
136
|
capybara (3.36.0)
|
137
137
|
addressable
|
@@ -150,7 +150,7 @@ GEM
|
|
150
150
|
crack (0.4.5)
|
151
151
|
rexml
|
152
152
|
crass (1.0.6)
|
153
|
-
cssbundling-rails (1.
|
153
|
+
cssbundling-rails (1.0.0)
|
154
154
|
railties (>= 6.0.0)
|
155
155
|
database_cleaner (2.0.1)
|
156
156
|
database_cleaner-active_record (~> 2.0.0)
|
@@ -167,20 +167,20 @@ GEM
|
|
167
167
|
diff-lcs (1.5.0)
|
168
168
|
digest (3.1.0)
|
169
169
|
docile (1.4.0)
|
170
|
-
dotenv (2.
|
171
|
-
dotenv-rails (2.
|
172
|
-
dotenv (= 2.
|
170
|
+
dotenv (2.7.6)
|
171
|
+
dotenv-rails (2.7.6)
|
172
|
+
dotenv (= 2.7.6)
|
173
173
|
railties (>= 3.2)
|
174
174
|
dry-initializer (3.1.1)
|
175
175
|
erb-formatter (0.3.0)
|
176
176
|
erubi (1.11.0)
|
177
|
-
factory_bot (6.2.
|
177
|
+
factory_bot (6.2.0)
|
178
178
|
activesupport (>= 5.0.0)
|
179
179
|
factory_bot_rails (6.2.0)
|
180
180
|
factory_bot (~> 6.2.0)
|
181
181
|
railties (>= 5.0.0)
|
182
|
-
faker (2.
|
183
|
-
i18n (>= 1.
|
182
|
+
faker (2.19.0)
|
183
|
+
i18n (>= 1.6, < 2)
|
184
184
|
ffi (1.15.5)
|
185
185
|
friendly_id (5.4.2)
|
186
186
|
activerecord (>= 4.0.0)
|
@@ -190,16 +190,16 @@ GEM
|
|
190
190
|
gem-release (2.2.2)
|
191
191
|
globalid (1.0.0)
|
192
192
|
activesupport (>= 5.0)
|
193
|
-
groupdate (
|
194
|
-
activesupport (>= 5
|
193
|
+
groupdate (5.2.4)
|
194
|
+
activesupport (>= 5)
|
195
195
|
hashdiff (1.0.1)
|
196
196
|
highline (2.0.3)
|
197
197
|
hightop (0.3.0)
|
198
198
|
activesupport (>= 5.2)
|
199
|
-
hotwire-livereload (1.
|
199
|
+
hotwire-livereload (1.1.0)
|
200
200
|
listen (>= 3.0.0)
|
201
201
|
rails (>= 6.0.0)
|
202
|
-
htmlbeautifier (1.4.
|
202
|
+
htmlbeautifier (1.4.1)
|
203
203
|
httparty (0.20.0)
|
204
204
|
mime-types (~> 3.0)
|
205
205
|
multi_xml (>= 0.5.2)
|
@@ -222,12 +222,12 @@ GEM
|
|
222
222
|
inline_svg (1.8.0)
|
223
223
|
activesupport (>= 3.0)
|
224
224
|
nokogiri (>= 1.6)
|
225
|
+
io-wait (0.2.1)
|
225
226
|
iso (0.4.0)
|
226
227
|
i18n
|
227
228
|
jmespath (1.6.1)
|
228
|
-
jsbundling-rails (1.0.
|
229
|
+
jsbundling-rails (1.0.0)
|
229
230
|
railties (>= 6.0.0)
|
230
|
-
json (2.6.2)
|
231
231
|
launchy (2.5.0)
|
232
232
|
addressable (~> 2.7)
|
233
233
|
listen (3.7.1)
|
@@ -243,7 +243,7 @@ GEM
|
|
243
243
|
zeitwerk
|
244
244
|
marcel (1.0.2)
|
245
245
|
matrix (0.4.2)
|
246
|
-
meta-tags (2.
|
246
|
+
meta-tags (2.16.0)
|
247
247
|
actionpack (>= 3.2.0, < 7.1)
|
248
248
|
method_source (1.0.0)
|
249
249
|
mime-types (3.4.1)
|
@@ -253,9 +253,10 @@ GEM
|
|
253
253
|
mini_mime (1.1.2)
|
254
254
|
mini_portile2 (2.8.0)
|
255
255
|
minitest (5.16.3)
|
256
|
-
msgpack (1.
|
256
|
+
msgpack (1.6.0)
|
257
257
|
multi_xml (0.6.0)
|
258
|
-
net-protocol (0.1.
|
258
|
+
net-protocol (0.1.2)
|
259
|
+
io-wait
|
259
260
|
timeout
|
260
261
|
net-smtp (0.3.1)
|
261
262
|
digest
|
@@ -270,12 +271,12 @@ GEM
|
|
270
271
|
orm_adapter (0.5.0)
|
271
272
|
pagy (5.10.1)
|
272
273
|
activesupport
|
273
|
-
parallel (1.
|
274
|
-
parser (3.1.
|
274
|
+
parallel (1.21.0)
|
275
|
+
parser (3.1.0.0)
|
275
276
|
ast (~> 2.4.1)
|
276
|
-
pg (1.
|
277
|
-
public_suffix (
|
278
|
-
puma (5.6.
|
277
|
+
pg (1.3.1)
|
278
|
+
public_suffix (4.0.6)
|
279
|
+
puma (5.6.4)
|
279
280
|
nio4r (~> 2.0)
|
280
281
|
pundit (2.2.0)
|
281
282
|
activesupport (>= 3.0.0)
|
@@ -318,27 +319,27 @@ GEM
|
|
318
319
|
thor (~> 1.0)
|
319
320
|
rainbow (3.1.1)
|
320
321
|
rake (13.0.6)
|
321
|
-
ransack (
|
322
|
-
activerecord (>=
|
323
|
-
activesupport (>=
|
322
|
+
ransack (2.5.0)
|
323
|
+
activerecord (>= 5.2.4)
|
324
|
+
activesupport (>= 5.2.4)
|
324
325
|
i18n
|
325
|
-
rb-fsevent (0.11.
|
326
|
+
rb-fsevent (0.11.0)
|
326
327
|
rb-inotify (0.10.1)
|
327
328
|
ffi (~> 1.0)
|
328
|
-
redis (4.
|
329
|
-
regexp_parser (2.
|
329
|
+
redis (4.6.0)
|
330
|
+
regexp_parser (2.2.0)
|
330
331
|
responders (3.0.1)
|
331
332
|
actionpack (>= 5.0)
|
332
333
|
railties (>= 5.0)
|
333
334
|
rexml (3.2.5)
|
334
|
-
rspec-core (3.
|
335
|
-
rspec-support (~> 3.
|
336
|
-
rspec-expectations (3.
|
335
|
+
rspec-core (3.10.2)
|
336
|
+
rspec-support (~> 3.10.0)
|
337
|
+
rspec-expectations (3.10.2)
|
337
338
|
diff-lcs (>= 1.2.0, < 2.0)
|
338
|
-
rspec-support (~> 3.
|
339
|
-
rspec-mocks (3.
|
339
|
+
rspec-support (~> 3.10.0)
|
340
|
+
rspec-mocks (3.10.3)
|
340
341
|
diff-lcs (>= 1.2.0, < 2.0)
|
341
|
-
rspec-support (~> 3.
|
342
|
+
rspec-support (~> 3.10.0)
|
342
343
|
rspec-rails (4.0.2)
|
343
344
|
actionpack (>= 4.2)
|
344
345
|
activesupport (>= 4.2)
|
@@ -347,35 +348,33 @@ GEM
|
|
347
348
|
rspec-expectations (~> 3.10)
|
348
349
|
rspec-mocks (~> 3.10)
|
349
350
|
rspec-support (~> 3.10)
|
350
|
-
rspec-support (3.
|
351
|
-
rubocop (1.
|
352
|
-
json (~> 2.3)
|
351
|
+
rspec-support (3.10.3)
|
352
|
+
rubocop (1.25.0)
|
353
353
|
parallel (~> 1.10)
|
354
|
-
parser (>= 3.1.
|
354
|
+
parser (>= 3.1.0.0)
|
355
355
|
rainbow (>= 2.2.2, < 4.0)
|
356
356
|
regexp_parser (>= 1.8, < 3.0)
|
357
|
-
rexml
|
358
|
-
rubocop-ast (>= 1.
|
357
|
+
rexml
|
358
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
359
359
|
ruby-progressbar (~> 1.7)
|
360
360
|
unicode-display_width (>= 1.4.0, < 3.0)
|
361
|
-
rubocop-ast (1.
|
362
|
-
parser (>= 3.1.1
|
363
|
-
rubocop-performance (1.
|
361
|
+
rubocop-ast (1.15.1)
|
362
|
+
parser (>= 3.0.1.1)
|
363
|
+
rubocop-performance (1.13.2)
|
364
364
|
rubocop (>= 1.7.0, < 2.0)
|
365
365
|
rubocop-ast (>= 0.4.0)
|
366
|
-
rubocop-shopify (2.
|
367
|
-
rubocop (~> 1.
|
366
|
+
rubocop-shopify (2.5.0)
|
367
|
+
rubocop (~> 1.25)
|
368
368
|
ruby-debug-ide (0.7.3)
|
369
369
|
rake (>= 0.8.1)
|
370
370
|
ruby-progressbar (1.11.0)
|
371
371
|
ruby-vips (2.1.4)
|
372
372
|
ffi (~> 1.12)
|
373
373
|
rubyzip (2.3.2)
|
374
|
-
selenium-webdriver (4.
|
374
|
+
selenium-webdriver (4.1.0)
|
375
375
|
childprocess (>= 0.5, < 5.0)
|
376
376
|
rexml (~> 3.2, >= 3.2.5)
|
377
|
-
rubyzip (>= 1.2.2
|
378
|
-
websocket (~> 1.0)
|
377
|
+
rubyzip (>= 1.2.2)
|
379
378
|
simplecov (0.21.2)
|
380
379
|
docile (~> 1.1)
|
381
380
|
simplecov-html (~> 0.11)
|
@@ -384,7 +383,7 @@ GEM
|
|
384
383
|
rexml
|
385
384
|
simplecov (~> 0.19)
|
386
385
|
simplecov-html (0.12.3)
|
387
|
-
simplecov_json_formatter (0.1.
|
386
|
+
simplecov_json_formatter (0.1.3)
|
388
387
|
sixarm_ruby_unaccent (1.2.0)
|
389
388
|
smart_properties (1.17.0)
|
390
389
|
spring (4.0.0)
|
@@ -397,21 +396,21 @@ GEM
|
|
397
396
|
actionpack (>= 5.2)
|
398
397
|
activesupport (>= 5.2)
|
399
398
|
sprockets (>= 3.0.0)
|
400
|
-
standard (1.
|
401
|
-
rubocop (= 1.
|
402
|
-
rubocop-performance (= 1.
|
399
|
+
standard (1.7.0)
|
400
|
+
rubocop (= 1.25.0)
|
401
|
+
rubocop-performance (= 1.13.2)
|
403
402
|
terminal-table (3.0.2)
|
404
403
|
unicode-display_width (>= 1.1.1, < 3)
|
405
|
-
test-prof (1.0.
|
404
|
+
test-prof (1.0.7)
|
406
405
|
thor (1.2.1)
|
407
|
-
timeout (0.
|
406
|
+
timeout (0.2.0)
|
408
407
|
turbo-rails (1.3.2)
|
409
408
|
actionpack (>= 6.0.0)
|
410
409
|
activejob (>= 6.0.0)
|
411
410
|
railties (>= 6.0.0)
|
412
411
|
tzinfo (2.0.5)
|
413
412
|
concurrent-ruby (~> 1.0)
|
414
|
-
unicode-display_width (2.
|
413
|
+
unicode-display_width (2.1.0)
|
415
414
|
view_component (2.74.1)
|
416
415
|
activesupport (>= 5.0.0, < 8.0)
|
417
416
|
concurrent-ruby (~> 1.0)
|
@@ -423,21 +422,20 @@ GEM
|
|
423
422
|
activemodel (>= 6.0.0)
|
424
423
|
bindex (>= 0.4.0)
|
425
424
|
railties (>= 6.0.0)
|
426
|
-
webdrivers (5.
|
425
|
+
webdrivers (5.0.0)
|
427
426
|
nokogiri (~> 1.6)
|
428
427
|
rubyzip (>= 1.3.0)
|
429
428
|
selenium-webdriver (~> 4.0)
|
430
|
-
webmock (3.
|
429
|
+
webmock (3.14.0)
|
431
430
|
addressable (>= 2.8.0)
|
432
431
|
crack (>= 0.3.2)
|
433
432
|
hashdiff (>= 0.4.0, < 2.0.0)
|
434
|
-
websocket (1.2.9)
|
435
433
|
websocket-driver (0.7.5)
|
436
434
|
websocket-extensions (>= 0.1.0)
|
437
435
|
websocket-extensions (0.1.5)
|
438
436
|
xpath (3.2.0)
|
439
437
|
nokogiri (~> 1.8)
|
440
|
-
zeitwerk (2.6.
|
438
|
+
zeitwerk (2.6.0)
|
441
439
|
|
442
440
|
PLATFORMS
|
443
441
|
ruby
|
@@ -510,7 +508,7 @@ DEPENDENCIES
|
|
510
508
|
web-console (>= 3.3.0)
|
511
509
|
webdrivers
|
512
510
|
webmock
|
513
|
-
zeitwerk
|
511
|
+
zeitwerk (~> 2.3)
|
514
512
|
|
515
513
|
BUNDLED WITH
|
516
|
-
2.3.
|
514
|
+
2.3.23
|
File without changes
|
@@ -43,20 +43,4 @@ class Avo::BaseComponent < ViewComponent::Base
|
|
43
43
|
rescue
|
44
44
|
nil
|
45
45
|
end
|
46
|
-
|
47
|
-
def parent_or_child_resource
|
48
|
-
return @resource unless link_to_child_resource_is_enabled?
|
49
|
-
|
50
|
-
::Avo::App.get_resource_by_model_name(@resource.model.class).dup
|
51
|
-
end
|
52
|
-
|
53
|
-
def link_to_child_resource_is_enabled?
|
54
|
-
return field_linked_to_child_resource? if @parent_resource
|
55
|
-
|
56
|
-
@resource.link_to_child_resource
|
57
|
-
end
|
58
|
-
|
59
|
-
def field_linked_to_child_resource?
|
60
|
-
field.present? && field.respond_to?(:link_to_child_resource) && field.link_to_child_resource
|
61
|
-
end
|
62
46
|
end
|
@@ -1,19 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Avo::Fields::IndexComponent <
|
3
|
+
class Avo::Fields::IndexComponent < ViewComponent::Base
|
4
4
|
include Avo::ResourcesHelper
|
5
5
|
|
6
6
|
attr_reader :parent_resource
|
7
7
|
attr_reader :view
|
8
8
|
|
9
|
-
def initialize(field: nil, resource: nil,
|
9
|
+
def initialize(field: nil, resource: nil, index: 0, parent_model: nil, parent_resource: nil)
|
10
10
|
@field = field
|
11
11
|
@resource = resource
|
12
12
|
@index = index
|
13
13
|
@parent_model = parent_model
|
14
14
|
@parent_resource = parent_resource
|
15
15
|
@view = :index
|
16
|
-
@reflection = reflection
|
17
16
|
end
|
18
17
|
|
19
18
|
def resource_view_path
|
@@ -26,7 +25,7 @@ class Avo::Fields::IndexComponent < Avo::BaseComponent
|
|
26
25
|
}
|
27
26
|
end
|
28
27
|
|
29
|
-
helpers.resource_view_path(model: @resource.model, resource:
|
28
|
+
helpers.resource_view_path(model: @resource.model, resource: @resource, **args)
|
30
29
|
end
|
31
30
|
|
32
31
|
def field_wrapper_args
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Avo::Index::GridItemComponent <
|
3
|
+
class Avo::Index::GridItemComponent < ViewComponent::Base
|
4
4
|
include Avo::ResourcesHelper
|
5
5
|
|
6
6
|
attr_reader :parent_resource
|
@@ -37,6 +37,6 @@ class Avo::Index::GridItemComponent < Avo::BaseComponent
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
40
|
-
helpers.resource_view_path(model: @resource.model, resource:
|
40
|
+
helpers.resource_view_path(model: @resource.model, resource: @resource, **args)
|
41
41
|
end
|
42
42
|
end
|
@@ -41,7 +41,7 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
|
|
41
41
|
}
|
42
42
|
end
|
43
43
|
|
44
|
-
helpers.resource_path(model: @resource.model, resource:
|
44
|
+
helpers.resource_path(model: @resource.model, resource: @resource, **args)
|
45
45
|
end
|
46
46
|
|
47
47
|
def edit_path
|
@@ -55,7 +55,7 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
|
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
58
|
-
helpers.edit_resource_path(model: @resource.model, resource:
|
58
|
+
helpers.edit_resource_path(model: @resource.model, resource: @resource, **args)
|
59
59
|
end
|
60
60
|
|
61
61
|
def singular_resource_name
|
@@ -17,7 +17,7 @@
|
|
17
17
|
</td>
|
18
18
|
<% end %>
|
19
19
|
<% @resource.get_fields(reflection: @reflection, only_root: true).each_with_index do |field, index| %>
|
20
|
-
<%= render field.component_for_view(:index).new(field: field, resource: @resource,
|
20
|
+
<%= render field.component_for_view(:index).new(field: field, resource: @resource, index: index, parent_model: @parent_model, parent_resource: @parent_resource) %>
|
21
21
|
<% end %>
|
22
22
|
<% if Avo.configuration.resource_controls_on_the_right? %>
|
23
23
|
<td class="text-right whitespace-nowrap px-2" data-control="resource-controls">
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= render Avo::PanelComponent.new(name: item.name, description: item.description, index: index) do |c| %>
|
7
7
|
<% c.body do %>
|
8
8
|
<div class="divide-y">
|
9
|
-
<% item.
|
9
|
+
<% item.items.each_with_index do |field, index| %>
|
10
10
|
<%= render field
|
11
11
|
.hydrate(resource: @resource, model: @resource.model, user: resource.user, view: view)
|
12
12
|
.component_for_view(view)
|
@@ -92,7 +92,7 @@ class Avo::ResourceComponent < Avo::BaseComponent
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def sidebar_component(form: nil)
|
95
|
-
Avo::ResourceSidebarComponent.new resource: @resource, fields: sidebar.
|
95
|
+
Avo::ResourceSidebarComponent.new resource: @resource, fields: sidebar.items, params: params, view: view, form: form
|
96
96
|
end
|
97
97
|
|
98
98
|
def has_reflection_and_is_read_only
|
@@ -5,7 +5,6 @@ class Avo::ResourceSidebarComponent < ViewComponent::Base
|
|
5
5
|
attr_reader :params
|
6
6
|
attr_reader :view
|
7
7
|
attr_reader :form
|
8
|
-
attr_reader :fields
|
9
8
|
|
10
9
|
def initialize(resource: nil, fields: nil, index: nil, params: nil, form: nil, view: nil)
|
11
10
|
@resource = resource
|
@@ -15,6 +14,12 @@ class Avo::ResourceSidebarComponent < ViewComponent::Base
|
|
15
14
|
@form = form
|
16
15
|
end
|
17
16
|
|
17
|
+
def fields
|
18
|
+
@fields.filter do |field|
|
19
|
+
field.visible_on? view
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
18
23
|
def render?
|
19
24
|
Avo::App.license.has_with_trial(:resource_sidebar)
|
20
25
|
end
|
@@ -1,11 +1,5 @@
|
|
1
1
|
module Avo
|
2
2
|
class ApplicationController < ::ActionController::Base
|
3
|
-
if defined?(Pundit::Authorization)
|
4
|
-
Avo::ApplicationController.include Pundit::Authorization
|
5
|
-
elsif defined?(Pundit)
|
6
|
-
Avo::ApplicationController.include Pundit
|
7
|
-
end
|
8
|
-
|
9
3
|
include Pagy::Backend
|
10
4
|
include Avo::ApplicationHelper
|
11
5
|
include Avo::UrlHelpers
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_dependency "avo/application_controller"
|
2
|
+
|
3
|
+
module Avo
|
4
|
+
class CardsController < ApplicationController
|
5
|
+
before_action :set_dashboard
|
6
|
+
before_action :set_card
|
7
|
+
before_action :detect_chartkick
|
8
|
+
|
9
|
+
def show
|
10
|
+
render(:chartkick_missing) unless @chartkick_installed
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def set_dashboard
|
16
|
+
@dashboard = Avo::App.get_dashboard_by_id params[:dashboard_id]
|
17
|
+
|
18
|
+
raise ActionController::RoutingError.new("Not Found") if @dashboard.nil? || @dashboard.is_hidden?
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_card
|
22
|
+
@card = @dashboard.item_at_index(params[:index].to_i).tap do |card|
|
23
|
+
card.hydrate(dashboard: @dashboard, params: params)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def detect_chartkick
|
28
|
+
@chartkick_installed = if @card.class.ancestors.map(&:to_s).include?("Avo::Dashboards::ChartkickCard")
|
29
|
+
defined?(Chartkick)
|
30
|
+
else
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/avo.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_dependency "activerecord", ">= 6.0"
|
36
36
|
spec.add_dependency "actionview", ">= 6.0"
|
37
37
|
spec.add_dependency "pagy"
|
38
|
-
spec.add_dependency "zeitwerk"
|
38
|
+
spec.add_dependency "zeitwerk"
|
39
39
|
spec.add_dependency "httparty"
|
40
40
|
spec.add_dependency "active_link_to"
|
41
41
|
spec.add_dependency "view_component"
|
data/config/routes.rb
CHANGED
@@ -7,7 +7,7 @@ Avo::Engine.routes.draw do
|
|
7
7
|
post "/rails/active_storage/direct_uploads", to: "/active_storage/direct_uploads#create"
|
8
8
|
|
9
9
|
resources :dashboards do
|
10
|
-
resources :cards
|
10
|
+
resources :cards
|
11
11
|
end
|
12
12
|
|
13
13
|
scope "avo_api", as: "avo_api" do
|
@@ -33,7 +33,7 @@ Avo::Engine.routes.draw do
|
|
33
33
|
|
34
34
|
# Generate resource routes as below:
|
35
35
|
# resources :posts
|
36
|
-
Avo::DynamicRouter.routes
|
36
|
+
Avo::DynamicRouter.routes(self)
|
37
37
|
|
38
38
|
# Associations
|
39
39
|
get "/:resource_name/:id/:related_name/new", to: "associations#new", as: "associations_new"
|
data/db/factories.rb
CHANGED
@@ -60,11 +60,6 @@ FactoryBot.define do
|
|
60
60
|
type { "Spouse" }
|
61
61
|
end
|
62
62
|
|
63
|
-
factory :sibling do
|
64
|
-
name { "#{Faker::Name.first_name} #{Faker::Name.last_name}" }
|
65
|
-
type { "Sibling" }
|
66
|
-
end
|
67
|
-
|
68
63
|
factory :fish do
|
69
64
|
name { %w[Tilapia Salmon Trout Catfish Pangasius Carp].sample }
|
70
65
|
end
|
data/lib/avo/app.rb
CHANGED
@@ -17,14 +17,6 @@ module Avo
|
|
17
17
|
class_attribute :error_messages
|
18
18
|
|
19
19
|
class << self
|
20
|
-
def eager_load(entity)
|
21
|
-
paths = Avo::ENTITIES.fetch entity
|
22
|
-
|
23
|
-
return unless paths.present?
|
24
|
-
|
25
|
-
Rails.autoloaders.main.eager_load_dir(Rails.root.join(*paths).to_s)
|
26
|
-
end
|
27
|
-
|
28
20
|
def boot
|
29
21
|
init_fields
|
30
22
|
|
@@ -99,7 +91,7 @@ module Avo
|
|
99
91
|
has_model = resource.model_class.present?
|
100
92
|
|
101
93
|
unless has_model
|
102
|
-
possible_model = resource.class.to_s.gsub
|
94
|
+
possible_model = resource.class.to_s.gsub 'Resource', ''
|
103
95
|
|
104
96
|
Avo::App.error_messages.push({
|
105
97
|
url: "https://docs.avohq.io/2.0/resources.html#custom-model-class",
|
@@ -127,8 +119,6 @@ module Avo
|
|
127
119
|
end
|
128
120
|
|
129
121
|
def init_dashboards
|
130
|
-
eager_load :dashboards unless Rails.application.config.eager_load
|
131
|
-
|
132
122
|
self.dashboards = Dashboards::BaseDashboard.descendants
|
133
123
|
.select do |dashboard|
|
134
124
|
dashboard != Dashboards::BaseDashboard
|
data/lib/avo/base_action.rb
CHANGED
@@ -34,9 +34,9 @@ module Avo
|
|
34
34
|
def form_data_attributes
|
35
35
|
# We can't respond with a file download from Turbo se we disable it on the form
|
36
36
|
if may_download_file
|
37
|
-
{turbo: false, remote: false
|
37
|
+
{turbo: false, remote: false}
|
38
38
|
else
|
39
|
-
{
|
39
|
+
{"turbo-frame": "_top", "action-target": "form"}
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
data/lib/avo/base_resource.rb
CHANGED
@@ -49,7 +49,6 @@ module Avo
|
|
49
49
|
class_attribute :record_selector, default: true
|
50
50
|
class_attribute :keep_filters_panel_open, default: false
|
51
51
|
class_attribute :extra_params
|
52
|
-
class_attribute :link_to_child_resource, default: false
|
53
52
|
|
54
53
|
class << self
|
55
54
|
delegate :t, to: ::I18n
|
@@ -423,7 +422,9 @@ module Avo
|
|
423
422
|
end
|
424
423
|
|
425
424
|
def label
|
426
|
-
label_field
|
425
|
+
label_field.value || model_title
|
426
|
+
rescue
|
427
|
+
model_title
|
427
428
|
end
|
428
429
|
|
429
430
|
def avatar_field
|
@@ -459,7 +460,9 @@ module Avo
|
|
459
460
|
end
|
460
461
|
|
461
462
|
def description
|
462
|
-
description_field
|
463
|
+
description_field.value
|
464
|
+
rescue
|
465
|
+
nil
|
463
466
|
end
|
464
467
|
|
465
468
|
def form_scope
|
@@ -16,7 +16,7 @@ class Avo::Configuration::Branding
|
|
16
16
|
@default_chart_colors = ["#0B8AE2", "#34C683", "#2AB1EE", "#34C6A8"]
|
17
17
|
@default_logo = "/avo-assets/logo.png"
|
18
18
|
@default_logomark = "/avo-assets/logomark.png"
|
19
|
-
@default_placeholder = "
|
19
|
+
@default_placeholder = "placeholder.svg"
|
20
20
|
end
|
21
21
|
|
22
22
|
def css_colors
|
data/lib/avo/dynamic_router.rb
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
module Avo
|
2
|
-
|
3
|
-
def self.routes
|
4
|
-
|
5
|
-
scope "resources", as: "resources" do
|
6
|
-
Avo::App.eager_load(:resources) unless Rails.application.config.eager_load
|
2
|
+
module DynamicRouter
|
3
|
+
def self.routes(router)
|
4
|
+
Rails.application.eager_load! unless Rails.env.production?
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
BaseResource.descendants
|
7
|
+
.select do |resource|
|
8
|
+
resource != :BaseResource
|
9
|
+
end
|
10
|
+
.select do |resource|
|
11
|
+
resource.is_a? Class
|
12
|
+
end
|
13
|
+
# .select do |resource|
|
14
|
+
# resource.model_class.present?
|
15
|
+
# end
|
16
|
+
.map do |resource|
|
17
|
+
router.resources resource.new.route_key
|
18
18
|
end
|
19
|
-
end
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
data/lib/avo/engine.rb
CHANGED
@@ -27,7 +27,15 @@ module Avo
|
|
27
27
|
end
|
28
28
|
|
29
29
|
initializer "avo.autoload" do |app|
|
30
|
-
|
30
|
+
[
|
31
|
+
["app", "avo", "fields"],
|
32
|
+
["app", "avo", "filters"],
|
33
|
+
["app", "avo", "actions"],
|
34
|
+
["app", "avo", "resources"],
|
35
|
+
["app", "avo", "dashboards"],
|
36
|
+
["app", "avo", "cards"],
|
37
|
+
["app", "avo", "resource_tools"]
|
38
|
+
].each do |path_params|
|
31
39
|
path = Rails.root.join(*path_params)
|
32
40
|
|
33
41
|
if File.directory? path.to_s
|
@@ -7,7 +7,6 @@ module Avo
|
|
7
7
|
attr_accessor :description
|
8
8
|
attr_accessor :discreet_pagination
|
9
9
|
attr_accessor :hide_search_input
|
10
|
-
attr_reader :link_to_child_resource
|
11
10
|
|
12
11
|
def initialize(id, **args, &block)
|
13
12
|
super(id, **args, &block)
|
@@ -20,7 +19,6 @@ module Avo
|
|
20
19
|
@description = args[:description]
|
21
20
|
@use_resource = args[:use_resource] || nil
|
22
21
|
@discreet_pagination = args[:discreet_pagination] || false
|
23
|
-
@link_to_child_resource = args[:link_to_child_resource] || false
|
24
22
|
end
|
25
23
|
|
26
24
|
def searchable
|
data/lib/avo/panel.rb
CHANGED
@@ -1,19 +1,16 @@
|
|
1
1
|
class Avo::Panel
|
2
2
|
include Avo::Concerns::IsResourceItem
|
3
|
-
include Avo::Concerns::VisibleItems
|
4
3
|
|
5
4
|
class_attribute :item_type, default: :panel
|
6
5
|
|
7
6
|
attr_reader :name
|
8
|
-
attr_reader :view
|
9
7
|
attr_reader :description
|
10
8
|
attr_accessor :items_holder
|
11
9
|
|
12
10
|
delegate :items, :add_item, to: :items_holder
|
13
11
|
|
14
|
-
def initialize(name: nil, description: nil
|
12
|
+
def initialize(name: nil, description: nil)
|
15
13
|
@name = name
|
16
|
-
@view = view
|
17
14
|
@description = description
|
18
15
|
@items_holder = Avo::ItemsHolder.new
|
19
16
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Avo
|
2
|
+
module Services
|
3
|
+
module AuthorizationClients
|
4
|
+
class NilClient
|
5
|
+
def authorize(user, record, action, policy_class: nil)
|
6
|
+
true
|
7
|
+
end
|
8
|
+
|
9
|
+
def policy(user, record)
|
10
|
+
NilPolicy.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def policy!(user, record)
|
14
|
+
NilPolicy.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def apply_policy(user, model, policy_class: nil)
|
18
|
+
model
|
19
|
+
end
|
20
|
+
|
21
|
+
class NilPolicy
|
22
|
+
def initialize(user = nil, record = nil)
|
23
|
+
end
|
24
|
+
# rubocop:enable Style/RedundantInitialize
|
25
|
+
|
26
|
+
def method_missing(method, *args, &block)
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
def respond_to_missing?
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -9,8 +9,12 @@ module Avo
|
|
9
9
|
def client
|
10
10
|
client = Avo.configuration.authorization_client
|
11
11
|
|
12
|
+
client = nil if Avo::App.license.lacks(:authorization)
|
13
|
+
|
12
14
|
klass = case client
|
13
|
-
when
|
15
|
+
when nil
|
16
|
+
nil_client
|
17
|
+
when :pundit
|
14
18
|
pundit_client
|
15
19
|
else
|
16
20
|
if client.is_a?(String)
|
@@ -92,8 +96,14 @@ module Avo
|
|
92
96
|
end
|
93
97
|
|
94
98
|
def pundit_client
|
99
|
+
raise Avo::MissingGemError.new("Please add `gem 'pundit'` to your Gemfile.") unless defined?(Pundit)
|
100
|
+
|
95
101
|
Avo::Services::AuthorizationClients::PunditClient
|
96
102
|
end
|
103
|
+
|
104
|
+
def nil_client
|
105
|
+
Avo::Services::AuthorizationClients::NilClient
|
106
|
+
end
|
97
107
|
end
|
98
108
|
|
99
109
|
def initialize(user = nil, record = nil, policy_class: nil)
|
data/lib/avo/sidebar.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
class Avo::Sidebar
|
2
2
|
include Avo::Concerns::IsResourceItem
|
3
|
-
include Avo::Concerns::VisibleItems
|
4
3
|
include Avo::Fields::FieldExtensions::VisibleInDifferentViews
|
5
4
|
|
6
5
|
class_attribute :item_type, default: :sidebar
|
@@ -24,7 +23,38 @@ class Avo::Sidebar
|
|
24
23
|
except_on args[:except_on] if args[:except_on].present?
|
25
24
|
end
|
26
25
|
|
26
|
+
def hydrate(view: nil)
|
27
|
+
@view = view
|
28
|
+
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
27
32
|
def empty?
|
28
33
|
visible_items.blank?
|
29
34
|
end
|
35
|
+
|
36
|
+
def items
|
37
|
+
if self.items_holder.present?
|
38
|
+
self.items_holder.items
|
39
|
+
else
|
40
|
+
[]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def visible_items
|
45
|
+
items.map do |item|
|
46
|
+
# Remove the fields that shouldn't be visible in this view
|
47
|
+
# eg: has_many fields on edit
|
48
|
+
if not_visible_field(item)
|
49
|
+
nil
|
50
|
+
else
|
51
|
+
item
|
52
|
+
end
|
53
|
+
end
|
54
|
+
.compact
|
55
|
+
end
|
56
|
+
|
57
|
+
def not_visible_field(item)
|
58
|
+
item.is_field? && !item.visible_on?(view)
|
59
|
+
end
|
30
60
|
end
|
data/lib/avo/tab.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
class Avo::Tab
|
2
2
|
include Avo::Concerns::IsResourceItem
|
3
|
-
include Avo::Concerns::VisibleItems
|
4
3
|
include Avo::Fields::FieldExtensions::VisibleInDifferentViews
|
5
4
|
|
6
5
|
class_attribute :item_type, default: :tab
|
@@ -31,10 +30,6 @@ class Avo::Tab
|
|
31
30
|
def hydrate(view: nil)
|
32
31
|
@view = view
|
33
32
|
|
34
|
-
items_holder.items.grep(Avo::Panel).each do |panel|
|
35
|
-
panel.hydrate(view: view)
|
36
|
-
end
|
37
|
-
|
38
33
|
self
|
39
34
|
end
|
40
35
|
|
@@ -58,4 +53,26 @@ class Avo::Tab
|
|
58
53
|
super(view)
|
59
54
|
end
|
60
55
|
end
|
56
|
+
|
57
|
+
def items
|
58
|
+
if self.items_holder.present?
|
59
|
+
self.items_holder.items
|
60
|
+
else
|
61
|
+
[]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def visible_items
|
66
|
+
items.map do |item|
|
67
|
+
if item.is_field?
|
68
|
+
visible = item.visible_on?(view)
|
69
|
+
# Remove the fields that shouldn't be visible in this view
|
70
|
+
# eg: has_many fields on edit
|
71
|
+
item = nil unless visible
|
72
|
+
end
|
73
|
+
|
74
|
+
item
|
75
|
+
end
|
76
|
+
.compact
|
77
|
+
end
|
61
78
|
end
|
data/lib/avo/version.rb
CHANGED
data/lib/avo.rb
CHANGED
@@ -40,15 +40,6 @@ module Avo
|
|
40
40
|
IN_DEVELOPMENT = ENV["AVO_IN_DEVELOPMENT"] == "1"
|
41
41
|
PACKED = !IN_DEVELOPMENT
|
42
42
|
COOKIES_KEY = "avo"
|
43
|
-
ENTITIES = {
|
44
|
-
cards: ["app", "avo", "cards"],
|
45
|
-
fields: ["app", "avo", "fields"],
|
46
|
-
filters: ["app", "avo", "filters"],
|
47
|
-
actions: ["app", "avo", "actions"],
|
48
|
-
resources: ["app", "avo", "resources"],
|
49
|
-
dashboards: ["app", "avo", "dashboards"],
|
50
|
-
resource_tools: ["app", "avo", "resource_tools"]
|
51
|
-
}
|
52
43
|
|
53
44
|
class LicenseVerificationTemperedError < StandardError; end
|
54
45
|
|
@@ -57,6 +48,8 @@ module Avo
|
|
57
48
|
class NotAuthorizedError < StandardError; end
|
58
49
|
|
59
50
|
class NoPolicyError < StandardError; end
|
51
|
+
|
52
|
+
class MissingGemError < StandardError; end
|
60
53
|
end
|
61
54
|
|
62
55
|
loader.eager_load
|
@@ -7783,16 +7783,6 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
7783
7783
|
line-height:1.5rem
|
7784
7784
|
}
|
7785
7785
|
|
7786
|
-
.text-xl{
|
7787
|
-
font-size:1.25rem;
|
7788
|
-
line-height:1.75rem
|
7789
|
-
}
|
7790
|
-
|
7791
|
-
.text-xs{
|
7792
|
-
font-size:0.75rem;
|
7793
|
-
line-height:1rem
|
7794
|
-
}
|
7795
|
-
|
7796
7786
|
.text-3xl{
|
7797
7787
|
font-size:1.875rem;
|
7798
7788
|
line-height:2.25rem
|
@@ -7803,6 +7793,16 @@ trix-toolbar .trix-button-group:not(:first-child){
|
|
7803
7793
|
line-height:1
|
7804
7794
|
}
|
7805
7795
|
|
7796
|
+
.text-xl{
|
7797
|
+
font-size:1.25rem;
|
7798
|
+
line-height:1.75rem
|
7799
|
+
}
|
7800
|
+
|
7801
|
+
.text-xs{
|
7802
|
+
font-size:0.75rem;
|
7803
|
+
line-height:1rem
|
7804
|
+
}
|
7805
|
+
|
7806
7806
|
.text-2xl{
|
7807
7807
|
font-size:1.5rem;
|
7808
7808
|
line-height:2rem
|
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.18.1
|
4
|
+
version: 2.18.1
|
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-
|
12
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: '0'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: httparty
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1309,6 +1309,7 @@ files:
|
|
1309
1309
|
- app/assets/svgs/menu-back.svg
|
1310
1310
|
- app/assets/svgs/menu.svg
|
1311
1311
|
- app/assets/svgs/photograph.svg
|
1312
|
+
- app/assets/svgs/placeholder.svg
|
1312
1313
|
- app/assets/svgs/play.svg
|
1313
1314
|
- app/assets/svgs/plus-circle.svg
|
1314
1315
|
- app/assets/svgs/plus.svg
|
@@ -1595,7 +1596,7 @@ files:
|
|
1595
1596
|
- app/controllers/avo/associations_controller.rb
|
1596
1597
|
- app/controllers/avo/attachments_controller.rb
|
1597
1598
|
- app/controllers/avo/base_controller.rb
|
1598
|
-
- app/controllers/avo/
|
1599
|
+
- app/controllers/avo/cards_controller.rb
|
1599
1600
|
- app/controllers/avo/dashboards_controller.rb
|
1600
1601
|
- app/controllers/avo/debug_controller.rb
|
1601
1602
|
- app/controllers/avo/home_controller.rb
|
@@ -1658,10 +1659,10 @@ files:
|
|
1658
1659
|
- app/views/avo/base/index.html.erb
|
1659
1660
|
- app/views/avo/base/new.html.erb
|
1660
1661
|
- app/views/avo/base/show.html.erb
|
1661
|
-
- app/views/avo/
|
1662
|
-
- app/views/avo/
|
1663
|
-
- app/views/avo/
|
1664
|
-
- app/views/avo/
|
1662
|
+
- app/views/avo/cards/_chartkick_card.html.erb
|
1663
|
+
- app/views/avo/cards/_metric_card.html.erb
|
1664
|
+
- app/views/avo/cards/chartkick_missing.html.erb
|
1665
|
+
- app/views/avo/cards/show.html.erb
|
1665
1666
|
- app/views/avo/dashboards/show.html.erb
|
1666
1667
|
- app/views/avo/debug/index.html.erb
|
1667
1668
|
- app/views/avo/debug/report.html.erb
|
@@ -1727,7 +1728,6 @@ files:
|
|
1727
1728
|
- lib/avo/concerns/has_stimulus_controllers.rb
|
1728
1729
|
- lib/avo/concerns/is_resource_item.rb
|
1729
1730
|
- lib/avo/concerns/model_class_constantized.rb
|
1730
|
-
- lib/avo/concerns/visible_items.rb
|
1731
1731
|
- lib/avo/configuration.rb
|
1732
1732
|
- lib/avo/configuration/branding.rb
|
1733
1733
|
- lib/avo/configuration/resource_configuration.rb
|
@@ -1829,6 +1829,7 @@ files:
|
|
1829
1829
|
- lib/avo/resources/controls/execution_context.rb
|
1830
1830
|
- lib/avo/resources/controls/items_holder.rb
|
1831
1831
|
- lib/avo/resources/controls/link_to.rb
|
1832
|
+
- lib/avo/services/authorization_clients/nil_client.rb
|
1832
1833
|
- lib/avo/services/authorization_clients/pundit_client.rb
|
1833
1834
|
- lib/avo/services/authorization_service.rb
|
1834
1835
|
- lib/avo/services/encryption_service.rb
|
@@ -1928,7 +1929,6 @@ files:
|
|
1928
1929
|
- public/avo-assets/logo-on-white.png
|
1929
1930
|
- public/avo-assets/logo.png
|
1930
1931
|
- public/avo-assets/logomark.png
|
1931
|
-
- public/avo-assets/placeholder.svg
|
1932
1932
|
homepage: https://avohq.io
|
1933
1933
|
licenses:
|
1934
1934
|
- Commercial
|
@@ -1949,9 +1949,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1949
1949
|
version: 2.4.0
|
1950
1950
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1951
1951
|
requirements:
|
1952
|
-
- - "
|
1952
|
+
- - ">="
|
1953
1953
|
- !ruby/object:Gem::Version
|
1954
|
-
version:
|
1954
|
+
version: '0'
|
1955
1955
|
requirements: []
|
1956
1956
|
rubygems_version: 3.3.3
|
1957
1957
|
signing_key:
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require_dependency "avo/application_controller"
|
2
|
-
|
3
|
-
module Avo
|
4
|
-
module Dashboards
|
5
|
-
class CardsController < ApplicationController
|
6
|
-
before_action :set_dashboard
|
7
|
-
before_action :set_card
|
8
|
-
before_action :detect_chartkick
|
9
|
-
|
10
|
-
def show
|
11
|
-
render(:chartkick_missing) unless @chartkick_installed
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def set_dashboard
|
17
|
-
@dashboard = Avo::App.get_dashboard_by_id params[:dashboard_id]
|
18
|
-
|
19
|
-
raise ActionController::RoutingError.new("Not Found") if @dashboard.nil? || @dashboard.is_hidden?
|
20
|
-
end
|
21
|
-
|
22
|
-
def set_card
|
23
|
-
@card = @dashboard.item_at_index(params[:index].to_i).tap do |card|
|
24
|
-
card.hydrate(dashboard: @dashboard, params: params)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def detect_chartkick
|
29
|
-
@chartkick_installed = if @card.class.ancestors.map(&:to_s).include?("Avo::Dashboards::ChartkickCard")
|
30
|
-
defined?(Chartkick)
|
31
|
-
else
|
32
|
-
true
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# This concern helps us figure out what items are visible for each tab, panel or sidebar
|
2
|
-
module Avo
|
3
|
-
module Concerns
|
4
|
-
module VisibleItems
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
def items
|
7
|
-
if items_holder.present?
|
8
|
-
items_holder.items
|
9
|
-
else
|
10
|
-
[]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def visible_items
|
15
|
-
items
|
16
|
-
.map do |item|
|
17
|
-
visible(item) ? item : nil
|
18
|
-
end
|
19
|
-
.compact
|
20
|
-
end
|
21
|
-
|
22
|
-
def visible(item)
|
23
|
-
if item.is_field?
|
24
|
-
item.visible? && item.visible_on?(view)
|
25
|
-
else
|
26
|
-
item.visible?
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def visible?
|
31
|
-
any_item_visible = visible_items.any?
|
32
|
-
return any_item_visible unless respond_to?(:visible_on?)
|
33
|
-
|
34
|
-
visible_on?(view) && any_item_visible
|
35
|
-
end
|
36
|
-
|
37
|
-
def hydrate(view: nil)
|
38
|
-
@view = view
|
39
|
-
|
40
|
-
self
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|