# frozen_string_literal: true # Controller to create JSON data to be used in react app class UiAcdController < ::Api::V2::BaseController def app @app_data = {} app_definition = ForemanAcd::AppDefinition.find(params[:id]) @app_data['app_definition'] = app_definition end def fdata @fdata = collect_fdata(params['id']) end private def collect_fdata(hostgroup_id) hg = Hostgroup.find(hostgroup_id) fdata = OpenStruct.new( :environments => Environment.all, :lifecycle_environments => Katello::KTEnvironment.all, :domains => Domain.all, :computeprofiles => ComputeProfile.all, :hostgroup_id => hg.id, :ptables => hg&.operatingsystem&.ptables ) fdata end end