summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/ci/charts_controller.rb24
-rw-r--r--app/controllers/projects/graphs_controller.rb10
-rw-r--r--app/views/ci/charts/_overall.haml21
-rw-r--r--app/views/ci/charts/show.html.haml4
-rw-r--r--app/views/layouts/ci/_nav_project.html.haml6
-rw-r--r--app/views/projects/graphs/_head.html.haml4
-rw-r--r--app/views/projects/graphs/ci.html.haml6
-rw-r--r--app/views/projects/graphs/ci/_build_times.haml (renamed from app/views/ci/charts/_build_times.haml)0
-rw-r--r--app/views/projects/graphs/ci/_builds.haml (renamed from app/views/ci/charts/_builds.haml)0
-rw-r--r--app/views/projects/graphs/ci/_overall.haml22
-rw-r--r--config/routes.rb1
-rw-r--r--features/project/graph.feature6
-rw-r--r--features/steps/project/graph.rb22
-rw-r--r--spec/features/ci/projects_spec.rb12
14 files changed, 69 insertions, 69 deletions
diff --git a/app/controllers/ci/charts_controller.rb b/app/controllers/ci/charts_controller.rb
deleted file mode 100644
index aa875e70987..00000000000
--- a/app/controllers/ci/charts_controller.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-module Ci
- class ChartsController < Ci::ApplicationController
- before_action :authenticate_user!
- before_action :project
- before_action :authorize_access_project!
- before_action :authorize_manage_project!
-
- layout 'ci/project'
-
- def show
- @charts = {}
- @charts[:week] = Ci::Charts::WeekChart.new(@project)
- @charts[:month] = Ci::Charts::MonthChart.new(@project)
- @charts[:year] = Ci::Charts::YearChart.new(@project)
- @charts[:build_times] = Ci::Charts::BuildTime.new(@project)
- end
-
- protected
-
- def project
- @project = Ci::Project.find(params[:project_id])
- end
- end
-end
diff --git a/app/controllers/projects/graphs_controller.rb b/app/controllers/projects/graphs_controller.rb
index 0b6f7f5c91e..8bc5746a42c 100644
--- a/app/controllers/projects/graphs_controller.rb
+++ b/app/controllers/projects/graphs_controller.rb
@@ -23,6 +23,16 @@ class Projects::GraphsController < Projects::ApplicationController
@commits_per_month = @commits_graph.commits_per_month
end
+ def ci
+ ci_project = @project.gitlab_ci_project
+
+ @charts = {}
+ @charts[:week] = Ci::Charts::WeekChart.new(ci_project)
+ @charts[:month] = Ci::Charts::MonthChart.new(ci_project)
+ @charts[:year] = Ci::Charts::YearChart.new(ci_project)
+ @charts[:build_times] = Ci::Charts::BuildTime.new(ci_project)
+ end
+
private
def fetch_graph
diff --git a/app/views/ci/charts/_overall.haml b/app/views/ci/charts/_overall.haml
deleted file mode 100644
index f522f35a629..00000000000
--- a/app/views/ci/charts/_overall.haml
+++ /dev/null
@@ -1,21 +0,0 @@
-%fieldset
- %legend Overall
- %p
- Total:
- %strong= pluralize @project.builds.count(:all), 'build'
- %p
- Successful:
- %strong= pluralize @project.builds.success.count(:all), 'build'
- %p
- Failed:
- %strong= pluralize @project.builds.failed.count(:all), 'build'
-
- %p
- Success ratio:
- %strong
- #{success_ratio(@project.builds.success, @project.builds.failed)}%
-
- %p
- Commits covered:
- %strong
- = @project.commits.count(:all)
diff --git a/app/views/ci/charts/show.html.haml b/app/views/ci/charts/show.html.haml
deleted file mode 100644
index 0497f037721..00000000000
--- a/app/views/ci/charts/show.html.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-#charts.ci-charts
- = render 'builds'
- = render 'build_times'
-= render 'overall'
diff --git a/app/views/layouts/ci/_nav_project.html.haml b/app/views/layouts/ci/_nav_project.html.haml
index cb1dece073c..284735e45c4 100644
--- a/app/views/layouts/ci/_nav_project.html.haml
+++ b/app/views/layouts/ci/_nav_project.html.haml
@@ -10,12 +10,6 @@
%span
Commits
%span.count= @project.commits.count
- - if can?(current_user, :admin_project, gl_project)
- = nav_link path: 'charts#show' do
- = link_to ci_project_charts_path(@project) do
- = icon('bar-chart fw')
- %span
- Charts
= nav_link path: ['runners#index', 'runners#show', 'runners#edit'] do
= link_to ci_project_runners_path(@project) do
= icon('cog fw')
diff --git a/app/views/projects/graphs/_head.html.haml b/app/views/projects/graphs/_head.html.haml
index 9383df13305..bbfaf422a82 100644
--- a/app/views/projects/graphs/_head.html.haml
+++ b/app/views/projects/graphs/_head.html.haml
@@ -3,3 +3,7 @@
= link_to 'Contributors', namespace_project_graph_path
= nav_link(action: :commits) do
= link_to 'Commits', commits_namespace_project_graph_path
+ - if @project.gitlab_ci?
+ = nav_link(action: :ci) do
+ = link_to ci_namespace_project_graph_path do
+ Continuous Integration
diff --git a/app/views/projects/graphs/ci.html.haml b/app/views/projects/graphs/ci.html.haml
new file mode 100644
index 00000000000..2e07b67f8c0
--- /dev/null
+++ b/app/views/projects/graphs/ci.html.haml
@@ -0,0 +1,6 @@
+- page_title "Continuous Integration", "Graphs"
+= render 'head'
+#charts.ci-charts
+ = render 'projects/graphs/ci/builds'
+ = render 'projects/graphs/ci/build_times'
+= render 'projects/graphs/ci/overall'
diff --git a/app/views/ci/charts/_build_times.haml b/app/views/projects/graphs/ci/_build_times.haml
index c3c2f572414..c3c2f572414 100644
--- a/app/views/ci/charts/_build_times.haml
+++ b/app/views/projects/graphs/ci/_build_times.haml
diff --git a/app/views/ci/charts/_builds.haml b/app/views/projects/graphs/ci/_builds.haml
index 1b0039fb834..1b0039fb834 100644
--- a/app/views/ci/charts/_builds.haml
+++ b/app/views/projects/graphs/ci/_builds.haml
diff --git a/app/views/projects/graphs/ci/_overall.haml b/app/views/projects/graphs/ci/_overall.haml
new file mode 100644
index 00000000000..9550d719471
--- /dev/null
+++ b/app/views/projects/graphs/ci/_overall.haml
@@ -0,0 +1,22 @@
+- ci_project = @project.gitlab_ci_project
+%fieldset
+ %legend Overall
+ %p
+ Total:
+ %strong= pluralize ci_project.builds.count(:all), 'build'
+ %p
+ Successful:
+ %strong= pluralize ci_project.builds.success.count(:all), 'build'
+ %p
+ Failed:
+ %strong= pluralize ci_project.builds.failed.count(:all), 'build'
+
+ %p
+ Success ratio:
+ %strong
+ #{success_ratio(ci_project.builds.success, ci_project.builds.failed)}%
+
+ %p
+ Commits covered:
+ %strong
+ = ci_project.commits.count(:all)
diff --git a/config/routes.rb b/config/routes.rb
index 512dda7b547..4a07c449b4e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -511,6 +511,7 @@ Gitlab::Application.routes.draw do
resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do
member do
get :commits
+ get :ci
end
end
diff --git a/features/project/graph.feature b/features/project/graph.feature
index 89064242c1c..2acd65aea5f 100644
--- a/features/project/graph.feature
+++ b/features/project/graph.feature
@@ -12,3 +12,9 @@ Feature: Project Graph
Scenario: I should see project commits graphs
When I visit project "Shop" commits graph page
Then page should have commits graphs
+
+ @javascript
+ Scenario: I should see project ci graphs
+ Given project "Shop" has CI enabled
+ When I visit project "Shop" CI graph page
+ Then page should have CI graphs
diff --git a/features/steps/project/graph.rb b/features/steps/project/graph.rb
index 5e7e573a6ab..9f9d099961d 100644
--- a/features/steps/project/graph.rb
+++ b/features/steps/project/graph.rb
@@ -7,12 +7,10 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
end
When 'I visit project "Shop" graph page' do
- project = Project.find_by(name: "Shop")
visit namespace_project_graph_path(project.namespace, project, "master")
end
step 'I visit project "Shop" commits graph page' do
- project = Project.find_by(name: "Shop")
visit commits_namespace_project_graph_path(project.namespace, project, "master")
end
@@ -20,4 +18,24 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
expect(page).to have_content "Commit statistics for master"
expect(page).to have_content "Commits per day of month"
end
+
+ step 'I visit project "Shop" CI graph page' do
+ visit ci_namespace_project_graph_path(project.namespace, project, 'master')
+ end
+
+ step 'project "Shop" has CI enabled' do
+ project.enable_ci(@user)
+ end
+
+ step 'page should have CI graphs' do
+ expect(page).to have_content 'Overall'
+ expect(page).to have_content 'Builds chart for last week'
+ expect(page).to have_content 'Builds chart for last month'
+ expect(page).to have_content 'Builds chart for last year'
+ expect(page).to have_content 'Commit duration in minutes for last 30 commits'
+ end
+
+ def project
+ project ||= Project.find_by(name: "Shop")
+ end
end
diff --git a/spec/features/ci/projects_spec.rb b/spec/features/ci/projects_spec.rb
index ff17aeca447..2ae6a7a29f8 100644
--- a/spec/features/ci/projects_spec.rb
+++ b/spec/features/ci/projects_spec.rb
@@ -45,16 +45,4 @@ describe "Projects" do
expect(find_field('Timeout').value).to eq '70'
end
end
-
- describe "GET /ci/projects/:id/charts" do
- before do
- visit ci_project_charts_path(@project)
- end
-
- it { expect(page).to have_content 'Overall' }
- it { expect(page).to have_content 'Builds chart for last week' }
- it { expect(page).to have_content 'Builds chart for last month' }
- it { expect(page).to have_content 'Builds chart for last year' }
- it { expect(page).to have_content 'Commit duration in minutes for last 30 commits' }
- end
end