Sha256: 76a4d055fd3ab095f09af1c1ce12624f33b246098c360c6b7f47cbe02f6e5425

Contents?: true

Size: 1.03 KB

Versions: 80

Compression:

Stored size: 1.03 KB

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)

          [
            label,
            {
              generate_report_status: generate_report_status,
              upload_report_status: upload_report_status,
              id: id,
            },
          ]
        end
      ]

      render json: {
        accounts: accounts,
        CloudConnectorStatus: ForemanInventoryUpload::UploadsSettingsController.cloud_connector_status,
      }, 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

80 entries across 80 versions & 1 rubygems

Version Path
foreman_rh_cloud-9.0.59 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-11.0.2 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-11.0.1 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-11.0.0 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-9.0.58 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-10.0.2 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-9.0.57 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-10.0.1 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-9.0.56 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-9.0.55 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-9.0.54 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-9.0.53 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-9.0.52 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-8.0.52 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-9.0.51 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-8.0.51 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-7.0.48 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-7.0.47 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-8.0.50 app/controllers/foreman_inventory_upload/accounts_controller.rb
foreman_rh_cloud-8.0.49 app/controllers/foreman_inventory_upload/accounts_controller.rb