Use Gitlab::Ci::Status#illustration in job empty_states partial
This commit is contained in:
parent
4b0cbf6306
commit
6df1eb14fa
2 changed files with 27 additions and 29 deletions
|
@ -1,29 +1,9 @@
|
|||
- if @build.playable?
|
||||
= render 'empty_state',
|
||||
illustration: 'illustrations/manual_action.svg',
|
||||
illustration_size: 'svg-394',
|
||||
title: _('This job requires a manual action'),
|
||||
content: _('This job depends on a user to trigger its process. Often they are used to deploy code to production environments'),
|
||||
action: ( link_to _('Trigger this manual action'), play_project_job_path(@project, @build), method: :post, class: 'btn btn-primary', title: _('Trigger this manual action') )
|
||||
- elsif @build.created?
|
||||
= render 'empty_state',
|
||||
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')
|
||||
- detailed_status = @build.detailed_status(current_user)
|
||||
- illustration = detailed_status.illustration
|
||||
|
||||
= render 'empty_state',
|
||||
illustration: illustration[:image],
|
||||
illustration_size: illustration[:size],
|
||||
title: illustration[:title],
|
||||
content: illustration[:content],
|
||||
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
|
||||
|
|
|
@ -379,6 +379,7 @@ feature 'Jobs' do
|
|||
end
|
||||
|
||||
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 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')
|
||||
|
@ -402,6 +403,7 @@ feature 'Jobs' do
|
|||
end
|
||||
|
||||
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 depends on upstream jobs that need to succeed in order for this job to be triggered')
|
||||
end
|
||||
|
@ -415,6 +417,7 @@ feature 'Jobs' do
|
|||
end
|
||||
|
||||
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 is in pending state and is waiting to be picked by a runner')
|
||||
end
|
||||
|
@ -441,11 +444,26 @@ feature 'Jobs' do
|
|||
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 canceled')
|
||||
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
|
||||
|
||||
describe "POST /:project/jobs/:id/cancel", :js do
|
||||
|
|
Loading…
Reference in a new issue