Module: ForemanSalt::Concerns::HostgroupsControllerExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb

Defined Under Namespace

Modules: Overrides

Instance Method Summary collapse

Instance Method Details

#salt_environment_selectedObject



27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb', line 27

def salt_environment_selected
  @hostgroup = Hostgroup.authorized(:view_hostgroups, Hostgroup).find_by(id: params[:hostgroup_id]) || Hostgroup.new(params[:hostgroup])

  if params[:hostgroup][:salt_environment_id].present?
    @salt_environment = ::ForemanSalt::SaltEnvironment.friendly.find(params[:hostgroup][:salt_environment_id])
    load_vars_for_ajax
    render partial: 'foreman_salt/salt_modules/host_tab_pane'
  else
    logger.info 'environment_id is required to render states'
  end
end