From 2759b13ae99dc1d30516123390bbdb73258fa270 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Thu, 24 Sep 2015 15:08:33 +0200
Subject: [PATCH] Remove CI dashboard

With CI status integrated at GitLab projects page there is no reason to keep it
anymore.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 CHANGELOG                                   |  1 +
 app/controllers/ci/projects_controller.rb   | 16 ++------------
 app/views/ci/projects/_project.html.haml    | 24 ---------------------
 app/views/ci/projects/_public.html.haml     | 16 --------------
 app/views/ci/projects/_search.html.haml     |  6 ------
 app/views/ci/projects/index.html.haml       | 17 ---------------
 app/views/layouts/ci/_nav_project.html.haml |  5 +++--
 app/views/layouts/ci/_page.html.haml        |  5 +++--
 app/views/layouts/nav/_dashboard.html.haml  |  5 -----
 spec/features/ci/projects_spec.rb           | 10 ---------
 10 files changed, 9 insertions(+), 96 deletions(-)
 delete mode 100644 app/views/ci/projects/_project.html.haml
 delete mode 100644 app/views/ci/projects/_public.html.haml
 delete mode 100644 app/views/ci/projects/_search.html.haml
 delete mode 100644 app/views/ci/projects/index.html.haml

diff --git a/CHANGELOG b/CHANGELOG
index 48d2b646339..710f99cbf51 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@ v 8.1.0 (unreleased)
   - Add first and last to pagination (Zeger-Jan van de Weg)
   - Show CI status on commit page
   - Show CI status on Your projects page and Starred projects page
+  - Remove "Continuous Integration" page from dashboard
 
 v 8.0.2 (unreleased)
   - Skip check_initd_configured_correctly on omnibus installs
diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb
index 250a2e79313..6111753a7fb 100644
--- a/app/controllers/ci/projects_controller.rb
+++ b/app/controllers/ci/projects_controller.rb
@@ -1,9 +1,9 @@
 module Ci
   class ProjectsController < Ci::ApplicationController
