module ForemanSalt::HostsHelperExtensions::Overrides

def multiple_actions

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

def overview_fields(host)

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

def show_appropriate_host_buttons(host)

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