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
@@ -70,7 +70,7 @@ module Avo
70
70
  @searchable = args[:searchable] == true
71
71
  @polymorphic_as = args[:polymorphic_as]
72
72
  @types = args[:types]
73
- @relation_method = name.to_s.parameterize.underscore
73
+ @relation_method = id.to_s.parameterize.underscore
74
74
  end
75
75
 
76
76
  def searchable
@@ -19,7 +19,7 @@ module Avo
19
19
  return if value.blank?
20
20
 
21
21
  if @format.is_a?(Symbol)
22
- value.to_s(@format)
22
+ value.to_formatted_s(@format)
23
23
  else
24
24
  value.strftime(@format)
25
25
  end
@@ -11,8 +11,8 @@ module Avo
11
11
 
12
12
  @link_to_resource = args[:link_to_resource].present? ? args[:link_to_resource] : false
13
13
 
14
- @width = args[:width].present? ? args[:width] : 32
15
- @height = args[:height].present? ? args[:height] : 32
14
+ @width = args[:width].present? ? args[:width] : 40
15
+ @height = args[:height].present? ? args[:height] : 40
16
16
  @radius = args[:radius].present? ? args[:radius] : 0
17
17
  end
18
18
 
@@ -2,14 +2,19 @@ module Avo
2
2
  module FieldsCollector
3
3
  def field(field_name, as:, **args, &block)
4
4
  self.fields ||= []
5
+ self.invalid_fields ||= []
5
6
 
6
7
  field_instance = parse_field(field_name, as: as, **args, &block)
7
8
 
8
9
  if field_instance.present?
9
10
  self.fields << field_instance
10
11
  else
11
- message = "[Avo] The #{field_name} field, as: #{as} from #{self.name} has an invalid configuration."
12
- ::Rails.logger.warn message
12
+ self.invalid_fields << ({
13
+ name: field_name,
14
+ as: as,
15
+ resource: name,
16
+ message: "There's an invalid field configuration for this resource. <br/> <code class='px-1 py-px rounded bg-red-600'>field :#{field_name}, as: #{as}</code>"
17
+ })
13
18
  end
14
19
  end
15
20
 
@@ -10,6 +10,7 @@ module Avo
10
10
  option :dashboard
11
11
  option :card
12
12
  option :params
13
+ option :options
13
14
 
14
15
  delegate :result, to: :card
15
16
 
@@ -0,0 +1,19 @@
1
+ require "dry-initializer"
2
+
3
+ module Avo
4
+ module Hosts
5
+ class DashboardVisibility
6
+ extend Dry::Initializer
7
+
8
+ option :block, default: proc { proc {} }
9
+ option :current_user, default: proc { ::Avo::App.current_user }
10
+ option :context, default: proc { ::Avo::App.context }
11
+ option :dashboard
12
+ option :params, default: proc { ::Avo::App.params }
13
+
14
+ def handle
15
+ instance_exec(&block)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -4,6 +4,7 @@ module Avo
4
4
  def abilities