-    before_action :authenticate_user!, except: [:build, :badge, :index, :show]
+    before_action :authenticate_user!, except: [:build, :badge, :show]
     before_action :authenticate_public_page!, only: :show
     before_action :project, only: [:build, :show, :badge, :edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
-    before_action :authorize_access_project!, except: [:build, :badge, :index, :show, :new, :disabled]
+    before_action :authorize_access_project!, except: [:build, :badge, :show, :new, :disabled]
     before_action :authorize_manage_project!, only: [:edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
     before_action :authenticate_token!, only: [:build]
     before_action :no_cache, only: [:badge]
@@ -15,18 +15,6 @@ module Ci
     def disabled
     end
 
-    def index
-      @projects = Ci::Project.all
-
-      if current_user
-        @projects = @projects.where(gitlab_id: current_user.authorized_projects.pluck(:id))
-      end
-
-      @projects = @projects.search(params[:search]) if params[:search].present?
-      @projects = @projects.includes(:last_commit).order('ci_commits.created_at DESC')
-      @projects = @projects.page(params[:page]).per(40)
-    end
-
     def show
       @ref = params[:ref]
 
diff --git a/app/views/ci/projects/_project.html.haml b/app/views/ci/projects/_project.html.haml
deleted file mode 100644
index 58022de9bc1..00000000000
--- a/app/views/ci/projects/_project.html.haml
+++ /dev/null
@@ -1,24 +0,0 @@
-- last_commit = project.last_commit
-%tr
-  %td
-    = link_to [:ci, project] do
-      = project.name
-  %td
-    - if last_commit
-      = ci_status_with_icon(last_commit.status)
-      = commit_link(last_commit)
-      &middot;
-      - if project.last_commit_date
-        = time_ago_in_words project.last_commit_date
-        ago
-    - else
-      No builds yet
-  %td
-    - if project.public
-      %i.fa.fa-globe
-      Public
-    - else
-      %i.fa.fa-lock
-      Private
-  %td
-    = project.commits.count
diff --git a/app/views/ci/projects/_public.html.haml b/app/views/ci/projects/_public.html.haml
deleted file mode 100644
index bcbd60b83f0..00000000000
--- a/app/views/ci/projects/_public.html.haml
+++ /dev/null
@@ -1,16 +0,0 @@
-= content_for :title do
-  %h3.project-title
-    Public projects
-
-- if @projects.present?
-  .projects
-    %table.table
-      %tr
-        %th Name
-        %th Last commit
-        %th Access
-        %th Commits
-      = render @projects
-  = paginate @projects
-- else
-  %h4 No public projects yet
diff --git a/app/views/ci/projects/_search.html.haml b/app/views/ci/projects/_search.html.haml
deleted file mode 100644
index a956ed4c0bc..00000000000
--- a/app/views/ci/projects/_search.html.haml
+++ /dev/null
@@ -1,6 +0,0 @@
-.search
-  = form_tag ci_root_path, method: :get, class: 'ci-search-form' do |f|
-    .input-group
-      = search_field_tag "search", params[:search], placeholder: "Search", class: "search-input form-control"
-      .input-group-addon
-        %i.fa.fa-search
diff --git a/app/views/ci/projects/index.html.haml b/app/views/ci/projects/index.html.haml
deleted file mode 100644
index 046095a3c12..00000000000
--- a/app/views/ci/projects/index.html.haml
+++ /dev/null
@@ -1,17 +0,0 @@
-- if current_user
-  .gray-content-block.top-block
-    = render "search"
-  .projects
-    .wide-table-holder
-      %table.table.projects-table.content-list
-        %thead
-          %tr
-            %th Project Name
-            %th Last commit
-            %th Access
-            %th Commits
-
-        = render @projects
-    = paginate @projects, theme: 'gitlab'
-- else
-  = render 'public'
diff --git a/app/views/layouts/ci/_nav_project.html.haml b/app/views/layouts/ci/_nav_project.html.haml
index 284735e45c4..7daf9342e42 100644
--- a/app/views/layouts/ci/_nav_project.html.haml
+++ b/app/views/layouts/ci/_nav_project.html.haml
@@ -1,8 +1,9 @@
 %ul.nav.nav-sidebar
   = nav_link do
-    = link_to ci_root_path, title: 'Back to CI projects', data: {placement: 'right'}, class: 'back-link' do
+    = link_to project_path(@project.gl_project), title: 'Back to project', data: {placement: 'right'}, class: 'back-link' do
       = icon('caret-square-o-left fw')
-      %span= 'Back to CI projects'
+      %span
+        Back to project
   %li.separate-item
   = nav_link path: ['projects#show', 'commits#show', 'builds#show'] do
     = link_to ci_project_path(@project) do
diff --git a/app/views/layouts/ci/_page.html.haml b/app/views/layouts/ci/_page.html.haml
index c598f63c4c8..bb5ec727bff 100644
--- a/app/views/layouts/ci/_page.html.haml
+++ b/app/views/layouts/ci/_page.html.haml
@@ -2,10 +2,11 @@
   = render "layouts/broadcast"
   .sidebar-wrapper.nicescroll
     .header-logo
-      = link_to ci_root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do
+      = link_to root_path, class: 'home', title: 'Dashboard', id: 'js-shortcuts-home', data: {toggle: 'tooltip', placement: 'bottom'} do
         = brand_header_logo
         .gitlab-text-container
-          %h3 GitLab CI
+          %h3 GitLab
+
     - if defined?(sidebar) && sidebar
       = render "layouts/ci/#{sidebar}"
     - elsif current_user
diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml
index b94165aac39..21d8655131f 100644
--- a/app/views/layouts/nav/_dashboard.html.haml
+++ b/app/views/layouts/nav/_dashboard.html.haml
@@ -31,11 +31,6 @@
         %span
           Merge Requests
           %span.count= current_user.assigned_merge_requests.opened.count
-  = nav_link(path: ['ci/projects#index', 'ci/projects#disabled']) do
-    = link_to ci_projects_path, title: 'Continuous Integration', data: {placement: 'right'} do
-      = icon('building fw')
-      %span
-        Continuous Integration
   = nav_link(controller: :snippets) do
     = link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do
       = icon('clipboard fw')
diff --git a/spec/features/ci/projects_spec.rb b/spec/features/ci/projects_spec.rb
index 2ae6a7a29f8..7c8cd1ce5c7 100644
--- a/spec/features/ci/projects_spec.rb
+++ b/spec/features/ci/projects_spec.rb
@@ -9,16 +9,6 @@ describe "Projects" do
     @project.gl_project.team << [user, :master]
   end
 
-  describe "GET /ci/projects", js: true do
-    before do
-      stub_js_gitlab_calls
-      visit ci_projects_path
-    end
-
-    it { expect(page).to have_content "GitLab / gitlab-shell" }
-    it { expect(page).to have_selector ".search input#search" }
-  end
-
   describe "GET /ci/projects/:id" do
     before do
       visit ci_project_path(@project)
-- 
GitLab