Sha256: 5fca90b8819e5a405cad166059af21c2d70e8f72601354b50f6015f0e2346644

Contents?: true

Size: 941 Bytes

Versions: 20

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

module ForemanInventoryUpload
  class ReportsController < ::ApplicationController
    include InventoryUpload::ReportActions

    def last
      label = ForemanInventoryUpload::Async::GenerateReportJob.output_label(params[:organization_id])
      output = ForemanInventoryUpload::Async::ProgressOutput.get(label)&.full_output
      task_label = ForemanInventoryUpload::Async::GenerateAllReportsJob.name
      scheduled = ForemanTasks::Task.where(
        :label => task_label,
        :state => 'scheduled'
      ).first&.start_at || nil

      render json: {
        output: output,
        scheduled: scheduled,
      }, status: :ok
    end

    def generate
      organization_id = params[:organization_id]
      disconnected = params[:disconnected]

      start_report_generation(organization_id, disconnected)

      render json: {
        action_status: 'success',
      }, status: :ok
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
foreman_rh_cloud-11.2.0 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.60 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-10.0.4 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-11.1.0 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-10.0.3 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-11.0.3 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.59 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-11.0.2 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-11.0.1 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-11.0.0 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.58 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-10.0.2 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.57 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-10.0.1 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.56 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.55 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.54 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.53 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-9.0.52 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-8.0.52 app/controllers/foreman_inventory_upload/reports_controller.rb