Class: Admin::BuildsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/builds_controller.rb

Instance Method Summary collapse

Instance Method Details

#cancel_allObject


18
19
20
21
22
# File 'app/controllers/admin/builds_controller.rb', line 18

def cancel_all
  Ci::Build.running_or_pending.each(&:cancel)

  redirect_to admin_builds_path
end

#indexObject


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/admin/builds_controller.rb', line 2

def index
  @scope = params[:scope]
  @all_builds = Ci::Build
  @builds = @all_builds.order('created_at DESC')
  @builds =
    case @scope
    when 'running'
      @builds.running_or_pending.reverse_order
    when 'finished'
      @builds.finished
    else
      @builds
    end
  @builds = @builds.page(params[:page]).per(30)
end