Class: Avo::Dashboards::BaseDashboard
- Inherits:
-
Object
- Object
- Avo::Dashboards::BaseDashboard
- Extended by:
- ActiveSupport::DescendantsTracker
- Defined in:
- lib/avo/dashboards/base_dashboard.rb
Class Method Summary collapse
- .card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}) ⇒ Object
- .classes ⇒ Object
- .divider(**args) ⇒ Object
- .is_hidden? ⇒ Boolean
- .is_visible? ⇒ Boolean
- .item_at_index(index) ⇒ Object
- .items ⇒ Object
- .navigation_label ⇒ Object
- .navigation_path ⇒ Object
Class Method Details
.card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 15 def card(klass, label: nil, description: nil, cols: nil, rows: nil, refresh_every: nil, options: {}) self.items_holder ||= [] self.items_holder << klass.new(dashboard: self, label: label, description: description, cols: cols, rows: rows, refresh_every: refresh_every, options: , index: index ) self.index += 1 end |
.classes ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 48 def classes case grid_cols when 3 "sm:grid-cols-3" when 4 "sm:grid-cols-4" when 5 "sm:grid-cols-5" when 6 "sm:grid-cols-6" else "sm:grid-cols-3" end end |
.divider(**args) ⇒ Object
38 39 40 41 42 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 38 def divider(**args) self.items_holder ||= [] self.items_holder << BaseDivider.new(**args) end |
.is_hidden? ⇒ Boolean
83 84 85 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 83 def is_hidden? !is_visible? end |
.is_visible? ⇒ Boolean
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 71 def is_visible? # Default is true return true if visible == true # Hide if false return false if visible == false if visible.respond_to? :call ::Avo::Hosts::DashboardVisibility.new(block: visible, dashboard: self).handle end end |
.item_at_index(index) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 30 def item_at_index(index) items.find do |item| next if item.index.blank? item.index == index end end |
.items ⇒ Object
44 45 46 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 44 def items self.items_holder end |
.navigation_label ⇒ Object
63 64 65 |
# File 'lib/avo/dashboards/base_dashboard.rb', line 63 def name end |