summaryrefslogtreecommitdiff
path: root/app/views/projects/graphs
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/projects/graphs')
-rw-r--r--app/views/projects/graphs/_head.html.haml19
-rw-r--r--app/views/projects/graphs/charts.html.haml (renamed from app/views/projects/graphs/commits.html.haml)92
-rw-r--r--app/views/projects/graphs/ci.html.haml18
-rw-r--r--app/views/projects/graphs/ci/_build_times.haml27
-rw-r--r--app/views/projects/graphs/ci/_builds.haml56
-rw-r--r--app/views/projects/graphs/ci/_overall.haml19
-rw-r--r--app/views/projects/graphs/languages.html.haml33
-rw-r--r--app/views/projects/graphs/show.html.haml7
8 files changed, 67 insertions, 204 deletions
diff --git a/app/views/projects/graphs/_head.html.haml b/app/views/projects/graphs/_head.html.haml
deleted file mode 100644
index 67018aaa2ac..00000000000
--- a/app/views/projects/graphs/_head.html.haml
+++ /dev/null
@@ -1,19 +0,0 @@
-= content_for :sub_nav do
- .scrolling-tabs-container.sub-nav-scroll
- = render 'shared/nav_scroll'
- .nav-links.sub-nav.scrolling-tabs
- %ul{ class: (container_class) }
-
- - content_for :page_specific_javascripts do
- = page_specific_javascript_bundle_tag('lib_chart')
- = page_specific_javascript_bundle_tag('graphs')
- = nav_link(action: :show) do
- = link_to 'Contributors', namespace_project_graph_path
- = nav_link(action: :commits) do
- = link_to 'Commits', commits_namespace_project_graph_path
- = nav_link(action: :languages) do
- = link_to 'Languages', languages_namespace_project_graph_path
- - if @project.feature_available?(:builds, current_user)
- = nav_link(action: :ci) do
- = link_to ci_namespace_project_graph_path do
- Continuous Integration
diff --git a/app/views/projects/graphs/commits.html.haml b/app/views/projects/graphs/charts.html.haml
index c8a82f7bca3..464ac34d961 100644
--- a/app/views/projects/graphs/commits.html.haml
+++ b/app/views/projects/graphs/charts.html.haml
@@ -1,38 +1,58 @@
- @no_container = true
-- page_title "Commits", "Graphs"
-= render 'head'
+- page_title "Charts"
+- content_for :page_specific_javascripts do
+ = page_specific_javascript_bundle_tag('common_d3')
+ = page_specific_javascript_bundle_tag('graphs')
+= render "projects/commits/head"
-%div{ class: container_class }
- .sub-header-block
- .tree-ref-holder
- = render 'shared/ref_switcher', destination: 'graphs_commits'
- %ul.breadcrumb.repo-breadcrumb
- = commits_breadcrumbs
+.repo-charts{ class: container_class }
+ %h4.sub-header
+ Programming languages used in this repository
- %p.lead
- Commit statistics for
- %strong= @ref
- #{@commits_graph.start_date.strftime('%b %d')} - #{@commits_graph.end_date.strftime('%b %d')}
+ .row
+ .col-md-4
+ %ul.bordered-list
+ - @languages.each do |language|
+ %li
+ %span{ style: "color: #{language[:color]}" }
+ = icon('circle')
+  
+ = language[:label]
+ .pull-right
+ = language[:value]
+ \%
+ .col-md-8
+ %canvas#languages-chart{ height: 400 }
+
+.repo-charts{ class: container_class }
+ .sub-header-block.border-top
+
+ .row.tree-ref-header
+ .col-md-6
+ %h4
+ Commit statistics for
+ %strong= @ref
+ #{@commits_graph.start_date.strftime('%b %d')} - #{@commits_graph.end_date.strftime('%b %d')}
+
+ .col-md-6
+ .tree-ref-container
+ .tree-ref-holder
+ = render 'shared/ref_switcher', destination: 'graphs_commits'
+ %ul.breadcrumb.repo-breadcrumb
+ = commits_breadcrumbs
.row
.col-md-6
- %ul
+ %ul.commit-stats
%li
- %p.lead
- %strong= @commits_graph.commits.size
- commits during
- %strong= @commits_graph.duration
- days
+ Total:
+ %strong #{@commits_graph.commits.size} commits
%li
- %p.lead
- Average
- %strong= @commits_graph.commit_per_day
- commits per day
+ Average per day:
+ %strong #{@commits_graph.commit_per_day} commits
%li
- %p.lead
- Contributed by
- %strong= @commits_graph.authors
- authors
+ Authors:
+ %strong= @commits_graph.authors
.col-md-6
%div
%p.slead
@@ -40,15 +60,18 @@
%canvas#month-chart
.row
.col-md-6
- %div
- %p.slead
- Commits per day hour (UTC)
- %canvas#hour-chart
.col-md-6
%div
%p.slead
Commits per weekday
%canvas#weekday-chart
+ .row
+ .col-md-6
+ .col-md-6
+ %div
+ %p.slead
+ Commits per day hour (UTC)
+ %canvas#hour-chart
:javascript
var responsiveChart = function (selector, data) {
@@ -93,3 +116,12 @@
var monthData = chartData(#{@commits_per_month.keys.to_json}, #{@commits_per_month.values.to_json});
responsiveChart($('#month-chart'), monthData);
+
+ var data = #{@languages.to_json};
+ var ctx = $("#languages-chart").get(0).getContext("2d");
+ var options = {
+ scaleOverlay: true,
+ responsive: true,
+ maintainAspectRatio: false
+ }
+ var myPieChart = new Chart(ctx).Pie(data, options);
diff --git a/app/views/projects/graphs/ci.html.haml b/app/views/projects/graphs/ci.html.haml
deleted file mode 100644
index 6be4273b6ab..00000000000
--- a/app/views/projects/graphs/ci.html.haml
+++ /dev/null
@@ -1,18 +0,0 @@
-- @no_container = true
-- page_title "Continuous Integration", "Graphs"
-= render 'head'
-
-%div{ class: container_class }
- .sub-header-block
- .oneline
- A collection of graphs for Continuous Integration
-
- #charts.ci-charts
- .row
- .col-md-6
- = render 'projects/graphs/ci/overall'
- .col-md-6
- = render 'projects/graphs/ci/build_times'
-
- %hr
- = render 'projects/graphs/ci/builds'
diff --git a/app/views/projects/graphs/ci/_build_times.haml b/app/views/projects/graphs/ci/_build_times.haml
deleted file mode 100644
index bb0975a9535..00000000000
--- a/app/views/projects/graphs/ci/_build_times.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-%div
- %p.light
- Commit duration in minutes for last 30 commits
-
- %canvas#build_timesChart{ height: 200 }
-
-:javascript
- var data = {
- labels : #{@charts[:build_times].labels.to_json},
- datasets : [
- {
- fillColor : "rgba(220,220,220,0.5)",
- strokeColor : "rgba(220,220,220,1)",
- barStrokeWidth: 1,
- barValueSpacing: 1,
- barDatasetSpacing: 1,
- data : #{@charts[:build_times].build_times.to_json}
- }
- ]
- }
- var ctx = $("#build_timesChart").get(0).getContext("2d");
- var options = { scaleOverlay: true, responsive: true, maintainAspectRatio: false };
- if (window.innerWidth < 768) {
- // Scale fonts if window width lower than 768px (iPad portrait)
- options.scaleFontSize = 8
- }
- new Chart(ctx).Bar(data, options);
diff --git a/app/views/projects/graphs/ci/_builds.haml b/app/views/projects/graphs/ci/_builds.haml
deleted file mode 100644
index b6f453b9736..00000000000
--- a/app/views/projects/graphs/ci/_builds.haml
+++ /dev/null
@@ -1,56 +0,0 @@
-%h4 Pipelines charts
-%p
- &nbsp;
- %span.cgreen
- = icon("circle")
- success
- &nbsp;
- %span.cgray
- = icon("circle")
- all
-
-.prepend-top-default
- %p.light
- Jobs for last week
- (#{date_from_to(Date.today - 7.days, Date.today)})
- %canvas#weekChart{ height: 200 }
-
-.prepend-top-default
- %p.light
- Jobs for last month
- (#{date_from_to(Date.today - 30.days, Date.today)})
- %canvas#monthChart{ height: 200 }
-
-.prepend-top-default
- %p.light
- Jobs for last year
- %canvas#yearChart.padded{ height: 250 }
-
-- [:week, :month, :year].each do |scope|
- :javascript
- var data = {
- labels : #{@charts[scope].labels.to_json},
- datasets : [
- {
- fillColor : "#7f8fa4",
- strokeColor : "#7f8fa4",
- pointColor : "#7f8fa4",
- pointStrokeColor : "#EEE",
- data : #{@charts[scope].total.to_json}
- },
- {
- fillColor : "#44aa22",
- strokeColor : "#44aa22",
- pointColor : "#44aa22",
- pointStrokeColor : "#fff",
- data : #{@charts[scope].success.to_json}
- }
- ]
- }
- var ctx = $("##{scope}Chart").get(0).getContext("2d");
- var options = { scaleOverlay: true, responsive: true, maintainAspectRatio: false };
- if (window.innerWidth < 768) {
- // Scale fonts if window width lower than 768px (iPad portrait)
- options.scaleFontSize = 8
- }
- new Chart(ctx).Line(data, options);
diff --git a/app/views/projects/graphs/ci/_overall.haml b/app/views/projects/graphs/ci/_overall.haml
deleted file mode 100644
index edc4f7b079f..00000000000
--- a/app/views/projects/graphs/ci/_overall.haml
+++ /dev/null
@@ -1,19 +0,0 @@
-%h4 Overall stats
-%ul
- %li
- Total:
- %strong= pluralize @project.builds.count(:all), 'build'
- %li
- Successful:
- %strong= pluralize @project.builds.success.count(:all), 'build'
- %li
- Failed:
- %strong= pluralize @project.builds.failed.count(:all), 'build'
- %li
- Success ratio:
- %strong
- #{success_ratio(@project.builds.success, @project.builds.failed)}%
- %li
- Commits covered:
- %strong
- = @project.pipelines.count(:all)
diff --git a/app/views/projects/graphs/languages.html.haml b/app/views/projects/graphs/languages.html.haml
deleted file mode 100644
index fcfcae0be20..00000000000
--- a/app/views/projects/graphs/languages.html.haml
+++ /dev/null
@@ -1,33 +0,0 @@
-- @no_container = true
-- page_title "Languages", "Graphs"
-= render 'head'
-
-%div{ class: container_class }
- .sub-header-block
- .oneline
- Programming languages used in this repository
-
- .row
- .col-md-8
- %canvas#languages-chart{ height: 400 }
- .col-md-4
- %ul.bordered-list
- - @languages.each do |language|
- %li
- %span{ style: "color: #{language[:color]}" }
- = icon('circle')
- &nbsp;
- = language[:label]
- .pull-right
- = language[:value]
- \%
-
-:javascript
- var data = #{@languages.to_json};
- var ctx = $("#languages-chart").get(0).getContext("2d");
- var options = {
- scaleOverlay: true,
- responsive: true,
- maintainAspectRatio: false
- }
- var myPieChart = new Chart(ctx).Pie(data, options);
diff --git a/app/views/projects/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml
index 5ebb939a109..680f8ae6c8f 100644
--- a/app/views/projects/graphs/show.html.haml
+++ b/app/views/projects/graphs/show.html.haml
@@ -1,6 +1,9 @@
- @no_container = true
-- page_title "Contributors", "Graphs"
-= render 'head'
+- page_title "Contributors"
+- content_for :page_specific_javascripts do
+ = page_specific_javascript_bundle_tag('common_d3')
+ = page_specific_javascript_bundle_tag('graphs')
+= render 'projects/commits/head'
%div{ class: container_class }
.sub-header-block