Sha256: 4a8572ec7aece9da453e3a2c8ba8413349ebadd12f7794750d2ff796461f7efb

Contents?: true

Size: 898 Bytes

Versions: 22

Compression:

Stored size: 898 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.singleton_job_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

22 entries across 22 versions & 1 rubygems

Version Path
foreman_rh_cloud-4.0.36 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-3.0.33 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.35 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-3.0.32 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.32 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.31 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.30 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-3.0.29 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.29 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-3.0.28 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.27 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-3.0.26 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.26 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.25.1 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-3.0.25 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.25 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-3.0.24.1 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.24.1 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-3.0.24 app/controllers/foreman_inventory_upload/reports_controller.rb
foreman_rh_cloud-4.0.24 app/controllers/foreman_inventory_upload/reports_controller.rb