Class: Lesli::Shared::Dashboard
- Inherits:
-
ApplicationLesliRecord
- Object
- ActiveRecord::Base
- ApplicationLesliRecord
- Lesli::Shared::Dashboard
- Defined in:
- app/models/lesli/shared/dashboard.rb
Class Method Summary collapse
- .initialize_dashboard(modelo, account, components) ⇒ void
-
.options(current_user, query) ⇒ Hash
Hash containing the options to create and manage dashboards.
Instance Method Summary collapse
-
#show ⇒ Hash
Hash of containing the information of the dashboard and its components.
Class Method Details
.initialize_dashboard(modelo, account, components) ⇒ void
This method returns an undefined value.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/models/lesli/shared/dashboard.rb', line 55 def self.initialize_dashboard(modelo, account, components) components.unshift({ name: "Engine version", component_id: "engine-version", layout: 2, query_configuration: {}, custom_configuration: {} }) modelo.create_with( default: true, main: false, components_attributes: components ).find_or_create_by!( account: account, name: "Default Dashboard" ) end |
.options(current_user, query) ⇒ Hash
Returns Hash containing the options to create and manage dashboards.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'app/models/lesli/shared/dashboard.rb', line 104 def self.(current_user, query) dynamic_info = self.dynamic_info component_model = dynamic_info[:module_model_component] component_ids = component_model.component_ids.map do |comp| { value: comp, text: comp } end = { component_ids: component_ids, #components_configuration_options: component_model.configuration_options, descriptions: {} } if block_given? yield() else return end end |
Instance Method Details
#show ⇒ Hash
Returns Hash of containing the information of the dashboard and its components.
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'app/models/lesli/shared/dashboard.rb', line 81 def show attributes.merge({ components: components.order(index: :asc) # components: [{ # name: "ticket", # component_id: "ticket" # },{ # name: "ticket", # component_id: "ticket" # }] }) end |