Class: ForemanPatch::InvocationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Foreman::Controller::AutoCompleteSearch
Defined in:
app/controllers/foreman_patch/invocations_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



33
34
35
36
37
38
# File 'app/controllers/foreman_patch/invocations_controller.rb', line 33

def destroy
  if @invocation.destroy!
  else
    process_error
  end
end

#resource_classObject



40
41
42
# File 'app/controllers/foreman_patch/invocations_controller.rb', line 40

def resource_class
  ForemanPatch::Invocation
end

#showObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/foreman_patch/invocations_controller.rb', line 9

def show
  @invocation = ForemanPatch::Invocation.find(params[:id])
  @host = @invocation.host

  @round = @invocation.round
  @window = @round.window
  @cycle = @window.cycle

  @auto_refresh = !@invocation.complete?
  @since = params[:since].to_f if params[:since].present?

  @invocation.phases.each do |phase|
    @line_sets = phase.live_output
    @line_sets = @line_sets.drop_while { |o| o['timestamp'].to_f <= @since } if @since

    unless @line_sets.empty?
      @phase = phase.label.demodulize.underscore
      break
    end
  end

  @line_counter = params[:line_counter].to_i
end