diff --git a/app/controllers/madmin/dashboard_controller.rb b/app/controllers/madmin/dashboard_controller.rb new file mode 100644 index 00000000..1bcc26f4 --- /dev/null +++ b/app/controllers/madmin/dashboard_controller.rb @@ -0,0 +1,21 @@ +module Madmin + class DashboardController < Madmin::ApplicationController + def show + @stats = { + projects_active: Project.active.count, + projects_archived: Project.where(status: "archived").count, + stories_pending: Story.pending.count, + stories_approved: Story.approved.count, + stories_rejected: Story.rejected.count, + estimates: Estimate.count, + users: User.count, + comments: Comment.count, + version_jumps: VersionJump.count + } + + @recent_stories = Story.order(created_at: :desc).limit(5) + @recent_projects = Project.order(created_at: :desc).limit(5) + @recent_estimates = Estimate.includes(:story, :user).order(created_at: :desc).limit(5) + end + end +end diff --git a/app/madmin/resources/version_jump_resource.rb b/app/madmin/resources/version_jump_resource.rb index 6bc0f68f..306e61fe 100644 --- a/app/madmin/resources/version_jump_resource.rb +++ b/app/madmin/resources/version_jump_resource.rb @@ -1,9 +1,9 @@ class VersionJumpResource < Madmin::Resource # Attributes attribute :id, form: false - attribute :technology - attribute :initial_version - attribute :target_version + attribute :technology, index: true + attribute :initial_version, index: true + attribute :target_version, index: true # Associations attribute :projects, form: false diff --git a/app/views/madmin/application/_navigation.html.erb b/app/views/madmin/application/_navigation.html.erb index 54f5240a..1b562a15 100644 --- a/app/views/madmin/application/_navigation.html.erb +++ b/app/views/madmin/application/_navigation.html.erb @@ -20,10 +20,18 @@ -