Admin dashboard

This commit is contained in:
randx 2012-04-20 19:41:49 +03:00
parent 1d601616a3
commit 35e21b3402
5 changed files with 76 additions and 1 deletions

View file

@ -903,3 +903,20 @@ li.note {
.milestone {
@extend .wll;
}
/**
* Admin area
*
*/
.admin_dash {
.data {
a {
h1 {
line-height:48px;
font-size:48px;
padding:20px;
text-align:center;
}
}
}
}

View file

@ -0,0 +1,12 @@
class Admin::DashboardController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :authenticate_admin!
def index
@workers = Resque.workers
@pending_jobs = Resque.size(:post_receive)
@projects = Project.order("created_at DESC").limit(10)
@users = User.order("created_at DESC").limit(10)
end
end

View file

@ -0,0 +1,45 @@
.admin_dash.row
.span4
.ui-box
%h5
Resque Workers
.data.padded
= link_to "/info/resque" do
%h1{:class => @workers.present? ? "cgreen" : "cred"}
= @workers.count
%hr
%p
%strong{:class => @pending_jobs > 0 ? "cred" : "cgreen"}
#{@pending_jobs} post receive jobs waiting
.span4
.ui-box
%h5 Projects
.data.padded
= link_to admin_projects_path do
%h1= Project.count
%hr
= link_to 'New Project', new_admin_project_path, :class => "btn small"
.span4
.ui-box
%h5 Users
.data.padded
= link_to admin_users_path do
%h1= User.count
%hr
= link_to 'New User', new_admin_user_path, :class => "btn small"
.row
.span6
%h3 Latest projects
%hr
- @projects.each do |project|
%h5
= link_to project.name, [:admin, project]
.span6
%h3 Latest users
%hr
- @users.each do |user|
%h5
= link_to user.name, [:admin, user]

View file

@ -7,6 +7,7 @@
.container
%nav.main_menu
= render "layouts/const_menu_links"
= link_to "Stats", admin_root_path, :class => controller.controller_name == "dashboard" ? "current" : nil
= link_to "Projects", admin_projects_path, :class => controller.controller_name == "projects" ? "current" : nil
= link_to "Users", admin_users_path, :class => controller.controller_name == "users" ? "current" : nil
= link_to "Emails", admin_emails_path, :class => controller.controller_name == "mailer" ? "current" : nil

View file

@ -29,7 +29,7 @@ Gitlab::Application.routes.draw do
get 'mailer/preview_note'
get 'mailer/preview_user_new'
get 'mailer/preview_issue_new'
root :to => "users#index"
root :to => "dashboard#index"
end
get "errors/githost"