Sha256: d2c26b2ed45c5bb0e44b2ad2e689d135400c466a3c2ec614dca16a497d83b3f8
Contents?: true
Size: 997 Bytes
Versions: 7
Compression:
Stored size: 997 Bytes
Contents
# frozen_string_literal: true module ForemanInventoryUpload class ReportsController < ::ApplicationController def last label = ForemanInventoryUpload::Async::GenerateReportJob.output_label(params[:portal_user]) 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 portal_user = params[:portal_user] generated_file_name = File.join(ForemanInventoryUpload.base_folder, "#{portal_user}.tar.gz") ForemanInventoryUpload::Async::GenerateReportJob.perform_later(generated_file_name, portal_user) render json: { action_status: 'success', }, status: :ok end end end
Version data entries
7 entries across 7 versions & 1 rubygems