Class: GroundControl::Inertia::WorkersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ground_control/inertia/workers_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/ground_control/inertia/workers_controller.rb', line 8

def index
  page_obj = MissionControl::Jobs::Page.new(
    MissionControl::Jobs::Current.server.workers_relation,
    page: params[:page].to_i,
    page_size: GroundControl::Api.page_size
  )

  render inertia: page("workers/index"), props: {
    workers: serialize(GroundControl::Api::PageResource.new(page_obj, inner_resource_class: GroundControl::Api::WorkerResource))
  }
end

#showObject



20
21
22
23
24
25
26
# File 'app/controllers/ground_control/inertia/workers_controller.rb', line 20

def show
  worker = MissionControl::Jobs::Current.server.find_worker(params[:id])

  render inertia: page("workers/show"), props: {
    worker: serialize(GroundControl::Api::WorkerResource.new(worker))
  }
end