gitlab-org--gitlab-foss/app/views/projects/graphs/ci/_builds.haml
Dmitriy Zaporozhets 1b7a2fc536
Improve Continuous Integration graphs page
* fix commit duration graph
* make graphs responsive
* fix wrong padding
* add a bit of explanation to colors

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-11-10 11:49:38 +01:00

51 lines
1.2 KiB
Text

%h4 Build charts
%p
&nbsp;
%span.cgreen
= icon("circle")
success
&nbsp;
%span.cgray
= icon("circle")
all
.prepend-top-default
%p.light
Builds for last week
(#{date_from_to(Date.today - 7.days, Date.today)})
%canvas#weekChart{height: 200}
.prepend-top-default
%p.light
Builds chart for last month
(#{date_from_to(Date.today - 30.days, Date.today)})
%canvas#monthChart{height: 200}
.prepend-top-default
%p.light
Builds chart 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");
new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true, maintainAspectRatio: false});