Module: OpenLoam::Dashboard

Defined in:
lib/open_loam/dashboard.rb

Overview

Resolves the admin dashboard for the current tenant/actor: the ordered, role-visible, computed widgets to show. Uses the tenant's configured OpenLoam::DashboardWidget rows (a manager arranges them); falls back to every registered widget in registration order when the tenant has configured none, so the dashboard is useful out of the box.

Class Method Summary collapse

Class Method Details

.for(actor:, role:) ⇒ Object



10
11
12
13
14
15
# File 'lib/open_loam/dashboard.rb', line 10

def for(actor:, role:)
  configured = OpenLoam::DashboardWidget.active.ordered.pluck(:widget_key)
  keys = configured.presence || OpenLoam::Widgets.keys

  keys.filter_map { |key| OpenLoam::Widgets.resolve(key, actor: actor, role: role) }
end