Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal Pandya <kushalspandya@gmail.com>2017-03-02 20:57:01 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-03-02 20:57:01 +0300
commit52352be6be357d30be9760d5b442e97806eb0e10 (patch)
treed82f3f157d50ca3a59edbd1834ea65aa54d6bc38 /app/views/projects/pipelines/charts
parentf14ee823d703119aed8500f3cd868f12bcd103bc (diff)
Cleaning up navigational order - Project
Diffstat (limited to 'app/views/projects/pipelines/charts')
-rw-r--r--app/views/projects/pipelines/charts/_build_times.haml27
-rw-r--r--app/views/projects/pipelines/charts/_builds.haml56
-rw-r--r--app/views/projects/pipelines/charts/_overall.haml19
3 files changed, 102 insertions, 0 deletions
diff --git a/app/views/projects/pipelines/charts/_build_times.haml b/app/views/projects/pipelines/charts/_build_times.haml
new file mode 100644
index 00000000000..bb0975a9535
--- /dev/null
+++ b/app/views/projects/pipelines/charts/_build_times.haml
@@ -0,0 +1,27 @@
+%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/pipelines/charts/_builds.haml b/app/views/projects/pipelines/charts/_builds.haml
new file mode 100644
index 00000000000..b6f453b9736
--- /dev/null
+++ b/app/views/projects/pipelines/charts/_builds.haml
@@ -0,0 +1,56 @@
+%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/pipelines/charts/_overall.haml b/app/views/projects/pipelines/charts/_overall.haml
new file mode 100644
index 00000000000..edc4f7b079f
--- /dev/null
+++ b/app/views/projects/pipelines/charts/_overall.haml
@@ -0,0 +1,19 @@
+%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)