Class: ForemanInventoryUpload::MissingHostsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_inventory_upload/missing_hosts_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
# File 'app/controllers/foreman_inventory_upload/missing_hosts_controller.rb', line 3

def index
  organizations = Organization.current || User.current.my_organizations
  organization_id = organizations.pluck(:id)
  payload = InsightsMissingHosts.where(organization_id: organization_id)

  render :json => payload
end

#remove_hostsObject



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/foreman_inventory_upload/missing_hosts_controller.rb', line 11

def remove_hosts
  organization_id = params[:organization_id]
  search_term = params[:search_term]

  task = ForemanTasks.async_task(ForemanInventoryUpload::Async::RemoveInsightsHostsJob, search_term, organization_id)

  render json: {
    task: task,
  }, status: :ok
end