Class: Naf::MachineRunnersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/naf/machine_runners_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/naf/machine_runners_controller.rb', line 6

def index
  respond_to do |format|
    format.html
    format.json do
      set_page

      @total_records = ::Naf::MachineRunner.count(:all)
      @rows = ::Logical::Naf::MachineRunner.to_array(params['iSortCol_0'].to_i, params['sSortDir_0']).
        paginate(page: @page, per_page: @rows_per_page)

      render layout: 'naf/layouts/jquery_datatables'
    end
  end
end

#runner_countObject



25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/naf/machine_runners_controller.rb', line 25

def runner_count
  running = ::Naf::MachineRunner.running.uniq.count
  winding_down = ::Naf::MachineRunner.winding_down.uniq.count
  down = ::Naf::MachineRunner.dead_count

  render json: {
    running: running,
    winding_down: winding_down,
    down: down
  }
end

#showObject



21
22
23
# File 'app/controllers/naf/machine_runners_controller.rb', line 21

def show
  @machine_runner = Naf::MachineRunner.find(params[:id])
end