foreman_discovery 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/controllers/api/v2/discovered_hosts_controller.rb +6 -4
  4. data/app/controllers/api/v2/discovery_rules_controller.rb +3 -2
  5. data/app/controllers/concerns/foreman/controller/parameters/discovered_host.rb +24 -0
  6. data/app/controllers/concerns/foreman/controller/parameters/discovery_rule.rb +17 -0
  7. data/app/controllers/discovered_hosts_controller.rb +3 -2
  8. data/app/controllers/discovery_rules_controller.rb +4 -2
  9. data/app/helpers/discovered_hosts_helper.rb +7 -10
  10. data/app/models/concerns/discovery_subnet.rb +0 -2
  11. data/app/models/concerns/fact_value_extensions.rb +5 -0
  12. data/app/models/discovery_attribute_set.rb +0 -1
  13. data/app/models/discovery_rule.rb +0 -2
  14. data/app/models/host/discovered.rb +0 -2
  15. data/app/models/host/managed_extensions.rb +1 -3
  16. data/app/models/hostgroup_extensions.rb +0 -1
  17. data/app/models/nic/managed_extensions.rb +26 -0
  18. data/app/models/setting/discovered.rb +1 -0
  19. data/app/views/discovered_hosts/_discovered_host_modal.html.erb +30 -0
  20. data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +1 -29
  21. data/app/views/discovered_hosts/show.html.erb +20 -12
  22. data/app/views/discovery_rules/_form.html.erb +1 -1
  23. data/app/views/foreman_discovery/debian_kexec.erb +2 -3
  24. data/app/views/foreman_discovery/redhat_kexec.erb +2 -3
  25. data/lib/foreman_discovery/engine.rb +8 -1
  26. data/lib/foreman_discovery/version.rb +1 -1
  27. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  28. data/locale/ca/foreman_discovery.edit.po +1 -1
  29. data/locale/ca/foreman_discovery.po +2 -2
  30. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  31. data/locale/de/foreman_discovery.edit.po +33 -33
  32. data/locale/de/foreman_discovery.po +67 -67
  33. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  34. data/locale/en/foreman_discovery.edit.po +138 -130
  35. data/locale/en/foreman_discovery.po +13 -7
  36. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  37. data/locale/en_GB/foreman_discovery.edit.po +34 -33
  38. data/locale/en_GB/foreman_discovery.po +33 -32
  39. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  40. data/locale/es/foreman_discovery.edit.po +51 -51
  41. data/locale/es/foreman_discovery.po +51 -51
  42. data/locale/foreman_discovery.pot +151 -144
  43. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  44. data/locale/fr/foreman_discovery.edit.po +1 -1
  45. data/locale/fr/foreman_discovery.po +33 -33
  46. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  47. data/locale/gl/foreman_discovery.edit.po +1 -1
  48. data/locale/gl/foreman_discovery.po +2 -2
  49. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  50. data/locale/it/foreman_discovery.edit.po +5 -5
  51. data/locale/it/foreman_discovery.po +5 -5
  52. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  53. data/locale/ja/foreman_discovery.edit.po +37 -37
  54. data/locale/ja/foreman_discovery.po +36 -36
  55. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  56. data/locale/ko/foreman_discovery.edit.po +36 -36
  57. data/locale/ko/foreman_discovery.po +35 -35
  58. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  59. data/locale/pt_BR/foreman_discovery.edit.po +40 -40
  60. data/locale/pt_BR/foreman_discovery.po +39 -39
  61. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  62. data/locale/ru/foreman_discovery.edit.po +8 -8
  63. data/locale/ru/foreman_discovery.po +8 -8
  64. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  65. data/locale/sv_SE/foreman_discovery.edit.po +1 -1
  66. data/locale/sv_SE/foreman_discovery.po +2 -2
  67. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  68. data/locale/zh_CN/foreman_discovery.edit.po +37 -37
  69. data/locale/zh_CN/foreman_discovery.po +36 -36
  70. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  71. data/locale/zh_TW/foreman_discovery.edit.po +36 -36
  72. data/locale/zh_TW/foreman_discovery.po +35 -35
  73. data/test/factories/discovery_rule_related.rb +19 -2
  74. data/test/functional/api/v2/discovered_hosts_controller_test.rb +1 -0
  75. data/test/functional/api/v2/discovery_rules_controller_test.rb +13 -5
  76. data/test/functional/discovered_hosts_controller_test.rb +71 -3
  77. data/test/functional/discovery_rules_controller_test.rb +23 -6
  78. data/test/test_helper_discovery.rb +4 -0
  79. data/test/unit/discovered_extensions_test.rb +2 -0
  80. data/test/unit/fact_value_extensions_test.rb +11 -0
  81. metadata +9 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50f5e89c539ec3eb3bee287fc9251f4e0dad65f9
