Module: ForemanPuppet::HostsHelper

Defined in:
app/helpers/foreman_puppet/hosts_helper.rb

Instance Method Summary collapse

Instance Method Details

#puppet_host_multiple_actionsObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/foreman_puppet/hosts_helper.rb', line 10

def puppet_host_multiple_actions
  if ForemanPuppet.extracted_from_core?
    actions = [{ action: [_('Change Environment'), foreman_puppet.select_multiple_environment_hosts_path], priority: 200 }]
    if authorized_for(controller: :hosts, action: :edit) && SmartProxy.unscoped.authorized.with_features('Puppet').exists?
      actions << { action: [_('Change Puppet Master'), foreman_puppet.select_multiple_puppet_proxy_hosts_path], priority: 1050 }
    end
    actions
  else
    []
  end
end

#puppet_host_overview_buttons(host) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/foreman_puppet/hosts_helper.rb', line 22

def puppet_host_overview_buttons(host)
  buttons = []
  if SmartProxy.with_features('Puppet').any?
    buttons << {
      button: link_to(_('Puppet YAML'), foreman_puppet.externalNodes_host_path(name: host), title: _('Puppet external nodes YAML dump'),
                                                                                            class: 'btn btn-default'), priority: 400
    }
  end
  buttons
end

#puppet_host_overview_fields(host) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/helpers/foreman_puppet/hosts_helper.rb', line 33

def puppet_host_overview_fields(host)
  fields = []
  if host.environment.present?
    fields << {
      field: [
        _('Puppet Environment'),
        link_to(host.puppet.environment, hosts_path(search: "environment = #{host.puppet.environment}")),
      ],
      priority: 650,
    }
  end
  fields
end