Class: Naf::MachineRunnerInvocationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Naf::MachineRunnerInvocationsController
- Defined in:
- app/controllers/naf/machine_runner_invocations_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/naf/machine_runner_invocations_controller.rb', line 6 def index respond_to do |format| format.html format.json do set_page @total_records = ::Naf::MachineRunnerInvocation.count(:all) @rows = ::Logical::Naf::MachineRunnerInvocation. to_array(params['iSortCol_0'].to_i, params['sSortDir_0'], params['filter']['invocations']). paginate(page: @page, per_page: @rows_per_page) render layout: 'naf/layouts/jquery_datatables' end end end |
#show ⇒ Object
22 23 24 |
# File 'app/controllers/naf/machine_runner_invocations_controller.rb', line 22 def show @machine_runner_invocation = Naf::MachineRunnerInvocation.find(params[:id]) end |
#update ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/naf/machine_runner_invocations_controller.rb', line 26 def update respond_to do |format| @machine_runner_invocation = Naf::MachineRunnerInvocation.find(params[:id]) format.json do if params[:machine_runner_invocation][:request_to_wind_down].present? @machine_runner_invocation.update_attributes!(wind_down_at: Time.zone.now) @machine_runner_invocation.machine_runner.reload render json: { success: true }.to_json else render json: { success: false }.to_json end end end end |
#wind_down_all ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/naf/machine_runner_invocations_controller.rb', line 41 def wind_down_all if ::Naf::MachineRunnerInvocation.where('wind_down_at IS NULL'). count == 0 flash[:error] = "There aren't any Machine Runners to wind down!" redirect_to machine_runners_path return end ::Naf::MachineRunnerInvocation. where('wind_down_at IS NULL'). update_all(wind_down_at: Time.zone.now) redirect_to machine_runners_path, notice: 'Machine Runners are winding down!' end |