Sha256: 0c161295f3fb3c6de9d1edb9b6b5721b4529e62c1e68175a4cfe09376471f63a
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true module ForemanAnsible # Chained methods to extend the hosts menu with Ansible actions module HostsHelperExtensions extend ActiveSupport::Concern module Overrides def host_title_actions(*args) host = args.first if ansible_roles_present?(host) && User.current.can?(:create_job_invocations) button = ansible_roles_button(host) title_actions(button_group(button)) end super(*args) end def multiple_actions actions = super if User.current.can?(:create_job_invocations) && User.current.can?(:play_roles_on_host) actions += [[_('Play Ansible roles'), multiple_play_roles_hosts_path, false]] end actions end end included do prepend Overrides end def ansible_roles_present?(host) host.ansible_roles.present? || host.inherited_ansible_roles.present? end def ansible_roles_button(host) display_link_if_authorized( _('Run Ansible roles'), hash_for_play_roles_host_path(:id => host.id), :id => :ansible_roles_button, :class => 'btn btn-default', :'data-no-turbolink' => true ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_ansible-2.3.1 | app/helpers/foreman_ansible/hosts_helper_extensions.rb |
foreman_ansible-2.3.0 | app/helpers/foreman_ansible/hosts_helper_extensions.rb |