diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index 0bcd9a8a360ca7ebeecce81f7fb7923f4bfd4cd8..b7d77c21e72242c9d81d5569c40e5c1b49d5261e 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -12,12 +12,12 @@ class Projects::BuildsController < Projects::ApplicationController @builds = case @scope - when 'pending' - @all_builds.pending - when 'running' - @all_builds.running - else + when 'all' @all_builds + when 'finished' + @all_builds.finished + else + @all_builds.running_or_pending end end diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index b4d91b1b0c321b7c16793d32d20c7f4c24a2a3c1..41eeb9a4ce4aa0ef5f01dd3a39ae87ea9e6115f3 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -16,6 +16,7 @@ class CommitStatus < ActiveRecord::Base scope :success, -> { where(status: 'success') } scope :failed, -> { where(status: 'failed') } scope :running_or_pending, -> { where(status:[:running, :pending]) } + scope :finished, -> { where(status:[:success, :failed, :canceled]) } scope :latest, -> { where(id: unscope(:select).select('max(id)').group(:name, :ref)) } scope :ordered, -> { order(:ref, :stage_idx, :name) } scope :for_ref, ->(ref) { where(ref: ref) } diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index f52d0ad9c024462ae2b00debb23e221d5e8d992d..53a913fe8f379e696555e05a8ef75d8febf0f8cc 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -41,9 +41,10 @@ - if project_nav_tab? :builds = nav_link(controller: %w(builds)) do = link_to project_builds_path(@project), title: 'Builds', class: 'shortcuts-builds', data: {placement: 'right'} do - = icon('link fw') + = icon('cubes fw') %span Builds + %span.count.builds_counter= @project.ci_builds.running_or_pending.count(:all) - if project_nav_tab? :network = nav_link(controller: %w(network)) do diff --git a/app/views/projects/builds/_build.html.haml b/app/views/projects/builds/_build.html.haml index 10b3ef71202b6aff6c079ac3500eec569cdbcac2..e74a3a62672a089f6a4aed4d4460237c6defef36 100644 --- a/app/views/projects/builds/_build.html.haml +++ b/app/views/projects/builds/_build.html.haml @@ -10,12 +10,10 @@ %strong Build ##{build.id} %td - = link_to namespace_project_commit_path(@project.namespace, @project, build.sha) do - = build.short_sha + = link_to build.short_sha, namespace_project_commit_path(@project.namespace, @project, build.sha) %td - = link_to namespace_project_commits_path(@project.namespace, @project, build.ref) do - = build.ref + = link_to build.ref, namespace_project_commits_path(@project.namespace, @project, build.ref) %td - if build.runner diff --git a/app/views/projects/builds/index.html.haml b/app/views/projects/builds/index.html.haml index 2c6cf69c23e98ece6b389295589640c0ca1fb26a..56bb7b111775f9d12225a027377bc5393d610d98 100644 --- a/app/views/projects/builds/index.html.haml +++ b/app/views/projects/builds/index.html.haml @@ -1,31 +1,32 @@ - page_title "Builds" - header_title project_title(@project, "Builds", project_builds_path(@project)) -%ul.center-top-menu - %li{class: ('active' if @scope.nil?)} - = link_to project_builds_path(@project) do - All builds - %span.badge.js-totalbuilds-count= @all_builds.size - - %li{class: ('active' if @scope == 'pending')} - = link_to project_builds_path(@project, scope: :pending) do - Pending - %span.badge.js-pending-count= @all_builds.pending.size - - %li{class: ('active' if @scope == 'running')} - = link_to project_builds_path(@project, scope: :running) do - Running - %span.badge.js-running-count= @all_builds.running.size - -.gray-content-block - .oneline - List of all builds from this project - +.project-issuable-filter + .controls - if @ci_project && current_user && can?(current_user, :manage_builds, @project) - .pull-right + .pull-left.hidden-xs - if @all_builds.running_or_pending.any? = link_to 'Cancel all', cancel_all_namespace_project_builds_path(@project.namespace, @project), data: { confirm: 'Are you sure?' }, method: :post, class: 'btn btn-danger' + %ul.center-top-menu + %li{class: ('active' if @scope.nil?)} + = link_to project_builds_path(@project) do + Running + %span.badge.js-running-count= @all_builds.running_or_pending.size + + %li{class: ('active' if @scope == 'finished')} + = link_to project_builds_path(@project, scope: :finished) do + Finished + %span.badge.js-running-count= @all_builds.finished.size + + %li{class: ('active' if @scope == 'all')} + = link_to project_builds_path(@project, scope: :all) do + All + %span.badge.js-totalbuilds-count= @all_builds.size + +.gray-content-block + List of #{@scope || 'running'} builds from this project + %ul.content-list - if @builds.blank? %li