Class: ForemanProbing::ScansController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_probing/scans_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/foreman_probing/scans_controller.rb', line 15

def create
  @composer = ScanComposer.new_from_params(params[:foreman_probing_scan])
  @scan = @composer.compose!
  @scan.save!
  task = ForemanTasks.async_task(::Actions::ForemanProbing::PerformScan,
                                 @scan,
                                 @scan.ports)
  @scan.task = task
  @scan.save!
  set_auto_refresh
  redirect_to @scan
end

#indexObject



4
5
6
# File 'app/controllers/foreman_probing/scans_controller.rb', line 4

def index
  @scans = resource_base.order(:id => 'desc').paginate(:page => params[:page])
end

#newObject



8
9
10
11
12
13
# File 'app/controllers/foreman_probing/scans_controller.rb', line 8

def new
  @scan = ForemanProbing::Scan.new
  @scan.target_kind = params.fetch(:target_kind, 'direct')
  @scan.search_query = params[:search_query]
  @scan.targeting = ::ForemanProbing::Targeting.new
end

#rerunObject



28
29
30
31
32
33
# File 'app/controllers/foreman_probing/scans_controller.rb', line 28

def rerun
  composer = ScanComposer.new_from_scan(ForemanProbing::Scan.find(params['id']))
  @scan = composer.compose!

  render :action => 'new'
end

#showObject



35
36
37
38
# File 'app/controllers/foreman_probing/scans_controller.rb', line 35

def show
  @scan = ::ForemanProbing::Scan.find(params['id'])
  set_auto_refresh
end