Commit 6df1eb14 authored by Matija Čupić's avatar Matija Čupić

Use Gitlab::Ci::Status#illustration in job empty_states partial

parent 4b0cbf63
- if @build.playable? - detailed_status = @build.detailed_status(current_user)
= render 'empty_state', - illustration = detailed_status.illustration
illustration: 'illustrations/manual_action.svg',
illustration_size: 'svg-394', = render 'empty_state',
title: _('This job requires a manual action'), illustration: illustration[:image],
content: _('This job depends on a user to trigger its process. Often they are used to deploy code to production environments'), illustration_size: illustration[:size],
action: ( link_to _('Trigger this manual action'), play_project_job_path(@project, @build), method: :post, class: 'btn btn-primary', title: _('Trigger this manual action') ) title: illustration[:title],
- elsif @build.created? content: illustration[:content],
= render 'empty_state', action: @build.playable? ? link_to(_("Trigger this manual action"), detailed_status.action_path, method: detailed_status.action_method, class: 'btn btn-primary', title: _("Trigger this manual action")) : nil
illustration: 'illustrations/job_not_triggered.svg',
illustration_size: 'svg-306',
title: _('This job has not been triggered yet'),
content: _('This job depends on upstream jobs that need to succeed in order for this job to be triggered')
- elsif @build.canceled?
= render 'empty_state',
illustration: 'illustrations/canceled-job_empty.svg',
illustration_size: 'svg-430',
title: _('This job has been canceled')
- elsif @build.skipped?
= render 'empty_state',
illustration: 'illustrations/skipped-job_empty.svg',
illustration_size: 'svg-430',
title: _('This job has been skipped')
- else
= render 'empty_state',
illustration: 'illustrations/pending_job_empty.svg',
illustration_size: 'svg-430',
title: _('This job has not started yet'),
content: _('This job is in pending state and is waiting to be picked by a runner')
...@@ -379,6 +379,7 @@ feature 'Jobs' do ...@@ -379,6 +379,7 @@ feature 'Jobs' do
end end
it 'shows manual action empty state' do it 'shows manual action empty state' do
expect(page).to have_content(job.detailed_status(user).illustration[:title])
expect(page).to have_content('This job requires a manual action') expect(page).to have_content('This job requires a manual action')
expect(page).to have_content('This job depends on a user to trigger its process. Often they are used to deploy code to production environments') expect(page).to have_content('This job depends on a user to trigger its process. Often they are used to deploy code to production environments')
expect(page).to have_link('Trigger this manual action') expect(page).to have_link('Trigger this manual action')
...@@ -402,6 +403,7 @@ feature 'Jobs' do ...@@ -402,6 +403,7 @@ feature 'Jobs' do
end end
it 'shows empty state' do it 'shows empty state' do
expect(page).to have_content(job.detailed_status(user).illustration[:title])
expect(page).to have_content('This job has not been triggered yet') expect(page).to have_content('This job has not been triggered yet')
expect(page).to have_content('This job depends on upstream jobs that need to succeed in order for this job to be triggered') expect(page).to have_content('This job depends on upstream jobs that need to succeed in order for this job to be triggered')
end end
...@@ -415,6 +417,7 @@ feature 'Jobs' do ...@@ -415,6 +417,7 @@ feature 'Jobs' do
end end
it 'shows pending empty state' do it 'shows pending empty state' do
expect(page).to have_content(job.detailed_status(user).illustration[:title])
expect(page).to have_content('This job has not started yet') expect(page).to have_content('This job has not started yet')
expect(page).to have_content('This job is in pending state and is waiting to be picked by a runner') expect(page).to have_content('This job is in pending state and is waiting to be picked by a runner')
end end
...@@ -441,11 +444,26 @@ feature 'Jobs' do ...@@ -441,11 +444,26 @@ feature 'Jobs' do
end end
it 'renders empty state' do it 'renders empty state' do
expect(page).to have_content(job.detailed_status(user).illustration[:title])
expect(page).not_to have_selector('.js-build-output') expect(page).not_to have_selector('.js-build-output')
expect(page).to have_content('This job has been canceled') expect(page).to have_content('This job has been canceled')
end end
end end
end end
context 'Skipped job' do
let(:job) { create(:ci_build, :skipped, pipeline: pipeline) }
before do
visit project_job_path(project, job)
end
it 'renders empty state' do
expect(page).to have_content(job.detailed_status(user).illustration[:title])
expect(page).not_to have_selector('.js-build-output')
expect(page).to have_content('This job has been skipped')
end
end
end end
describe "POST /:project/jobs/:id/cancel", :js do describe "POST /:project/jobs/:id/cancel", :js do
......
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