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
# File 'app/helpers/foreman_puppet/hosts_helper.rb', line 10

def puppet_host_multiple_actions
  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
end

#puppet_host_overview_buttons(host) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/foreman_puppet/hosts_helper.rb', line 18

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



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/foreman_puppet/hosts_helper.rb', line 29

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