Class: Impac::Dashboard
- Inherits:
-
BaseResource
- Object
- BaseResource
- Impac::Dashboard
- Defined in:
- app/models/mno_enterprise/impac/dashboard.rb
Instance Method Summary collapse
- #copy(owner, name, organization_ids) ⇒ Object
-
#filtered_widgets_templates ⇒ Object
Filter widgets list based on config.
-
#full_name ⇒ Object
Instance methods ============================================ Return the full name of this dashboard Currently a simple accessor to the dashboard name (used to include the company name).
-
#organizations(org_list = nil) ⇒ Object
Return all the organizations linked to this dashboard and to which the user has access If the dashboard is a template, return all the current user’s organization.
- #to_audit_event ⇒ Object
Instance Method Details
#copy(owner, name, organization_ids) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 53 def copy(owner, name, organization_ids) owner_type = owner.class.name.demodulize attrs = { id: self.id, name: name, organization_ids: organization_ids, owner_type: owner_type, owner_id: owner.id } self.class.copy(attrs) end |
#filtered_widgets_templates ⇒ Object
Filter widgets list based on config
36 37 38 39 40 41 42 43 44 |
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 36 def if MnoEnterprise. return self..select do |t| MnoEnterprise..include?(t[:path]) end else return self. end end |
#full_name ⇒ Object
Instance methods
Return the full name of this dashboard Currently a simple accessor to the dashboard name (used to include the company name)
20 21 22 |
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 20 def full_name self.name end |
#organizations(org_list = nil) ⇒ Object
Return all the organizations linked to this dashboard and to which the user has access If the dashboard is a template, return all the current user’s organization
26 27 28 29 30 31 32 33 |
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 26 def organizations(org_list = nil) if org_list return org_list if dashboard_type == 'template' org_list.to_a.select { |e| self.organization_ids.include?(e.uid) } else MnoEnterprise::Organization.where('uid.in' => self.organization_ids).to_a end end |
#to_audit_event ⇒ Object
46 47 48 49 50 51 |
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 46 def to_audit_event { name: name, organization_id: (owner_type == 'Organization') ? owner_id : nil } end |