Sha256: 32738684aba81154406b7f5e9acb2b0b0d97b3c40b756cf3904f446d537389c4

Contents?: true

Size: 1.59 KB

Versions: 22

Compression:

Stored size: 1.59 KB

Contents

module DiscoveryRulesHelper
  def search_path(type)
    if type.nil?
      ''
    else
      case type
        when 'Image'
          '' # images are nested resource for CR, we can't autocomplete
        when 'HostClass'
          '' # host classes is only used in API
        when 'Parameter'
          '' # parameter is only used in API
        else
          return FiltersHelperOverrides.search_path(type) if FiltersHelperOverrides.can_override?(type)
          resource_path = resource_path(type)
          resource_path.nil? ? "" : resource_path + auto_complete_search_path
      end
    end
  end

  def auto_complete_search_path
    '/auto_complete_search'
  end

  def permitted_discovery_actions(rule)
    actions = [display_link_if_authorized(_('Discovered Hosts'), hash_for_discovered_hosts_path.merge(:search => rule.search))]
    actions << display_link_if_authorized(_('Associated Hosts'), hash_for_hosts_path.merge(:search => "discovery_rule = \"#{rule.name}\""))
    if rule.enabled?
      actions << display_link_if_authorized(_('Disable'), hash_for_disable_discovery_rule_path(:id => rule).merge(:auth_object => rule, :authorizer => authorizer), :confirm => _("Disable rule '%s'?") % rule)
    else
      actions << display_link_if_authorized(_('Enable'), hash_for_enable_discovery_rule_path(:id => rule).merge(:auth_object => rule, :authorizer => authorizer), :confirm => _("Enable rule '%s'?") % rule)
    end
    actions << display_delete_if_authorized(hash_for_discovery_rule_path(:id => rule).merge(:auth_object => rule, :authorizer => authorizer), :confirm => _("Delete rule '%s'?") % rule)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
foreman_discovery-14.0.1 app/helpers/discovery_rules_helper.rb
foreman_discovery-14.0.0 app/helpers/discovery_rules_helper.rb
foreman_discovery-13.0.1 app/helpers/discovery_rules_helper.rb
foreman_discovery-12.0.2 app/helpers/discovery_rules_helper.rb
foreman_discovery-12.0.1 app/helpers/discovery_rules_helper.rb
foreman_discovery-12.0.0 app/helpers/discovery_rules_helper.rb
foreman_discovery-11.0.0 app/helpers/discovery_rules_helper.rb
foreman_discovery-9.1.5 app/helpers/discovery_rules_helper.rb
foreman_discovery-9.1.4 app/helpers/discovery_rules_helper.rb
foreman_discovery-10.0.0 app/helpers/discovery_rules_helper.rb
foreman_discovery-9.1.3 app/helpers/discovery_rules_helper.rb
foreman_discovery-9.1.2 app/helpers/discovery_rules_helper.rb
foreman_discovery-9.1.1 app/helpers/discovery_rules_helper.rb
foreman_discovery-9.1.0 app/helpers/discovery_rules_helper.rb
foreman_discovery-9.0.0 app/helpers/discovery_rules_helper.rb
foreman_discovery-8.0.1 app/helpers/discovery_rules_helper.rb
foreman_discovery-8.0.0 app/helpers/discovery_rules_helper.rb
foreman_discovery-7.0.1 app/helpers/discovery_rules_helper.rb
foreman_discovery-7.0.0 app/helpers/discovery_rules_helper.rb
foreman_discovery-6.0.0 app/helpers/discovery_rules_helper.rb