5
5
  [
6
6
  :authorization,
7
+ :localization,
7
8
  :custom_tools,
8
9
  :custom_fields,
9
10
  :global_search,
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.2.pre1"
3
3
  end
@@ -3,7 +3,10 @@ class <%= class_name.camelize %> < Avo::Dashboards::BaseDashboard
3
3
  self.name = "<%= name.underscore.humanize %>"
4
4
  # self.description = "Tiny dashboard description"
5
5
  # self.grid_cols = 3
6
+ # self.visible = -> do
7
+ # true
8
+ # end
6
9
 
7
10
  # cards go here
8
- # card metric: UsersCount
11
+ # card UsersCount
9
12
  end
@@ -6220,10 +6220,6 @@ progress[value]::-moz-progress-bar{
6220
6220
  left:0px
6221
6221
  }
6222
6222
 
6223
- .bottom-0{
6224
- bottom:0px
6225
- }
6226
-
6227
6223
  .left-1\/2{
6228
6224
  left:50%
6229
6225
  }
@@ -6232,6 +6228,10 @@ progress[value]::-moz-progress-bar{
6232
6228
  top:50%
6233
6229
  }
6234
6230
 
6231
+ .bottom-0{
6232
+ bottom:0px
6233
+ }
6234
+
6235
6235
  .left-auto{
6236
6236
  left:auto
6237
6237
  }
@@ -6377,14 +6377,6 @@ progress[value]::-moz-progress-bar{
6377
6377
  margin-top:0.25rem
6378
6378
  }
6379
6379
 
6380
- .mb-4{
6381
- margin-bottom:1rem
6382
- }
6383
-
6384
- .mr-1{
6385
- margin-right:0.25rem
6386
- }
6387
-
6388
6380
  .-ml-20{
6389
6381
  margin-left:-5rem
6390
6382
  }
@@ -6413,6 +6405,14 @@ progress[value]::-moz-progress-bar{
6413
6405
  margin-top:-2.5rem
6414
6406
  }
6415
6407
 
6408
+ .mb-4{
6409
+ margin-bottom:1rem
6410
+ }
6411
+
6412
+ .mr-1{
6413
+ margin-right:0.25rem
6414
+ }
6415
+
6416
6416
  .mr-4{
6417
6417
  margin-right:1rem
6418
6418
  }
@@ -6437,6 +6437,10 @@ progress[value]::-moz-progress-bar{
6437
6437
  margin-bottom:0.5rem
6438
6438
  }
6439
6439
 
6440
+ .mt-6{
6441
+ margin-top:1.5rem
6442
+ }
6443
+
6440
6444
  .mt-3{
6441
6445
  margin-top:0.75rem
6442
6446
  }
@@ -6545,10 +6549,6 @@ progress[value]::-moz-progress-bar{
6545
6549
  height:100%
6546
6550
  }
6547
6551
 
6548
- .h-6{
6549
- height:1.5rem
6550
- }
6551
-
6552
6552
  .h-40{
6553
6553
  height:10rem
6554
6554
  }
@@ -6561,6 +6561,10 @@ progress[value]::-moz-progress-bar{
6561
6561
  height:2rem
6562
6562
  }
6563
6563
 
6564
+ .h-6{
6565
+ height:1.5rem
6566
+ }
6567
+
6564
6568
  .h-\[250px\]{
6565
6569
  height:250px
6566
6570
  }
@@ -6681,8 +6685,8 @@ progress[value]::-moz-progress-bar{
6681
6685
  max-width:100%
6682
6686
  }
6683
6687
 
6684
- .max-w-sm{
6685
- max-width:24rem
6688
+ .max-w-lg{
6689
+ max-width:32rem
6686
6690
  }
6687
6691
 
6688
6692
  .max-w-xs{
@@ -6991,6 +6995,10 @@ progress[value]::-moz-progress-bar{
6991
6995
  border-width:1px
6992
6996
  }
6993
6997
 
6998
+ .border-b-2{
6999
+ border-bottom-width:2px
7000
+ }
7001
+
6994
7002
  .border-b{
6995
7003
  border-bottom-width:1px
6996
7004
  }
@@ -7007,6 +7015,10 @@ progress[value]::-moz-progress-bar{
7007
7015
  border-left-width:1px
7008
7016
  }
7009
7017
 
7018
+ .border-dashed{
7019
+ border-style:dashed
7020
+ }
7021
+
7010
7022
  .border-slate-500{
7011
7023
  --tw-border-opacity:1;
7012
7024
  border-color:rgb(100 116 139 / var(--tw-border-opacity))
@@ -7162,6 +7174,11 @@ progress[value]::-moz-progress-bar{
7162
7174
  border-color:rgb(87 93 102 / var(--tw-border-opacity))
7163
7175
  }
7164
7176
 
7177
+ .bg-red-600{
7178
+ --tw-bg-opacity:1;
7179
+ background-color:rgb(220 38 38 / var(--tw-bg-opacity))
7180
+ }
7181
+
7165
7182
  .bg-white{
7166
7183
  --tw-bg-opacity:1;
7167
7184
  background-color:rgb(255 255 255 / var(--tw-bg-opacity))
@@ -7279,6 +7296,16 @@ progress[value]::-moz-progress-bar{
7279
7296
  padding:0.25rem
7280
7297
  }
7281
7298
 
7299
+ .px-1{
7300
+ padding-left:0.25rem;
7301
+ padding-right:0.25rem
7302
+ }
7303
+
7304
+ .py-px{
7305
+ padding-top:1px;
7306
+ padding-bottom:1px
7307
+ }
7308
+
7282
7309
  .px-2{
7283
7310
  padding-left:0.5rem;
7284
7311
  padding-right:0.5rem
@@ -7314,6 +7341,11 @@ progress[value]::-moz-progress-bar{
7314
7341
  padding-right:0px
7315
7342
  }
7316
7343
 
7344
+ .py-12{
7345
+ padding-top:3rem;
7346
+ padding-bottom:3rem
7347
+ }
7348
+
7317
7349
  .py-6{
7318
7350
  padding-top:1.5rem;
7319
7351
  padding-bottom:1.5rem
@@ -7324,11 +7356,6 @@ progress[value]::-moz-progress-bar{
7324
7356
  padding-right:1.5rem
7325
7357
  }
7326
7358
 
7327
- .py-12{
7328
- padding-top:3rem;
7329
- padding-bottom:3rem
7330
- }
7331
-
7332
7359
  .py-0\.5{
7333
7360
  padding-top:0.125rem;
7334
7361
  padding-bottom:0.125rem
@@ -7344,21 +7371,11 @@ progress[value]::-moz-progress-bar{
7344
7371
  padding-bottom:0px
7345
7372
  }
7346
7373
 
7347
- .px-1{
7348
- padding-left:0.25rem;
7349
- padding-right:0.25rem
7350
- }
7351
-
7352
7374
  .py-4{
7353
7375
  padding-top:1rem;
7354
7376
  padding-bottom:1rem
7355
7377
  }
7356
7378
 
7357
- .py-px{
7358
- padding-top:1px;
7359
- padding-bottom:1px
7360
- }
7361
-
7362
7379
  .py-24{
7363
7380
  padding-top:6rem;
7364
7381
  padding-bottom:6rem
@@ -7836,7 +7853,7 @@ html, body{
7836
7853
 
7837
7854
  .turbo-progress-bar{
7838
7855
  --tw-bg-opacity:1;
7839
- background-color:rgb(34 197 94 / var(--tw-bg-opacity))
7856
+ background-color:rgb(44 164 247 / var(--tw-bg-opacity))
7840
7857
  }
7841
7858
 
7842
7859
  body.os-mac .mac\:hidden {
@@ -8712,6 +8729,10 @@ trix-editor {
8712
8729
  }
8713
8730
 
8714
8731
  @media (min-width: 1280px){
8732
+ .xl\:right-0{
8733
+ right:0px
8734
+ }
8735
+
8715
8736
  .xl\:mt-0{
8716
8737
  margin-top:0px
8717
8738
  }