Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-03-08 20:33:06 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-03-09 17:54:50 +0300
commit8bbaf266cc8d1ff03c4f7a4173ce9a7ac60c0cbb (patch)
tree11f23e039ef4cf7b289204cd71f26f9c3ba0d8a2
parent92e119859d40145267e3a5fcb259df69090a1e72 (diff)
Handle empty states for job page
-rw-r--r--app/views/projects/jobs/_empty_state.html.haml5
-rw-r--r--app/views/projects/jobs/_empty_status.html.haml29
-rw-r--r--app/views/projects/jobs/show.html.haml23
-rw-r--r--changelogs/unreleased/42568-pipeline-empty-state.yml5
-rw-r--r--db/fixtures/development/14_pipelines.rb4
-rw-r--r--spec/features/projects/jobs_spec.rb27
6 files changed, 72 insertions, 21 deletions
diff --git a/app/views/projects/jobs/_empty_state.html.haml b/app/views/projects/jobs/_empty_state.html.haml
index c66313bdbf3..311934d9c33 100644
--- a/app/views/projects/jobs/_empty_state.html.haml
+++ b/app/views/projects/jobs/_empty_state.html.haml
@@ -1,7 +1,7 @@
- illustration = local_assigns.fetch(:illustration)
- illustration_size = local_assigns.fetch(:illustration_size)
- title = local_assigns.fetch(:title)
-- content = local_assigns.fetch(:content)
+- content = local_assigns.fetch(:content, nil)
- action = local_assigns.fetch(:action, nil)
.row.empty-state
@@ -11,7 +11,8 @@
.col-xs-12
.text-content
%h4.text-center= title
- %p= content
+ - if content
+ %p= content
- if action
.text-center
= action
diff --git a/app/views/projects/jobs/_empty_status.html.haml b/app/views/projects/jobs/_empty_status.html.haml
new file mode 100644
index 00000000000..707085cddd5
--- /dev/null
+++ b/app/views/projects/jobs/_empty_status.html.haml
@@ -0,0 +1,29 @@
+- 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/canceled-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')
diff --git a/app/views/projects/jobs/show.html.haml b/app/views/projects/jobs/show.html.haml
index 849c273db8c..04c28841511 100644
--- a/app/views/projects/jobs/show.html.haml
+++ b/app/views/projects/jobs/show.html.haml
@@ -54,7 +54,8 @@
Job has been erased by #{link_to(@build.erased_by_name, user_path(@build.erased_by))} #{time_ago_with_tooltip(@build.erased_at)}
- else
Job has been erased #{time_ago_with_tooltip(@build.erased_at)}
- - if @build.started?
+
+ - if @build.has_trace?
.build-trace-container.prepend-top-default
.top-bar.js-top-bar
.js-truncated-info.truncated-info.hidden-xs.pull-left.hidden<
@@ -88,25 +89,9 @@
%pre.build-trace#build-trace
%code.bash.js-build-output
.build-loader-animation.js-build-refresh
- - elsif @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')
- 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')
+ = render "empty_status"
+
= render "sidebar"
.js-build-options{ data: javascript_build_options }
diff --git a/changelogs/unreleased/42568-pipeline-empty-state.yml b/changelogs/unreleased/42568-pipeline-empty-state.yml
new file mode 100644
index 00000000000..d36edcf1b37
--- /dev/null
+++ b/changelogs/unreleased/42568-pipeline-empty-state.yml
@@ -0,0 +1,5 @@
+---
+title: Improve empty state for canceled job
+merge_request: 17646
+author:
+type: fixed
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb
index d3a63aa2a78..fe21b7aad0e 100644
--- a/db/fixtures/development/14_pipelines.rb
+++ b/db/fixtures/development/14_pipelines.rb
@@ -30,6 +30,10 @@ class Gitlab::Seeder::Pipelines
queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago },
{ name: 'spinach:osx', stage: 'test', status: :failed, allow_failure: true,
queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago },
+ { name: 'spinach:osx1', stage: 'test', status: :canceled,
+ queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago },
+ { name: 'spinach:osx1', stage: 'test', status: :running,
+ queued_at: 8.hour.ago, started_at: 8.hour.ago, finished_at: 7.hour.ago },
# deploy stage
{ name: 'staging', stage: 'deploy', environment: 'staging', status_event: :success,
diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb
index 5d311f2dde3..aa4c2757a25 100644
--- a/spec/features/projects/jobs_spec.rb
+++ b/spec/features/projects/jobs_spec.rb
@@ -419,6 +419,33 @@ feature 'Jobs' do
expect(page).to have_content('This job is in pending state and is waiting to be picked by a runner')
end
end
+
+ context 'Canceled job' do
+ context 'with log' do
+ let(:job) { create(:ci_build, :canceled, :trace_artifact, pipeline: pipeline) }
+
+ before do
+ visit project_job_path(project, job)
+ end
+
+ it 'renders job log' do
+ expect(page).to have_selector('.js-build-output')
+ end
+ end
+
+ context 'without log' do
+ let(:job) { create(:ci_build, :canceled, pipeline: pipeline) }
+
+ before do
+ visit project_job_path(project, job)
+ end
+
+ it 'renders empty state' do
+ expect(page).not_to have_selector('.js-build-output')
+ expect(page).to have_content('This job has been canceled')
+ end
+ end
+ end
end
describe "POST /:project/jobs/:id/cancel", :js do