4
- data.tar.gz: ccad5c9dcb424f30bd2802aaec3489b55aba7e71
3
+ metadata.gz: eb5bd6046ce32fec83f20be39d6a013432f3b68a
4
+ data.tar.gz: a731fce4e700240569682ad27870e595c877cad7
5
5
  SHA512:
6
- metadata.gz: 110b9578fc4bcf83d47e11254cbcd2c157268f2ba17c4aae6a9a21a47beeb68511b460f55d4427cbd88d7137d92dac1922589c2d4b20e48182799103e746f95c
7
- data.tar.gz: c10cd4e42f0ac2c5d5a7eaa2b600a471a7f641e2d8a86fe3433201659813bba3f312a219f8efed4159697f0bbfd94ad39bd5c5d79f23fe95e43cdd738f796b11
6
+ metadata.gz: 4062bb0efcd048821962c566f1b33ac4151caaf09d9a1787116a78cbefa5f38eb48afcb135502f25d31fe0270a6c973636ec77ac56d66c4f1d9c4e616a2d9478
7
+ data.tar.gz: 274935dfa8429e46473404b331b346b528467872e23b4d49eecdab59f5fe4b3eb5690d61905db2bc509d4558242a7ad9645b9dd42b009a18a82ba16785559da3
data/README.md CHANGED
@@ -11,7 +11,7 @@ The main documentation can be found in the [Foreman Discovery manual] (http://th
11
11
  If a source-based install of Foreman is in use, the develop
12
12
  branch of the plugin can be obtained by updating the Gemfile in this way:
13
13
 
14
- gem 'foreman_discovery', :git => "https://github.com/theforeman/foreman_discovery.git"
14
+ gem 'foreman_discovery', :git => "https://github.com/theforeman/foreman_discovery.git", :branch => 'develop'
15
15
 
16
16
  # API
17
17
 
@@ -1,6 +1,7 @@
1
1
  module Api
2
2
  module V2
3
3
  class DiscoveredHostsController < ::Api::V2::BaseController
4
+ include Foreman::Controller::Parameters::DiscoveredHost
4
5
  include Foreman::Controller::DiscoveredExtensions
5
6
 
6
7
  before_filter :find_resource, :except => %w{index create facts auto_provision_all reboot_all}
@@ -40,7 +41,7 @@ module Api
40
41
  param_group :discovered_host, :as => :create
41
42
 
42
43
  def create
43
- @discovered_host = Host::Discovered.new(params[:discovered_host])
44
+ @discovered_host = Host::Discovered.new(discovered_host_params)
44
45
  process_response @discovered_host.save
45
46
  end
46
47
 
@@ -78,7 +79,7 @@ module Api
78
79
  def update
79
80
  @host = ::ForemanDiscovery::HostConverter.to_managed(@discovered_host)
80
81
  forward_request_url
81
- update_response = @host.update_attributes(params[:discovered_host])
82
+ update_response = @host.update_attributes(discovered_host_params)
82
83
  process_response update_response
83
84
  end
84
85
 
@@ -93,15 +94,16 @@ module Api
93
94
  param :facts, Hash, :required => true, :desc => N_("hash containing facts for the host with minimum set of facts: discovery_bootif, macaddress_eth0, ipaddress, ipaddress_eth0, interfaces: eth0 (example in case primary interface is named eth0)")
94
95
 
95
96
  def facts
97
+ facts = params['facts']
96
98
  state = true
97
- @discovered_host = Host::Discovered.import_host(params[:facts])
99
+ @discovered_host = Host::Discovered.import_host(facts)
98
100
  Rails.logger.warn "Discovered facts import unsuccessful, skipping auto provisioning" unless @discovered_host
99
101
  if Setting['discovery_auto'] && @discovered_host && rule = find_discovery_rule(@discovered_host)
100
102
  state = perform_auto_provision(@discovered_host, rule)
101
103
  end
102
104
  process_response state
103
105
  rescue Exception => e
104
- logger.warn "Host discovery failed, facts: #{params[:facts]}"
106
+ logger.warn "Host discovery failed, facts: #{facts}"
105
107
  logger.debug e.message + "\n" + e.backtrace.join("\n")
106
108
  render :json => {'message'=>e.to_s}, :status => :unprocessable_entity
107
109
  end
@@ -1,6 +1,7 @@
1
1
  module Api
2
2
  module V2
3
3
  class DiscoveryRulesController < ::Api::V2::BaseController
4
+ include Foreman::Controller::Parameters::DiscoveryRule
4
5
 
5
6
  before_filter :find_resource, :except => %w{index create facts}
6
7
 
@@ -43,7 +44,7 @@ module Api
43
44
  param_group :discovery_rule, :as => :create
44
45
 
45
46
  def create
46
- @discovery_rule = DiscoveryRule.new(params[:discovery_rule])
47
+ @discovery_rule = DiscoveryRule.new(discovery_rule_params)
47
48
  process_response @discovery_rule.save
48
49
  end
49
50
 
@@ -52,7 +53,7 @@ module Api
52
53
  param_group :discovery_rule, :as => :update
53
54
 
54
55
  def update
55
- process_response @discovery_rule.update_attributes(params[:discovery_rule])
56
+ process_response @discovery_rule.update_attributes(discovery_rule_params)
56
57
  end
57
58
 
58
59
  api :DELETE, "/discovery_rules/:id/", N_("Delete a rule")
@@ -0,0 +1,24 @@
1
+ module Foreman::Controller::Parameters::DiscoveredHost
2
+ extend ActiveSupport::Concern
3
+ include Foreman::Controller::Parameters::HostBase
4
+ include Foreman::Controller::Parameters::HostCommon
5
+
6
+ class_methods do
7
+ def discovered_host_params_filter
8
+ Foreman::ParameterFilter.new(::Host::Discovered).tap do |filter|
9
+ filter.permit :discovery_rule_id
10
+
11
+ add_host_base_params_filter(filter)
12
+ add_host_common_params_filter(filter)
13
+ end
14
+ end
15
+ end
16
+
17
+ def discovered_host_params
18
+ self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context)
19
+ end
20
+
21
+ def discovered_host_params_host
22
+ self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context, :host)
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ module Foreman::Controller::Parameters::DiscoveryRule
2
+ extend ActiveSupport::Concern
3
+ include Foreman::Controller::Parameters::Taxonomix
4
+
5
+ class_methods do
6
+ def discovery_rule_params_filter
7
+ Foreman::ParameterFilter.new(::DiscoveryRule).tap do |filter|
8
+ filter.permit :name, :search, :hostname, :priority, :enabled, :hostgroup, :hostgroup_id, :max_count
9
+ add_taxonomix_params_filter(filter)
10
+ end
11
+ end
12
+ end
13
+
14
+ def discovery_rule_params
15
+ self.class.discovery_rule_params_filter.filter_params(params, parameter_filter_context)
16
+ end
17
+ end
@@ -1,4 +1,5 @@
1
1
  class DiscoveredHostsController < ::ApplicationController
