From 5813aec22dac9a896e75a23781934d555aef4269 Mon Sep 17 00:00:00 2001 From: Katarzyna Kobierska Date: Tue, 5 Jul 2016 10:10:34 +0200 Subject: [PATCH] Add Pending Tab to Admin Builds Add Pending Tab to Project Builds Update CHANGELOG --- CHANGELOG | 5 +++++ app/controllers/admin/builds_controller.rb | 4 +++- app/controllers/projects/builds_controller.rb | 4 +++- app/views/admin/builds/index.html.haml | 7 ++++++- app/views/projects/builds/index.html.haml | 7 ++++++- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 90f006d445d..6cfb51b5d62 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -133,6 +133,11 @@ v 8.9.5 - Fixed 'use shortcuts' button on docs. !4979 - Admin should be able to turn shared runners into specific ones. !4961 - Update RedCloth to 4.3.2 for CVE-2012-6684. !4929 (Takuya Noguchi) + - Add Pending tab for Builds + +v 8.9.4 (unreleased) + - Ensure references to private repos aren't shown to logged-out users +v 8.9.5 (unreleased) - Improve the request / withdraw access button. !4860 v 8.9.4 diff --git a/app/controllers/admin/builds_controller.rb b/app/controllers/admin/builds_controller.rb index 0db91eaaf2e..88f3c0e2fd4 100644 --- a/app/controllers/admin/builds_controller.rb +++ b/app/controllers/admin/builds_controller.rb @@ -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 diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index ef3051d7519..d7513d75f01 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -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 diff --git a/app/views/admin/builds/index.html.haml b/app/views/admin/builds/index.html.haml index 9ea3cca0ecb..0fcff566a70 100644 --- a/app/views/admin/builds/index.html.haml +++ b/app/views/admin/builds/index.html.haml @@ -10,10 +10,15 @@ 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.js-running-count= 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.js-running-count= number_with_delimiter(@all_builds.running.count(:id)) %li{class: ('active' if @scope == 'finished')} = link_to admin_builds_path(scope: :finished) do diff --git a/app/views/projects/builds/index.html.haml b/app/views/projects/builds/index.html.haml index 85c31dfd918..41f0462e4be 100644 --- a/app/views/projects/builds/index.html.haml +++ b/app/views/projects/builds/index.html.haml @@ -11,12 +11,17 @@ %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.js-running-count + = 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)) + = number_with_delimiter(@all_builds.running.count(:id)) %li{class: ('active' if @scope == 'finished')} = link_to project_builds_path(@project, scope: :finished) do