Commit 3953e5fc authored by Kamil Trzcinski's avatar Kamil Trzcinski

Update generic commit status to make it look like a build

parent fe2137d8
...@@ -91,12 +91,12 @@ class CommitStatus < ActiveRecord::Base ...@@ -91,12 +91,12 @@ class CommitStatus < ActiveRecord::Base
end end
def self.stages def self.stages
# We group by stage name, but order stages by their's index # We group by stage name, but order stages by theirs' index
unscoped.from(all, :sg).group('stage').order('max(stage_idx)', 'stage').pluck('sg.stage') unscoped.from(all, :sg).group('stage').order('max(stage_idx)', 'stage').pluck('sg.stage')
end end
def self.stages_status def self.stages_status
# We execute subquery for each of the stages which calculates an Stage Status # We execute subquery for each stage to calculate a stage status
statuses = unscoped.from(all, :sg).group('stage').pluck('sg.stage', all.where('stage=sg.stage').status_sql) statuses = unscoped.from(all, :sg).group('stage').pluck('sg.stage', all.where('stage=sg.stage').status_sql)
statuses.inject({}) do |h, k| statuses.inject({}) do |h, k|
h[k.first] = k.last h[k.first] = k.last
......
...@@ -55,30 +55,17 @@ ...@@ -55,30 +55,17 @@
- if defined?(retried) && retried - if defined?(retried) && retried
%span.label.label-warning retried %span.label.label-warning retried
- if defined?(new_duration) && new_duration %td.duration
%td.duration - if build.duration
- if build.duration = icon("clock-o")
%p &nbsp;
= icon("clock-o") #{duration_in_words(build.finished_at, build.started_at)}
&nbsp;
#{duration_in_words(build.finished_at, build.started_at)}
- if build.finished_at
%p
= icon("calendar")
&nbsp;
#{time_ago_with_tooltip(build.finished_at)}
- else
%td.duration
- if build.duration
= icon("clock-o")
&nbsp;
#{duration_in_words(build.finished_at, build.started_at)}
%td.timestamp %td.timestamp
- if build.finished_at - if build.finished_at
= icon("calendar") = icon("calendar")
&nbsp; &nbsp;
%span #{time_ago_with_tooltip(build.finished_at)} %span #{time_ago_with_tooltip(build.finished_at)}
- if defined?(coverage) && coverage - if defined?(coverage) && coverage
%td.coverage %td.coverage
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
- else - else
%strong ##{generic_commit_status.id} %strong ##{generic_commit_status.id}
- if defined?(retried) && retried
= icon('warning', class: 'text-warning has-tooltip', title: 'Status was retried.')
- if defined?(commit_sha) && commit_sha - if defined?(commit_sha) && commit_sha
%td %td
= link_to generic_commit_status.short_sha, namespace_project_commit_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.sha), class: "monospace" = link_to generic_commit_status.short_sha, namespace_project_commit_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.sha), class: "monospace"
...@@ -42,13 +45,19 @@ ...@@ -42,13 +45,19 @@
- generic_commit_status.tags.each do |tag| - generic_commit_status.tags.each do |tag|
%span.label.label-primary %span.label.label-primary
= tag = tag
- if defined?(retried) && retried
%span.label.label-warning retried
%td.duration %td.duration
- if generic_commit_status.duration - if generic_commit_status.duration
= icon("clock-o")
&nbsp;
#{duration_in_words(generic_commit_status.finished_at, generic_commit_status.started_at)} #{duration_in_words(generic_commit_status.finished_at, generic_commit_status.started_at)}
%td.timestamp %td.timestamp
- if generic_commit_status.finished_at - if generic_commit_status.finished_at
= icon("calendar")
&nbsp;
%span #{time_ago_with_tooltip(generic_commit_status.finished_at)} %span #{time_ago_with_tooltip(generic_commit_status.finished_at)}
- if defined?(coverage) && coverage - if defined?(coverage) && coverage
......
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