2
+ include Foreman::Controller::Parameters::DiscoveredHost
2
3
  include Foreman::Controller::AutoCompleteSearch
3
4
  include Foreman::Controller::TaxonomyMultiple
4
5
  include Foreman::Controller::DiscoveredExtensions
@@ -50,7 +51,7 @@ class DiscoveredHostsController < ::ApplicationController
50
51
 
51
52
  def edit
52
53
  @host = ::ForemanDiscovery::HostConverter.to_managed(@host, true, false) unless @host.nil?
53
- @host.attributes = @host.apply_inherited_attributes(params[:host]) unless params[:host].empty?
54
+ @host.attributes = @host.apply_inherited_attributes(discovered_host_params_host) unless discovered_host_params_host.empty?
54
55
  @host.set_hostgroup_defaults
55
56
  setup_host_class_variables(@host)
56
57
  @override_taxonomy = true
@@ -64,7 +65,7 @@ class DiscoveredHostsController < ::ApplicationController
64
65
  def update
65
66
  @host = ::ForemanDiscovery::HostConverter.to_managed(@host)
66
67
  forward_url_options
67
- @host.attributes = params[:host]
68
+ @host.attributes = discovered_host_params_host
68
69
 
69
70
  perform_update(@host)
70
71
  end
@@ -2,6 +2,8 @@ class DiscoveryRulesController < ApplicationController
2
2
  # Two-pane searching must be disabled for rules otherwise query completion will not work
