From 81b08d9b977837e2e714f9782ba90b664f36b98c Mon Sep 17 00:00:00 2001 From: hellekin Date: Fri, 9 Oct 2020 10:33:41 +0200 Subject: Add some stats --- app/controllers/welcome_controller.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 48167b2..ee73270 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -50,6 +50,26 @@ class WelcomeController < ApplicationController # GET /dashboard def dashboard redirect_to '/authenticate' and return unless current_user.present? + + @stats = { + counts: { + resources: Resource.count, + agents: Agent.count, + categories: Category.count, + sections: Section.count + }, + current_agent: { + name: current_agent.name, + uuid: current_agent.uuid, + counts: { + resources: current_agent.resources.count, + taxonomies: current_agent.taxonomies.count, + categories: current_agent.categories.count, + sectiions: current_agent.sections.count + } + }, + my_agents: current_user.agents.map { |a| { uuid: a.uuid, name: a.name } } + } end # GET /logout -- cgit v1.2.3