Class: Flightdeck::Jobs::ActionsController

Inherits:
ApplicationController show all
Includes:
Toasts
Defined in:
app/controllers/flightdeck/jobs/actions_controller.rb

Overview

Shared machinery for the two destructive jobs actions. Subclasses say what rows they act on and what Solid Queue method does the work; everything about scoping, batching, counting and responding lives here.

Three scopes, one action:

* one job          POST /jobs/:id/retry
* selected jobs    POST /jobs/retry   with job_ids[]
* all matching     POST /jobs/retry   with scope=all + the list filters

Direct Known Subclasses

DiscardsController, RetriesController

Constant Summary

Constants inherited from ApplicationController

ApplicationController::UNCONFIGURED_MESSAGE

Instance Method Summary collapse

Methods inherited from ApplicationController

host_authenticated?

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/flightdeck/jobs/actions_controller.rb', line 16

def create
  if params[:id].present?
    act_on_single
  elsif params[:scope] == "all"
    act_on_all_matching
  else
    act_on_selected
  end

  respond_to do |format|
    format.turbo_stream do
      build_refreshed_list
      render_refresh_stream(refreshed_frame)
    end
    format.any { redirect_with_toast_flash(list_url) }
  end
end