3
3
  #include Foreman::Controller::AutoCompleteSearch
4
4
 
5
+ include Foreman::Controller::Parameters::DiscoveryRule
6
+
5
7
  before_filter :find_resource, :only => [:edit, :update, :destroy, :enable, :disable, :auto_provision]
6
8
 
7
9
  def index
@@ -14,7 +16,7 @@ class DiscoveryRulesController < ApplicationController
14
16
  end
15
17
 
16
18
  def create
17
- @discovery_rule = DiscoveryRule.new(params[:discovery_rule])
19
+ @discovery_rule = DiscoveryRule.new(discovery_rule_params)
18
20
  if @discovery_rule.save
19
21
  process_success
20
22
  else
@@ -26,7 +28,7 @@ class DiscoveryRulesController < ApplicationController
26
28
  end
27
29
 
28
30
  def update
29
- if @discovery_rule.update_attributes(params[:discovery_rule])
31
+ if @discovery_rule.update_attributes(discovery_rule_params)
30
32
  process_success
31
33
  else
32
34
  process_error
@@ -11,15 +11,14 @@ module DiscoveredHostsHelper
11
11
  end
12
12
 
13
13
  def discovered_hosts_title_actions(host)
14
- actions = [[_('Provision'), hash_for_edit_discovered_host_path(:id => host).merge(:auth_object => host, :permission => :provision_discovered_hosts)]]
15
- actions << [_('Auto Provision'), hash_for_auto_provision_discovered_host_path(:id => host).merge(:auth_object => host, :permission => :auto_provision_discovered_hosts), :method => :post]
14
+ actions = [[_('Auto Provision'), hash_for_auto_provision_discovered_host_path(:id => host).merge(:auth_object => host, :permission => :auto_provision_discovered_hosts), :method => :post]]
16
15
  actions << [_('Refresh facts') ,hash_for_refresh_facts_discovered_host_path(:id => host).merge(:auth_object => host, :permission => :edit_discovered_hosts)]
17
16
  actions << [_('Reboot') ,hash_for_reboot_discovered_host_path(:id => host).merge(:auth_object => host, :permission => :edit_discovered_hosts), :method => :put]
