Class: Backstage::HomeController

Inherits:
ApplicationController show all
Defined in:
app/controllers/backstage/home_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
# File 'app/controllers/backstage/home_controller.rb', line 3

def index
  @resources = Backstage.registry.all_resources.map do |config|
    {config: config, count: config.model_class.count}
  end
  @dashboards = Backstage.registry.all_dashboards.map do |dash|
    rc = dash.resource_config
    count = rc.model_class.where(dash.scope).count
    {dashboard: dash, count: count}
  end
end