Sha256: 1561c1ba8bc0afb3ffe4d22c83275500a5ecb782e3f3e119ec2971361d27f4a4

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

module RocketJobMissionControl
  module Workers
    class IndexFiltersController < RocketJobMissionControl::ApplicationController
      before_filter :load_workers
      before_filter :show_sidebar

      def starting
        @workers = @workers.where(state: :starting)
        respond_to do |format|
          format.html
          format.json { render(json: WorkersDatatable.new(view_context, @workers)) }
        end
      end

      def running
        @workers = @workers.where(state: :running)
        respond_to do |format|
          format.html
          format.json { render(json: WorkersDatatable.new(view_context, @workers)) }
        end
      end

      def paused
        @workers = @workers.where(state: :paused)
        respond_to do |format|
          format.html
          format.json { render(json: WorkersDatatable.new(view_context, @workers)) }
        end
      end

      def stopping
        @workers = @workers.where(state: :stopping)
        respond_to do |format|
          format.html
          format.json { render(json: WorkersDatatable.new(view_context, @workers)) }
        end
      end

      private

      def load_workers
        @workers = RocketJob::Worker.sort(:name)
      end

      def show_sidebar
        @workers_sidebar = true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rocketjob_mission_control-2.1.1 app/controllers/rocket_job_mission_control/workers/index_filters_controller.rb
rocketjob_mission_control-2.1.0 app/controllers/rocket_job_mission_control/workers/index_filters_controller.rb
rocketjob_mission_control-2.0.0 app/controllers/rocket_job_mission_control/workers/index_filters_controller.rb
rocketjob_mission_control-2.0.0.rc2 app/controllers/rocket_job_mission_control/workers/index_filters_controller.rb
rocketjob_mission_control-2.0.0.rc1 app/controllers/rocket_job_mission_control/workers/index_filters_controller.rb