Sha256: e1ee60bb2494dc5f18711843d68361185387023bdc1657907a3c3a8dd4781ee1

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

module ForemanSalt
  module HostsHelperExtensions
    extend ActiveSupport::Concern

    included do
      alias_method_chain :host_title_actions, :salt_run
      alias_method_chain :show_appropriate_host_buttons, :salt
    end

    def show_appropriate_host_buttons_with_salt(host)
      (show_appropriate_host_buttons_without_salt(host) +
         [(link_to_if_authorized(_('Salt ENC'), { :controller => :'foreman_salt/minions', :action => :node, :id => host },
                                 :title => _('Salt external nodes YAML dump'), :class => 'btn btn-default') unless host.salt_master.blank?)]).flatten.compact
    end

    def host_title_actions_with_salt_run(host)
      title_actions(
        button_group(
          if host.try(:salt_proxy)
            link_to_if_authorized(_('Run Salt'), { :controller => :'foreman_salt/minions', :action => :run, :id => host },
                                  :title => _('Trigger a state.highstate run on a node'))
          end
        )
      )
      host_title_actions_without_salt_run(host)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_salt-2.1.0 app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb
foreman_salt-2.0.2 app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb
foreman_salt-2.0.1 app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb
foreman_salt-2.0.0 app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb