Commit 664384e7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge remote-tracking branch 'origin/rs-simplify-status-icon'

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parents 3321f694 3084c8c3
...@@ -35,3 +35,20 @@ ...@@ -35,3 +35,20 @@
border-color: $gl-warning; border-color: $gl-warning;
} }
} }
.ci-status-icon-success {
@extend .cgreen;
}
.ci-status-icon-failed {
@extend .cred;
}
.ci-status-icon-running,
.ci-status-icon-pending {
// These are standard text color
}
.ci-status-icon-canceled,
.ci-status-icon-disabled,
.ci-status-icon-not-found,
.ci-status-icon-skipped {
@extend .cgray;
}
...@@ -12,19 +12,6 @@ module CiStatusHelper ...@@ -12,19 +12,6 @@ module CiStatusHelper
ci_label_for_status(ci_commit.status) ci_label_for_status(ci_commit.status)
end end
def ci_status_color(ci_commit)
case ci_commit.status
when 'success'
'green'
when 'failed'
'red'
when 'running', 'pending'
'yellow'
else
'gray'
end
end
def ci_status_with_icon(status) def ci_status_with_icon(status)
content_tag :span, class: "ci-status ci-#{status}" do content_tag :span, class: "ci-status ci-#{status}" do
ci_icon_for_status(status) + '&nbsp;'.html_safe + ci_label_for_status(status) ci_icon_for_status(status) + '&nbsp;'.html_safe + ci_label_for_status(status)
...@@ -56,12 +43,11 @@ module CiStatusHelper ...@@ -56,12 +43,11 @@ module CiStatusHelper
end end
def render_ci_status(ci_commit) def render_ci_status(ci_commit)
link_to ci_status_path(ci_commit), link_to ci_status_icon(ci_commit),
class: "ci-status-link c#{ci_status_color(ci_commit)}", ci_status_path(ci_commit),
class: "ci-status-link ci-status-icon-#{ci_commit.status.dasherize}",
title: "Build #{ci_status_label(ci_commit)}", title: "Build #{ci_status_label(ci_commit)}",
data: { toggle: 'tooltip', placement: 'left' } do data: { toggle: 'tooltip', placement: 'left' }
ci_status_icon(ci_commit)
end
end end
def no_runners_for_project?(project) def no_runners_for_project?(project)
......
...@@ -6,13 +6,8 @@ describe CiStatusHelper do ...@@ -6,13 +6,8 @@ describe CiStatusHelper do
let(:success_commit) { double("Ci::Commit", status: 'success') } let(:success_commit) { double("Ci::Commit", status: 'success') }
let(:failed_commit) { double("Ci::Commit", status: 'failed') } let(:failed_commit) { double("Ci::Commit", status: 'failed') }
describe 'ci_status_color' do describe 'ci_status_icon' do
it { expect(ci_status_icon(success_commit)).to include('fa-check') } it { expect(helper.ci_status_icon(success_commit)).to include('fa-check') }
it { expect(ci_status_icon(failed_commit)).to include('fa-close') } it { expect(helper.ci_status_icon(failed_commit)).to include('fa-close') }
end
describe 'ci_status_color' do
it { expect(ci_status_color(success_commit)).to eq('green') }
it { expect(ci_status_color(failed_commit)).to eq('red') }
end end
end end
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