Module: ForemanSalt::HostsHelperExtensions::Overrides

Defined in:
app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb

Instance Method Summary collapse

Instance Method Details

#multiple_actionsObject



14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb', line 14

def multiple_actions
  actions = super
  if authorized_for(controller: :hosts, action: :edit)
    actions << [_('Change Salt Master'), select_multiple_salt_master_hosts_path] if SmartProxy.unscoped.authorized.with_features('Salt')
    if SmartProxy.unscoped.authorized.with_features('Salt')
      actions << [_('Change Salt Environment'), select_multiple_salt_environment_hosts_path]
    end
  end
  actions
end

#overview_fields(host) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb', line 25

def overview_fields(host)
  fields = super(host)

  fields.insert(5, [_('Salt Master'), (link_to(host.salt_proxy, hosts_path(search: "saltmaster = #{host.salt_proxy}")) if host.salt_proxy)])
  fields.insert(6, [_('Salt Environment'), (if host.salt_environment
                                              link_to(host.salt_environment, hosts_path(search: "salt_environment = #{host.salt_environment}"))
                                            end)])

  fields
end

#show_appropriate_host_buttons(host) ⇒ Object



6
7
8
9
10
11
12
# File 'app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb', line 6

def show_appropriate_host_buttons(host)
  (super(host) +
   [(if host.salt_master.present?
       link_to_if_authorized(_('Salt ENC'), { controller: :'foreman_salt/minions', action: :node, id: host },
         title: _('Salt external nodes YAML dump'), class: 'btn btn-default')
     end)]).flatten.compact
end