Sha256: 16b704a50b30e6879d6284366fd0f326dabac225101cd7597ca2d769b08f9443

Contents?: true

Size: 884 Bytes

Versions: 35

Compression:

Stored size: 884 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]

      start_report_generation(organization_id)

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

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
foreman_rh_cloud-9.0.51 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-8.0.51 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-7.0.48 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-7.0.47 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-8.0.50 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-8.0.49 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-8.0.48 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-8.0.47 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-8.0.46 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-6.0.45 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-5.0.46 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-5.0.45 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-7.0.46 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-5.0.44 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-7.0.45 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-6.0.44 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-5.0.43 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-6.0.42.2 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-6.0.42.1 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-6.0.43 app/controllers/foreman_inventory_upload/reports_controller.rb