debian-mirror-gitlab/app/views/projects/pipelines/charts/_builds.haml

57 lines
1.4 KiB
Text
Raw Normal View History

2017-08-17 22:00:37 +05:30
%h4 Pipelines charts
2015-11-26 14:37:03 +05:30
%p
 
%span.cgreen
= icon("circle")
success
 
%span.cgray
= icon("circle")
all
2015-09-25 12:07:36 +05:30
2015-11-26 14:37:03 +05:30
.prepend-top-default
%p.light
2017-08-17 22:00:37 +05:30
Jobs for last week
2015-11-26 14:37:03 +05:30
(#{date_from_to(Date.today - 7.days, Date.today)})
2017-08-17 22:00:37 +05:30
%canvas#weekChart{ height: 200 }
2015-09-25 12:07:36 +05:30
2015-11-26 14:37:03 +05:30
.prepend-top-default
%p.light
2017-08-17 22:00:37 +05:30
Jobs for last month
2015-09-25 12:07:36 +05:30
(#{date_from_to(Date.today - 30.days, Date.today)})
2017-08-17 22:00:37 +05:30
%canvas#monthChart{ height: 200 }
2015-09-25 12:07:36 +05:30
2015-11-26 14:37:03 +05:30
.prepend-top-default
%p.light
2017-08-17 22:00:37 +05:30
Jobs for last year
%canvas#yearChart.padded{ height: 250 }
2015-09-25 12:07:36 +05:30
- [:week, :month, :year].each do |scope|
:javascript
var data = {
labels : #{@charts[scope].labels.to_json},
datasets : [
{
2015-11-26 14:37:03 +05:30
fillColor : "#7f8fa4",
strokeColor : "#7f8fa4",
pointColor : "#7f8fa4",
2015-09-25 12:07:36 +05:30
pointStrokeColor : "#EEE",
data : #{@charts[scope].total.to_json}
},
{
2015-11-26 14:37:03 +05:30
fillColor : "#44aa22",
strokeColor : "#44aa22",
pointColor : "#44aa22",
2015-09-25 12:07:36 +05:30
pointStrokeColor : "#fff",
data : #{@charts[scope].success.to_json}
}
]
}
var ctx = $("##{scope}Chart").get(0).getContext("2d");
2016-09-13 17:45:13 +05:30
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);