Merge branch 'pending-tab' into 'master'
Add Pending Tab to Builds ## What does this MR do? Add Pending Tab to Builds and separate "running" and "pending" jobs in UI. ## Why was this MR needed? Increase visibility to "pending" . ## What are the relevant issue numbers? Closes #19408 ## Screenshots Before: ![Zrzut_ekranu_2016-07-05_o_11.52.48](/uploads/01dc1f3664f5aacb2ec09d52d19c521e/Zrzut_ekranu_2016-07-05_o_11.52.48.png) After: ![Zrzut_ekranu_2016-07-05_o_11.51.34](/uploads/f3be02427996fecf50c65dd51ce1b9fb/Zrzut_ekranu_2016-07-05_o_11.51.34.png) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - Tests - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) cc @ubudzisz @yorickpeterse @grzesiek @tmaczukin @zj [@chastell](https://github.com/chastell) [@tomash](https://github.com/tomash) See merge request !5084
This commit is contained in:
commit
08e21230b1
7 changed files with 90 additions and 21 deletions
|
@ -120,6 +120,7 @@ v 8.9.6
|
|||
- Fix broken migration in MySQL. !5005
|
||||
- Overwrite Host and X-Forwarded-Host headers in NGINX !5213
|
||||
- Keeps issue number when importing from Gitlab.com
|
||||
- Add Pending tab for Builds (Katarzyna Kobierska, Urszula Budziszewska)
|
||||
|
||||
v 8.9.7 (unreleased)
|
||||
- Fix import_data wrongly saved as a result of an invalid import_url
|
||||
|
|
|
@ -5,8 +5,10 @@ class Admin::BuildsController < Admin::ApplicationController
|
|||
@builds = @all_builds.order('created_at DESC')
|
||||
@builds =
|
||||
case @scope
|
||||
when 'pending'
|
||||
@builds.pending.reverse_order
|
||||
when 'running'
|
||||
@builds.running_or_pending.reverse_order
|
||||
@builds.running.reverse_order
|
||||
when 'finished'
|
||||
@builds.finished
|
||||
else
|
||||
|
|
|
@ -10,8 +10,10 @@ class Projects::BuildsController < Projects::ApplicationController
|
|||
@builds = @all_builds.order('created_at DESC')
|
||||
@builds =
|
||||
case @scope
|
||||
when 'pending'
|
||||
@builds.pending.reverse_order
|
||||
when 'running'
|
||||
@builds.running_or_pending.reverse_order
|
||||
@builds.running.reverse_order
|
||||
when 'finished'
|
||||
@builds.finished
|
||||
else
|
||||
|
|
|
@ -10,15 +10,20 @@
|
|||
All
|
||||
%span.badge.js-totalbuilds-count= @all_builds.count(:id)
|
||||
|
||||
%li{class: ('active' if @scope == 'pending')}
|
||||
= link_to admin_builds_path(scope: :pending) do
|
||||
Pending
|
||||
%span.badge= number_with_delimiter(@all_builds.pending.count(:id))
|
||||
|
||||
%li{class: ('active' if @scope == 'running')}
|
||||
= link_to admin_builds_path(scope: :running) do
|
||||
Running
|
||||
%span.badge.js-running-count= number_with_delimiter(@all_builds.running_or_pending.count(:id))
|
||||
%span.badge= number_with_delimiter(@all_builds.running.count(:id))
|
||||
|
||||
%li{class: ('active' if @scope == 'finished')}
|
||||
= link_to admin_builds_path(scope: :finished) do
|
||||
Finished
|
||||
%span.badge.js-running-count= number_with_delimiter(@all_builds.finished.count(:id))
|
||||
%span.badge= number_with_delimiter(@all_builds.finished.count(:id))
|
||||
|
||||
.nav-controls
|
||||
- if @all_builds.running_or_pending.any?
|
||||
|
|
|
@ -11,17 +11,22 @@
|
|||
%span.badge.js-totalbuilds-count
|
||||
= number_with_delimiter(@all_builds.count(:id))
|
||||
|
||||
%li{class: ('active' if @scope == 'pending')}
|
||||
= link_to project_builds_path(@project, scope: :pending) do
|
||||
Pending
|
||||
%span.badge
|
||||
= number_with_delimiter(@all_builds.pending.count(:id))
|
||||
|
||||
%li{class: ('active' if @scope == 'running')}
|
||||
= link_to project_builds_path(@project, scope: :running) do
|
||||
Running
|
||||
%span.badge.js-running-count
|
||||
= number_with_delimiter(@all_builds.running_or_pending.count(:id))
|
||||
%span.badge
|
||||
= number_with_delimiter(@all_builds.running.count(:id))
|
||||
|
||||
%li{class: ('active' if @scope == 'finished')}
|
||||
= link_to project_builds_path(@project, scope: :finished) do
|
||||
Finished
|
||||
%span.badge.js-running-count
|
||||
%span.badge
|
||||
= number_with_delimiter(@all_builds.finished.count(:id))
|
||||
|
||||
.nav-controls
|
||||
|
|
|
@ -36,12 +36,45 @@ describe 'Admin Builds' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'Pending tab' do
|
||||
context 'when have pending builds' do
|
||||
it 'shows pending builds' do
|
||||
build1 = create(:ci_build, pipeline: pipeline, status: :pending)
|
||||
build2 = create(:ci_build, pipeline: pipeline, status: :running)
|
||||
build3 = create(:ci_build, pipeline: pipeline, status: :success)
|
||||
build4 = create(:ci_build, pipeline: pipeline, status: :failed)
|
||||
|
||||
visit admin_builds_path(scope: :pending)
|
||||
|
||||
expect(page).to have_selector('.nav-links li.active', text: 'Pending')
|
||||
expect(page.find('.build-link')).to have_content(build1.id)
|
||||
expect(page.find('.build-link')).not_to have_content(build2.id)
|
||||
expect(page.find('.build-link')).not_to have_content(build3.id)
|
||||
expect(page.find('.build-link')).not_to have_content(build4.id)
|
||||
expect(page).to have_link 'Cancel all'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when have no builds pending' do
|
||||
it 'shows a message' do
|
||||
create(:ci_build, pipeline: pipeline, status: :success)
|
||||
|
||||
visit admin_builds_path(scope: :pending)
|
||||
|
||||
expect(page).to have_selector('.nav-links li.active', text: 'Pending')
|
||||
expect(page).to have_content 'No builds to show'
|
||||
expect(page).not_to have_link 'Cancel all'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'Running tab' do
|
||||
context 'when have running builds' do
|
||||
it 'shows running builds' do
|
||||
build1 = create(:ci_build, pipeline: pipeline, status: :pending)
|
||||
build1 = create(:ci_build, pipeline: pipeline, status: :running)
|
||||
build2 = create(:ci_build, pipeline: pipeline, status: :success)
|
||||
build3 = create(:ci_build, pipeline: pipeline, status: :failed)
|
||||
build4 = create(:ci_build, pipeline: pipeline, status: :pending)
|
||||
|
||||
visit admin_builds_path(scope: :running)
|
||||
|
||||
|
@ -49,6 +82,7 @@ describe 'Admin Builds' do
|
|||
expect(page.find('.build-link')).to have_content(build1.id)
|
||||
expect(page.find('.build-link')).not_to have_content(build2.id)
|
||||
expect(page.find('.build-link')).not_to have_content(build3.id)
|
||||
expect(page.find('.build-link')).not_to have_content(build4.id)
|
||||
expect(page).to have_link 'Cancel all'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,17 +13,33 @@ describe "Builds" do
|
|||
end
|
||||
|
||||
describe "GET /:project/builds" do
|
||||
context "Pending scope" do
|
||||
before do
|
||||
visit namespace_project_builds_path(@project.namespace, @project, scope: :pending)
|
||||
end
|
||||
|
||||
it "shows Pending tab builds" do
|
||||
expect(page).to have_link 'Cancel running'
|
||||
expect(page).to have_selector('.nav-links li.active', text: 'Pending')
|
||||
expect(page).to have_content @build.short_sha
|
||||
expect(page).to have_content @build.ref
|
||||
expect(page).to have_content @build.name
|
||||
end
|
||||
end
|
||||
|
||||
context "Running scope" do
|
||||
before do
|
||||
@build.run!
|
||||
visit namespace_project_builds_path(@project.namespace, @project, scope: :running)
|
||||
end
|
||||
|
||||
it { expect(page).to have_selector('.nav-links li.active', text: 'Running') }
|
||||
it { expect(page).to have_link 'Cancel running' }
|
||||
it { expect(page).to have_content @build.short_sha }
|
||||
it { expect(page).to have_content @build.ref }
|
||||
it { expect(page).to have_content @build.name }
|
||||
it "shows Running tab builds" do
|
||||
expect(page).to have_selector('.nav-links li.active', text: 'Running')
|
||||
expect(page).to have_link 'Cancel running'
|
||||
expect(page).to have_content @build.short_sha
|
||||
expect(page).to have_content @build.ref
|
||||
expect(page).to have_content @build.name
|
||||
end
|
||||
end
|
||||
|
||||
context "Finished scope" do
|
||||
|
@ -32,9 +48,11 @@ describe "Builds" do
|
|||
visit namespace_project_builds_path(@project.namespace, @project, scope: :finished)
|
||||
end
|
||||
|
||||
it { expect(page).to have_selector('.nav-links li.active', text: 'Finished') }
|
||||
it { expect(page).to have_content 'No builds to show' }
|
||||
it { expect(page).to have_link 'Cancel running' }
|
||||
it "shows Finished tab builds" do
|
||||
expect(page).to have_selector('.nav-links li.active', text: 'Finished')
|
||||
expect(page).to have_content 'No builds to show'
|
||||
expect(page).to have_link 'Cancel running'
|
||||
end
|
||||
end
|
||||
|
||||
context "All builds" do
|
||||
|
@ -43,11 +61,13 @@ describe "Builds" do
|
|||
visit namespace_project_builds_path(@project.namespace, @project)
|
||||
end
|
||||
|
||||
it { expect(page).to have_selector('.nav-links li.active', text: 'All') }
|
||||
it { expect(page).to have_content @build.short_sha }
|
||||
it { expect(page).to have_content @build.ref }
|
||||
it { expect(page).to have_content @build.name }
|
||||
it { expect(page).not_to have_link 'Cancel running' }
|
||||
it "shows All tab builds" do
|
||||
expect(page).to have_selector('.nav-links li.active', text: 'All')
|
||||
expect(page).to have_content @build.short_sha
|
||||
expect(page).to have_content @build.ref
|
||||
expect(page).to have_content @build.name
|
||||
expect(page).not_to have_link 'Cancel running'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue