diff options
Diffstat (limited to 'app/views/projects/pipelines/charts')
5 files changed, 55 insertions, 96 deletions
diff --git a/app/views/projects/pipelines/charts/_build_times.haml b/app/views/projects/pipelines/charts/_build_times.haml deleted file mode 100644 index bb0975a9535..00000000000 --- a/app/views/projects/pipelines/charts/_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/pipelines/charts/_builds.haml b/app/views/projects/pipelines/charts/_builds.haml deleted file mode 100644 index b6f453b9736..00000000000 --- a/app/views/projects/pipelines/charts/_builds.haml +++ /dev/null @@ -1,56 +0,0 @@ -%h4 Pipelines charts -%p - - %span.cgreen - = icon("circle") - success - - %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 index 0b7e3d22dd7..66786c7ff59 100644 --- a/app/views/projects/pipelines/charts/_overall.haml +++ b/app/views/projects/pipelines/charts/_overall.haml @@ -1,19 +1,15 @@ -%h4 Overall stats +%h4= s_("PipelineCharts|Overall statistics") %ul %li - Total: - %strong= pluralize @project.builds.count(:all), 'job' + = s_("PipelineCharts|Total:") + %strong= n_("1 pipeline", "%d pipelines", @counts[:total]) % @counts[:total] %li - Successful: - %strong= pluralize @project.builds.success.count(:all), 'job' + = s_("PipelineCharts|Successful:") + %strong= n_("1 pipeline", "%d pipelines", @counts[:success]) % @counts[:success] %li - Failed: - %strong= pluralize @project.builds.failed.count(:all), 'job' + = s_("PipelineCharts|Failed:") + %strong= n_("1 pipeline", "%d pipelines", @counts[:failed]) % @counts[:failed] %li - Success ratio: + = s_("PipelineCharts|Success ratio:") %strong - #{success_ratio(@project.builds.success, @project.builds.failed)}% - %li - Commits covered: - %strong - = @project.pipelines.count(:all) + #{success_ratio(@counts)}% diff --git a/app/views/projects/pipelines/charts/_pipeline_times.haml b/app/views/projects/pipelines/charts/_pipeline_times.haml new file mode 100644 index 00000000000..a5dbd1b1532 --- /dev/null +++ b/app/views/projects/pipelines/charts/_pipeline_times.haml @@ -0,0 +1,10 @@ +- content_for :page_specific_javascripts do + = webpack_bundle_tag('pipelines_times') + +%div + %p.light + = _("Commit duration in minutes for last 30 commits") + + %canvas#build_timesChart{ height: 200 } + +%script#pipelinesTimesChartsData{ type: "application/json" }= { :labels => @charts[:pipeline_times].labels, :values => @charts[:pipeline_times].pipeline_times }.to_json.html_safe diff --git a/app/views/projects/pipelines/charts/_pipelines.haml b/app/views/projects/pipelines/charts/_pipelines.haml new file mode 100644 index 00000000000..02f1ef4b6da --- /dev/null +++ b/app/views/projects/pipelines/charts/_pipelines.haml @@ -0,0 +1,36 @@ +- content_for :page_specific_javascripts do + = webpack_bundle_tag('pipelines_charts') + +%h4= _("Pipelines charts") +%p + + %span.cgreen + = icon("circle") + = s_("Pipeline|success") + + %span.cgray + = icon("circle") + = s_("Pipeline|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 } + +%script#pipelinesChartsData{ type: "application/json" } + - chartData = [] + - [:week, :month, :year].each do |scope| + - chartData.push({ 'scope' => scope, 'labels' => @charts[scope].labels, 'totalValues' => @charts[scope].total, 'successValues' => @charts[scope].success }) + = chartData.to_json.html_safe |