18
17
  title_actions(
19
18
  button_group(
20
19
  link_to(_("Back"), :back, :class => "btn btn-default")
21
20
  ),
22
- select_action_button( _("Select Action"), {}, actions.map { |action| display_link_if_authorized(action[0] , action[1], action[2] || {}) }.flatten ),
21
+ select_action_button( _("Select Action"), {}, provision_button(host, hash_for_edit_discovered_host_path(:id => host)), actions.map { |action| display_link_if_authorized(action[0] , action[1], action[2] || {}) }.flatten ),
23
22
  button_group(
24
23
  link_to(_("Expand All"),"#",:class => "btn btn-default",:onclick => "$('.glyphicon-plus-sign').toggleClass('glyphicon glyphicon-minus-sign glyphicon glyphicon-plus-sign');
25
24
  $('.facts-panel').addClass('collapse in').height('auto');"
@@ -90,12 +89,10 @@ module DiscoveredHostsHelper
90
89
  def provision_button(host, authorization_options)
91
90
  return '' unless authorized_for(authorization_options)
92
91
 
93
- button_tag(
94
- _('Provision'),
95
- :type => :button,
96
- :class => 'btn btn-sm btn-default',
97
- :data => {
98
- :toggle => 'modal',
99
- :target => "#fixedPropertiesSelector-#{host.id}"})
92
+ link_to(
93
+ _('Provision'), "#",
94
+ :data => {
95
+ :toggle => 'modal',
96
+ :target => "#fixedPropertiesSelector-#{host.id}"})
100
97
  end
101
98
  end
@@ -2,8 +2,6 @@ module DiscoverySubnet
2
2
  extend ActiveSupport::Concern
3
3
  included do
4
4
  belongs_to :discovery, :class_name => "SmartProxy"
5
-
6
- attr_accessible :discovery_id
7
5
  end
8
6
  end
9
7
 
@@ -4,5 +4,10 @@ module FactValueExtensions
4
4
  included do
5
5
  belongs_to :discovered_host, :class_name => "Host::Discovered", :foreign_key => :host_id
6
6
  scoped_search :in => :discovered_host, :on => :id, :complete_enabled => false, :only_explicit => true, :rename => :discovered_host
7
+
8
+ def host
9
+ return discovered_host if discovered_host.present?
10
+ super
11
+ end
7
12
  end
8
13
  end
@@ -1,6 +1,5 @@
1
1
  class DiscoveryAttributeSet < ActiveRecord::Base
2
2
  belongs_to :host, :class_name => "Host::Discovered", :foreign_key => :host_id
3
- attr_accessible :cpu_count, :disk_count, :disks_size, :memory
4
3
 
5
4
  validates :cpu_count, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
6
5
  validates :memory, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
@@ -5,8 +5,6 @@ class DiscoveryRule < ActiveRecord::Base
5
5
  include Parameterizable::ByIdName
6
6
  include Taxonomix
7
7
 
8
- attr_accessible :name, :priority, :search, :enabled, :hostgroup, :hostgroup_id, :max_count, :hostname
9
-
10
8
  validates :name, :presence => true, :uniqueness => true,
11
9
  :format => { :with => /\A(\S+)\Z/, :message => N_("can't contain white spaces.") }
12
10
  validates :search, :presence => true
@@ -2,8 +2,6 @@ class Host::Discovered < ::Host::Base
2
2
  include ScopedSearchExtensions
3
3
  include Foreman::Renderer
4
4
 
5
- attr_accessible :discovery_rule_id
6
-
7
5
  belongs_to :hostgroup
8
6
  has_one :discovery_attribute_set, :foreign_key => :host_id, :dependent => :destroy
9
7
 
@@ -12,7 +12,6 @@ module Host::ManagedExtensions
12
12
 
13
13
  # extra flag for post_queue callbacks which has no access to facts
14
14
  attr_accessor :legacy_api
15
- attr_accessible :discovery_rule_id
16
15
  end
17
16
 
18
17
  def queue_reboot
@@ -45,8 +44,7 @@ module Host::ManagedExtensions
45
44
  template = provisioning_template(:kind => 'kexec')
46
45
  raise ::Foreman::Exception.new(N_("Kexec template not associated with operating system")) unless template
47
46
  @host = self
48
- # the following two attributes are overwritten by TFTP in preview mode (kept for compatibility)
49
- @kernel, @initrd = operatingsystem.boot_files_uri(@host.medium, @host.architecture)
47
+ @kexec_kernel, @kexec_initrd = operatingsystem.boot_files_uri(@host.medium, @host.architecture)
50
48
  json = unattended_render(template)
51
49
  old.becomes(Host::Discovered).kexec json
52
50
  true
@@ -3,6 +3,5 @@ module HostgroupExtensions
3
3
 
4
4
  included do
5
5
  has_many :discovery_rules, :dependent => :restrict_with_error
6
- attr_accessible :discovery_rules, :discovery_rule_ids, :discovery_rule_names, :type
7
6
  end
8
7
  end
@@ -0,0 +1,26 @@
1
+ module Nic::ManagedExtensions
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ after_validation :discovery_queue_rebuild_dns
6
+ end
7
+
8
+ def discovery_queue_rebuild_dns
9
+ return unless (dns? || dns6? || reverse_dns? || reverse_dns6?) && errors.empty? && Setting[:discovery_always_rebuild_dns]
10
+ return if self.host.new_record? # Discovered Hosts already exist, and new_records will break `find`
11
+ return unless self.host.type_changed? and ::Host::Base.find(self.host.id).type == "Host::Discovered"
12
+ return if self.pending_dns_record_changes?
13
+ logger.debug "Queuing DNS rebuild for #{self}"
14
+ queue.create(:name => _("Rebuild DNS for %s") % self, :priority => 10, :action => [self, :set_discovery_rebuild_dns])
15
+ end
16
+
17
+ def set_discovery_rebuild_dns
18
+ logger.debug "Executing DNS rebuild for #{self}"
19
+ rebuild_dns
20
+ end
21
+
22
+ def del_discovery_rebuild_dns
23
+ # Just a place holder, so if rollback is needed, we won't get an exception about not knowing how to rollback.
24
+ # This is a no-op, since we cannot really rollback rebuild_dns
25
+ end
26
+ end
@@ -31,6 +31,7 @@ class Setting::Discovered < ::Setting
31
31
  self.set('discovery_facts_ipmi', N_("Regex to organize facts for ipmi section"), "", N_("IPMI facts")),
32
32
  self.set('discovery_lock', N_("Automatically generate PXE configuration to pin a newly discovered host to discovery"), false, N_("Lock PXE")),
33
33
  self.set('discovery_lock_template', N_("PXE template to be used when pinning a host to discovery"), 'pxelinux_discovery', N_("Locked template name"),nil,{ :collection => Proc.new {Hash[ProvisioningTemplate.all.map{|template| [template[:name], template[:name]]}]} }),
34
+ self.set('discovery_always_rebuild_dns', N_("Force DNS entries creation when provisioning discovered host"), true, N_("Force DNS")),
34
35
  ].compact.each { |s| self.create s.update(:category => "Setting::Discovered")}
35
36
  end
36
37
 
@@ -0,0 +1,30 @@
1
+ <div class="modal" id="<%= "fixedPropertiesSelector-#{host.id}" %>" tabindex="-1" role="dialog" aria-labelledby="fixedPropertiesSelectorLabel">
2
+ <div class="modal-dialog" role="document">
3
+ <div class="modal-content">
4
+ <%= form_for host, :url => edit_discovered_host_path(host), :method => :get do |f| %>
5
+ <div class="modal-header">
6
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
7
+ <h4 class="modal-title" id="fixedPropertiesSelectorLabel"><%= _('Select initial host properties') %></h4>
8
+ </div>
9
+ <div class="modal-body">
10
+ <%= select_f f, :hostgroup_id, accessible_resource_records(:hostgroup, :title).to_a, :id, :to_label,
11
+ { :include_blank => true },
12
+ { :help_inline => :indicator, :size => 'col-md-10' } %>
13
+
14
+ <% if show_organization_tab? %>
15
+ <%= select_f f, :organization_id, Organization.my_organizations, :id, :to_label, {}, {:size => 'col-md-10'} %>
16
+ <% end %>
17
+
18
+ <% if show_location_tab? %>
19
+ <%= select_f f, :location_id, Location.my_locations, :id, :to_label, {}, {:size => 'col-md-10'} %>
20
+ <% end %>
21
+ </div>
22
+ <div class="modal-footer">
23
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
24
+ <input type="submit" class="btn btn-default" value="<%= _('Quick create') %>" name="quick_submit" />
25
+ <input type="submit" class="btn btn-primary" value="<%= _('Create host') %>" />
26
+ </div>
27
+ <% end %>
28
+ </div>
29
+ </div>
30
+ </div>
@@ -39,36 +39,8 @@
39
39
  <td class="hidden-tablet hidden-xs"><%= disc_report_column(host) %></td>
40
40
  <td>
41
41
  <!-- Modal -->
42
- <div class="modal" id="<%= "fixedPropertiesSelector-#{host.id}" %>" tabindex="-1" role="dialog" aria-labelledby="fixedPropertiesSelectorLabel">
43
- <div class="modal-dialog" role="document">
44
- <div class="modal-content">
45
- <%= form_for host, :url => edit_discovered_host_path(host), :method => :get do |f| %>
46
- <div class="modal-header">
47
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
48
- <h4 class="modal-title" id="fixedPropertiesSelectorLabel"><%= _('Select initial host properties') %></h4>
49
- </div>
50
- <div class="modal-body">
51
- <%= select_f f, :hostgroup_id, accessible_hostgroups, :id, :to_label,
52
- { :include_blank => true },
53
- { :help_inline => :indicator, :size => 'col-md-10' } %>
54
-
55
- <% if show_organization_tab? %>
56
- <%= select_f f, :organization_id, Organization.my_organizations, :id, :to_label, {}, {:size => 'col-md-10'} %>
57
- <% end %>
58
-
59
- <% if show_location_tab? %>
60
- <%= select_f f, :location_id, Location.my_locations, :id, :to_label, {}, {:size => 'col-md-10'} %>
61
- <% end %>
62
- </div>
63
- <div class="modal-footer">
64
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
65
- <input type="submit" class="btn btn-default" value="<%= _('Quick create') %>" name="quick_submit"></input>
66
- <input type="submit" class="btn btn-primary" value="<%= _('Create host') %>"></input>
67
- </div>
68
- <% end %>
69
- </div>
42
+ <%= render :partial => "discovered_host_modal", :locals => {:host => host} %>
70
43
  </div>
71
- </div>
72
44
  <%= action_buttons(
73
45
  provision_button(host, hash_for_edit_discovered_host_path(:id => host)),
74
46
  display_link_if_authorized(_("Auto Provision"), hash_for_auto_provision_discovered_host_path(:id => host), :method => :post),
@@ -2,25 +2,35 @@
2
2
 
3
3
  <%= discovered_hosts_title_actions(@host) %>
4
4
 
5
+ <!-- Modal -->
6
+ <%= render :partial => "discovered_host_modal", :locals => {:host => @host} %>
7
+
5
8
  <div class="row">
6
9
  <div class="col-md-6">
7
10
  <div id="category-highlights" class="panel panel-default">
8
- <div class="panel-heading" ><strong> <%= _(@categories_names[0]) %></strong> </div>
11
+ <div class="panel-heading" role="tab">
12
+ <h4 class="panel-title">
13
+ <a role="button" class="expendable-link" data-toggle="collapse" href="#highlights-panel" aria-expanded="true">
14
+ <%= _(@categories_names[0]) %>
15
+ </a>
16
+ </h4>
17
+ </div>
18
+ <div id="highlights-panel" class="panel-collapse collapse facts-panel in" >
9
19
  <table class="table table-bordered table-condensed table-fixed">
10
- <% @categories[0].sort.each do |key, val| %>
11
- <tr id="fact-<%= key.try(:downcase) %>" class="">
12
- <th class="ellipsis" width="40%"> <strong> <%= key %> </strong></th>
13
- <td><%= val %></td>
14
- </tr>
20
+ <% @categories[0].sort.each do |key, val| %>
21
+ <tr id="fact-<%= key.try(:downcase) %>" class="">
22
+ <th class="ellipsis" width="40%"> <strong> <%= key %> </strong></th>
23
+ <td><%= val %></td>
24
+ </tr>
15
25
  <% end -%>
16
26
  </table>
27
+ </div>
17
28
  </div>
18
29
  <% unless @interfaces.empty? %>
19
30
  <div class="panel panel-default">
20
31
  <div class="panel-heading" role="tab">
21
32
  <h4 class="panel-title">
22
- <a role="button" class="expendable-link" data-toggle="collapse" data-parent="#accordion" href="#interfaces-panel" aria-expanded="true" onclick="$(this).find(':first-child').toggleClass('glyphicon glyphicon-minus-sign glyphicon glyphicon-plus-sign')">
23
- <span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>
33
+ <a role="button" class="expendable-link" data-toggle="collapse" href="#interfaces-panel" aria-expanded="true">
24
34
  <%= _("Interfaces") %>
25
35
  </a>
26
36
  </h4>
@@ -28,7 +38,7 @@
28
38
  <div id="interfaces-panel" class="panel-collapse collapse facts-panel in" >
29
39
  <table class="table table-bordered table-condensed table-fixed" id="interfaceList">
30
40
  <tr>
31
- <th class="hidden-xs " width="12%"></th>
41
+ <th class="hidden-xs " width="12%"><%= _('Type') %></th>
32
42
  <th class="hidden-xs "><%= _('Identifier') %></th>
33
43
  <th class="hidden-xs "><%= _("MAC address") %></th>
34
44
  <th class="hidden-xs "><%= _("IP address") %></th>
@@ -54,8 +64,7 @@
54
64
  <div id="category-<%= @categories_names[index].downcase %>" class="panel panel-default">
55
65
  <div class="panel-heading" role="tab">
56
66
  <h4 class="panel-title">
57
- <a role="button" class="expendable-link" data-toggle="collapse" data-parent="#accordion" href="#<%= @categories_names[index].to_s + "panel" %>" aria-expanded="true" onclick="$(this).find(':first-child').toggleClass('glyphicon glyphicon-minus-sign glyphicon glyphicon-plus-sign')">
58
- <span class="glyphicon glyphicon<%= (@categories_names[index].to_s.include?("Storage")? "-minus-sign":"-plus-sign")%>" aria-hidden="true"></span>
67
+ <a role="button" class="expendable-link" data-toggle="collapse" data-parent="#accordion" href="#<%= @categories_names[index].to_s + "panel" %>" aria-expanded="true">
59
68
  <%= _(@categories_names[index]) %>
60
69
  </a>
61
70
  </h4>
@@ -80,7 +89,6 @@
80
89
  $(document).ready(function(){
81
90
  $("table").css('padding', '0');
82
91
  $("table").css("cssText", 'margin-bottom: 0 !important;');
83
- $(".panel-default").css('margin-bottom', "10px")
84
92
 
85
93
  provision_class = 'active'
86
94
  primary_class = 'active'