Class: Impac::Dashboard

Inherits:
BaseResource
  • Object
show all
Defined in:
app/models/mno_enterprise/impac/dashboard.rb

Instance Method Summary collapse

Instance Method Details

#filtered_widgets_templatesObject

Filter widgets list based on config



31
32
33
34
35
36
37
38
39
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 31

def filtered_widgets_templates
  if MnoEnterprise.widgets_templates_listing
    return self.widgets_templates.select do |t|
      MnoEnterprise.widgets_templates_listing.include?(t[:path])
    end
  else
    return self.widgets_templates
  end
end

#full_nameObject

Instance methods

Return the full name of this dashboard Currently a simple accessor to the dashboard name (used to include the company name)



15
16
17
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 15

def full_name
  self.name
end

#organizationsObject

Return all the organizations linked to this dashboard and to which the user has access



21
22
23
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 21

def organizations
  MnoEnterprise::Organization.where('uid.in' => self.organization_ids).to_a
end

#sorted_widgetsObject



25
26
27
28
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 25

def sorted_widgets
  order = self.widgets_order.map(&:to_i) | self.widgets.map{|w| w.id }
  order.map { |id| self.widgets.to_a.find{ |w| w.id == id} }.compact
end

#to_audit_eventObject



41
42
43
# File 'app/models/mno_enterprise/impac/dashboard.rb', line 41

def to_audit_event
  name
end