summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-23 16:16:45 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-23 16:24:46 +0200
commiteae27d1ecbfec7ea928b27e0ffc96abeb4a49f7a (patch)
tree01bef6563a1313b7bdf13d214bdabd44781d2891 /app
parent4bc1e040d4b7d73bd7afb3dbb95c87983eef2b04 (diff)
downloadgitlab-ce-eae27d1ecbfec7ea928b27e0ffc96abeb4a49f7a.tar.gz
Move CI charts to project graphs area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-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
10 files changed, 42 insertions, 55 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)