Sha256: 6c8abf72c36a4f4d7ec6b51c4a912c4cf707cc11f4fe740f1ef15b9b983fd392
Contents?: true
Size: 1017 Bytes
Versions: 3
Compression:
Stored size: 1017 Bytes
Contents
module ForemanInventoryUpload class AccountsController < ::ApplicationController def index organizations = User.current.my_organizations labels = organizations.pluck(:id, :name) accounts = Hash[ labels.map do |id, label| generate_report_status = status_for(id, ForemanInventoryUpload::Async::GenerateReportJob) upload_report_status = status_for(id, ForemanInventoryUpload::Async::UploadReportJob) [ id, { generate_report_status: generate_report_status, upload_report_status: upload_report_status, label: label, }, ] end ] render json: { autoUploadEnabled: Setting[:allow_auto_inventory_upload], accounts: accounts, }, status: :ok end private def status_for(label, job_class) label = job_class.output_label(label) ForemanInventoryUpload::Async::ProgressOutput.get(label)&.status end end end
Version data entries
3 entries across 3 versions & 1 rubygems