Commit 1ad0c968 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Make a build views nicer

parent cb90368a
......@@ -89,7 +89,7 @@ class CommitStatus < ActiveRecord::Base
def self.stages
order_by = 'max(stage_idx)'
group('stage').order(order_by).pluck(:stage, order_by).map(&:first).compact
CommitStatus.where(id: all).group('stage').order(order_by).pluck(:stage, order_by).map(&:first).compact
end
def self.stages_status
......
......@@ -42,25 +42,43 @@
%td
= build.name
.label-container
- if build.tags.any?
- build.tags.each do |tag|
%span.label.label-primary
= tag
- if build.try(:trigger_request)
%span.label.label-info triggered
- if build.try(:allow_failure)
%span.label.label-danger allowed to fail
- if defined?(retried) && retried
%span.label.label-warning retried
.pull-right
.label-container
- if build.tags.any?
- build.tags.each do |tag|
%span.label.label-primary
= tag
- if build.try(:trigger_request)
%span.label.label-info triggered
- if build.try(:allow_failure)
%span.label.label-danger allowed to fail
- if defined?(retried) && retried
%span.label.label-warning retried
%td.duration
- if build.duration
#{duration_in_words(build.finished_at, build.started_at)}
- if defined?(new_duration) && new_duration
%td.duration
- if build.duration
%p
%i.fa.fa-clock-o
&nbsp;
#{duration_in_words(build.finished_at, build.started_at)}
- if build.finished_at
%p
%i.fa.fa-calendar
&nbsp;
#{time_ago_with_tooltip(build.finished_at)}
- else
%td.duration
- if build.duration
%i.fa.fa-clock-o
&nbsp;
#{duration_in_words(build.finished_at, build.started_at)}
%td.timestamp
- if build.finished_at
%span #{time_ago_with_tooltip(build.finished_at)}
%td.timestamp
- if build.finished_at
%i.fa.fa-calendar
&nbsp;
%span #{time_ago_with_tooltip(build.finished_at)}
- if defined?(coverage) && coverage
%td.coverage
......
......@@ -35,7 +35,8 @@
- stages.each do |stage|
%td
- if status = stages_status[stage]
%span.has-tooltip(title="#{stage.titleize}: #{status}"){class: "ci-status-icon-#{status}"}
- tooltip = "#{stage.titleize}: #{status}"
%span.has-tooltip(title="#{tooltip}"){class: "ci-status-icon-#{status}"}
= ci_icon_for_status(status)
%td
......@@ -52,7 +53,7 @@
%td
.controls.hidden-xs.pull-right
- artifacts = commit.builds.latest
- artifacts = commit.builds.latest.select { |b| b.artifacts? }
- if artifacts.present?
.dropdown.inline
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
......@@ -66,6 +67,7 @@
%span #{build.name}
- if can?(current_user, :update_pipeline, @project)
&nbsp;
- if commit.retryable? && commit.builds.failed.any?
= link_to retry_namespace_project_pipeline_path(@project.namespace, @project, commit.id), class: 'btn has-tooltip', title: "Retry", method: :post do
= icon("repeat")
......
......@@ -36,17 +36,19 @@
.table-holder
%table.table.builds
%thead
%tr
%th Status
%th Build ID
%th Stage
%th Name
%th Duration
%th Finished at
- if @project.build_coverage_enabled?
%th Coverage
%th
- builds = ci_commit.statuses.latest.ordered
= render builds, coverage: @project.build_coverage_enabled?, stage: true, ref: false, allow_retry: true
= render ci_commit.retried, coverage: @project.build_coverage_enabled?, stage: true, ref: false, retried: true
- CommitStatus.where(id: builds).stages.each do |stage|
- stage_builds = builds.where(stage: stage)
%tr
%th{colspan: 10}
%strong
- stage_status = CommitStatus.where(id: stage_builds.ids).status
%span{class: "ci-status-link ci-status-icon-#{stage_status}"}
= ci_icon_for_status(stage_status)
&nbsp;
= stage.titleize.pluralize
= render stage_builds, coverage: @project.build_coverage_enabled?, tage: false, ref: false, allow_retry: true
= render ci_commit.retried.select { |build| build.stage == stage }, coverage: @project.build_coverage_enabled?, stage: false, ref: false, retried: true
%tr
%td{colspan: 10}
&nbsp;
......@@ -38,7 +38,12 @@
%span CI Lint
.gray-content-block
Pipelines for #{(@scope || 'changes')} on this project
- if @scope == 'running'
Running pipelines for this project
- elsif @scope.nil?
Pipelines for this project
- else
#{@scope.titleize} for this project
%ul.content-list
- stages = @pipelines.stages
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment