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:
Diffstat (limited to 'app/views/ci/charts')
-rw-r--r--app/views/ci/charts/_build_times.haml21
-rw-r--r--app/views/ci/charts/_builds.haml41
-rw-r--r--app/views/ci/charts/_overall.haml21
-rw-r--r--app/views/ci/charts/show.html.haml4
4 files changed, 87 insertions, 0 deletions
diff --git a/app/views/ci/charts/_build_times.haml b/app/views/ci/charts/_build_times.haml
new file mode 100644
index 00000000000..c3c2f572414
--- /dev/null
+++ b/app/views/ci/charts/_build_times.haml
@@ -0,0 +1,21 @@
+%fieldset
+ %legend
+ Commit duration in minutes for last 30 commits
+
+ %canvas#build_timesChart.padded{width: 800, height: 300}
+
+:javascript
+ var data = {
+ labels : #{@charts[:build_times].labels.to_json},
+ datasets : [
+ {
+ fillColor : "#4A3",
+ strokeColor : "rgba(151,187,205,1)",
+ pointColor : "rgba(151,187,205,1)",
+ pointStrokeColor : "#fff",
+ data : #{@charts[:build_times].build_times.to_json}
+ }
+ ]
+ }
+ var ctx = $("#build_timesChart").get(0).getContext("2d");
+ new Chart(ctx).Line(data,{"scaleOverlay": true});
diff --git a/app/views/ci/charts/_builds.haml b/app/views/ci/charts/_builds.haml
new file mode 100644
index 00000000000..1b0039fb834
--- /dev/null
+++ b/app/views/ci/charts/_builds.haml
@@ -0,0 +1,41 @@
+%fieldset
+ %legend
+ Builds chart for last week
+ (#{date_from_to(Date.today - 7.days, Date.today)})
+
+ %canvas#weekChart.padded{width: 800, height: 200}
+
+%fieldset
+ %legend
+ Builds chart for last month
+ (#{date_from_to(Date.today - 30.days, Date.today)})
+
+ %canvas#monthChart.padded{width: 800, height: 300}
+
+%fieldset
+ %legend Builds chart for last year
+ %canvas#yearChart.padded{width: 800, height: 400}
+
+- [:week, :month, :year].each do |scope|
+ :javascript
+ var data = {
+ labels : #{@charts[scope].labels.to_json},
+ datasets : [
+ {
+ fillColor : "rgba(220,220,220,0.5)",
+ strokeColor : "rgba(220,220,220,1)",
+ pointColor : "rgba(220,220,220,1)",
+ pointStrokeColor : "#EEE",
+ data : #{@charts[scope].total.to_json}
+ },
+ {
+ fillColor : "#4A3",
+ strokeColor : "rgba(151,187,205,1)",
+ pointColor : "rgba(151,187,205,1)",
+ pointStrokeColor : "#fff",
+ data : #{@charts[scope].success.to_json}
+ }
+ ]
+ }
+ var ctx = $("##{scope}Chart").get(0).getContext("2d");
+ new Chart(ctx).Line(data,{"scaleOverlay": true});
diff --git a/app/views/ci/charts/_overall.haml b/app/views/ci/charts/_overall.haml
new file mode 100644
index 00000000000..f522f35a629
--- /dev/null
+++ b/app/views/ci/charts/_overall.haml
@@ -0,0 +1,21 @@
+%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
new file mode 100644
index 00000000000..b5fcfc1563c
--- /dev/null
+++ b/app/views/ci/charts/show.html.haml
@@ -0,0 +1,4 @@
+#charts
+ = render 'builds'
+ = render 'build_times'
+= render 'overall'