summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-04-20 19:41:49 +0300
committerrandx <dmitriy.zaporozhets@gmail.com>2012-04-20 19:41:49 +0300
commit35e21b3402ae934a33b31aa7d6049abaf861f766 (patch)
treebacd4f045419d02318d5eb9183c3f029b6c61a87
parent1d601616a33aaa95e2ac7b21ff041b4a840df33c (diff)
downloadgitlab-ce-35e21b3402ae934a33b31aa7d6049abaf861f766.tar.gz
Admin dashboard
-rw-r--r--app/assets/stylesheets/common.scss17
-rw-r--r--app/controllers/admin/dashboard_controller.rb12
-rw-r--r--app/views/admin/dashboard/index.html.haml45
-rw-r--r--app/views/layouts/admin.html.haml1
-rw-r--r--config/routes.rb2
5 files changed, 76 insertions, 1 deletions
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index a0b3abbfbfa..4752dfd4d7f 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -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;
+ }
+ }
+ }
+}
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb
new file mode 100644
index 00000000000..ad80f4d5903
--- /dev/null
+++ b/app/controllers/admin/dashboard_controller.rb
@@ -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
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml
new file mode 100644
index 00000000000..b5b453d5185
--- /dev/null
+++ b/app/views/admin/dashboard/index.html.haml
@@ -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]
diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml
index a71dd57de02..2d5387c0357 100644
--- a/app/views/layouts/admin.html.haml
+++ b/app/views/layouts/admin.html.haml
@@ -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
diff --git a/config/routes.rb b/config/routes.rb
index 6e29ec7e3dd..a6e32bc1f5b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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"