Project

General

Profile

Download (7.56 KB) Statistics
| Branch: | Tag: | Revision:
96277f87 Tomas Strachota
<%= javascript 'hosts', 'host_edit', 'host_edit_interfaces', 'class_edit', 'compute_resource', 'lookup_keys'%>
90ff2a3a Dmitri Dolguikh
<%= render "hosts/dhcp_lease_errors" if has_dhcp_lease_errors?(@host.errors) %>
<%= render "hosts/conflicts" if (!has_dhcp_lease_errors?(@host.errors) && has_conflicts?(@host.errors)) %>
796352ed Greg Sutcliffe
<%= render "hosts/progress" %>
66afbc33 Joseph Mitchell Magen
<% Taxonomy.as_taxonomy @organization , @location do %>

c5e90813 Greg Sutcliffe
<%= form_for @host, :html => {:data => {:id => @host.try(:id), :type_changed => @host.type_changed?, :submit => 'progress_bar'}} do |f| %>
66afbc33 Joseph Mitchell Magen
<%= base_errors_for @host %>

<ul class="nav nav-tabs" data-tabs="tabs">
4d4557e9 Joseph Magen
<li class="active"><a href="#primary" data-toggle="tab"><%= _('Host') %></a></li>
3cdaa292 Dmitri Dolguikh
<% if SmartProxy.with_features("Puppet").count > 0 %>
4d4557e9 Joseph Magen
<li><a href="#puppet_klasses" data-toggle="tab"><%= _('Puppet Classes') %></a></li>
<% end %>
3a30ac9e Marek Hulan
<li id="network_tab" data-refresh-url="<%= interfaces_hosts_path %>"><a href="#network" data-toggle="tab"><%= _('Interfaces') %></a></li>
4d4557e9 Joseph Magen
<% if SETTINGS[:unattended] and @host.managed %>
<li><a href="#os" data-toggle="tab"><%= _('Operating System') %></a></li>
acfbc458 Marek Hulan
<% if authorized_for(:controller => "Compute::Resources::Vms", :action => :create) %>
4d4557e9 Joseph Magen
<li id="compute_resource_tab" <%= display? !(@host.compute_resource_id || params[:host] && params[:host][:compute_resource_id].present?)%>><a href="#compute_resource" data-toggle="tab"><%= _('Virtual Machine') %></a></li>
<% end %>
<% end %>
<li><a href="#params" id='params-tab' data-url='<%= current_parameters_hosts_path %>' data-url2='<%= puppetclass_parameters_hosts_path %>' data-toggle="tab"><%= _('Parameters') %></a></li>
<li><a href="#info" data-toggle="tab"><%= _('Additional Information') %></a></li>
66afbc33 Joseph Mitchell Magen
</ul>

<div class="tab-content">

<div class="tab-pane active" id="primary">
43c4bd72 Marek Hulan
<%= text_f f, :name, :size => "col-md-5", :value => name_field(@host),
:help_inline => _("This value is used also as the host's primary interface name.") %>
66afbc33 Joseph Mitchell Magen
<% if show_organization_tab? %>
65292474 Tomer Brisker
<%= host_taxonomy_select(f, Organization) %>
66afbc33 Joseph Mitchell Magen
<% end %>
05ab4c16 Ohad Levy
66afbc33 Joseph Mitchell Magen
<% if show_location_tab? %>
65292474 Tomer Brisker
<%= host_taxonomy_select(f, Location) %>
66afbc33 Joseph Mitchell Magen
<% end %>
b09b4515 Ohad Levy
db062299 Ohad Levy
<%= select_f f, :hostgroup_id, accessible_hostgroups, :id, :to_label,
{ :include_blank => true},
04cb74c0 Shimon Shtein
{ :onchange => 'hostgroup_changed(this);',
:data => {
:'host-id' => @host.id,
:'url' => (@host.new_record? || @host.type_changed?) ? process_hostgroup_hosts_path : hostgroup_or_environment_selected_hosts_path,
:'had-hostgroup' => !!@host.hostgroup_id_was
},
db062299 Ohad Levy
:help_inline => :indicator } %>

4ca92155 Avi Tal
<%= select_f f, :compute_resource_id, ComputeResource.with_taxonomy_scope_override(@location,@organization).authorized(:view_compute_resources).order('compute_resources.name'), :id, :to_label,
66afbc33 Joseph Mitchell Magen
{ :include_blank => _('Bare Metal') },
db062299 Ohad Levy
{:label => _('Deploy on'), :disabled => !@host.new_record?, :'data-url' => compute_resource_selected_hosts_path,
c6e02bd3 Joseph Magen
:onchange => 'computeResourceSelected(this);',
:help_inline => :indicator } if SETTINGS[:unattended] && @host.new_record? || @host.compute_resource_id %>

<% if @host.new_record? && ComputeProfile.visibles.any? %>
<%# only show compute_profile select box for new hosts. It is not relevant for existing hosts as the VM attributes defined could
be different from the defaults, or the defaults could have changed after the vm was created. %>
<div id="compute_profile" <%= display?(!@host.compute_resource_id) %> >
<%= select_f f, :compute_profile_id, ComputeProfile.visibles, :id, :name,
04cb74c0 Shimon Shtein
{ :disable_button => _(HostsAndHostgroupsHelper::INHERIT_TEXT),
5081efd9 Shimon Shtein
:disable_button_enabled => inherited_by_default?(:compute_profile_id, @host),
04cb74c0 Shimon Shtein
:user_set => params[:host] && params[:host][:compute_profile_id]
},
c6e02bd3 Joseph Magen
{ :label => _("Compute profile"), :'data-url' => compute_resource_selected_hosts_path,
:onchange => 'computeResourceSelected(this);',
:help_inline => :indicator } if SETTINGS[:unattended] %>
</div>
<% end %>
66afbc33 Joseph Mitchell Magen
04cb74c0 Shimon Shtein
<%= select_f f, :environment_id, Environment.with_taxonomy_scope_override(@location,@organization).order(:name), :id, :to_label, { :include_blank => true,
:disable_button => _(HostsAndHostgroupsHelper::INHERIT_TEXT),
5081efd9 Shimon Shtein
:disable_button_enabled => inherited_by_default?(:environment_id, @host),
04cb74c0 Shimon Shtein
:user_set => params[:host] && params[:host][:environment_id]
},
{:onchange => 'update_puppetclasses(this)', :'data-url' => hostgroup_or_environment_selected_hosts_path,
66afbc33 Joseph Mitchell Magen
:'data-host-id' => @host.id, :help_inline => :indicator} %>
43c4bd72 Marek Hulan
04cb74c0 Shimon Shtein
<%= puppet_master_fields f, true, @host.hostgroup && @host.hostgroup_id_was.nil? %>
43c4bd72 Marek Hulan
04cb74c0 Shimon Shtein
<%= realm_field f, true, @host.hostgroup && @host.hostgroup_id_was.nil? %>
43c4bd72 Marek Hulan
66afbc33 Joseph Mitchell Magen
</div>

<div class="tab-pane" id="puppet_klasses">
4d4557e9 Joseph Magen
<% if @environment or @hostgroup %>
66afbc33 Joseph Mitchell Magen
<%= render 'puppetclasses/class_selection', :obj => @host %>
4d4557e9 Joseph Magen
<% else %>
378c65e5 Brad Buckingham
<%= alert :class => 'alert-warning', :text => _('Please select an environment first') %>
4d4557e9 Joseph Magen
<% end %>
66afbc33 Joseph Mitchell Magen
</div>

<%= f.hidden_field :managed %>
92326dd2 Amos Benari
<%= f.hidden_field :progress_report_id, :data=>{:url=>task_path(@host.progress_report_id)} %>
66afbc33 Joseph Mitchell Magen
<%= f.hidden_field :type, :value => @host.type if @host.type_changed? %>
b09b4515 Ohad Levy
3a30ac9e Marek Hulan
<div class="tab-pane" id="network">
<%= render 'hosts/interfaces', :host => @host, :f => f %>
</div>

4d4557e9 Joseph Magen
<%= render('hosts/unattended', :f => f) if SETTINGS[:unattended] and @host.managed %>
66afbc33 Joseph Mitchell Magen
<div class="tab-pane" id="params">
69f89318 Ori Rabin
<fieldset>
<legend><%= _('Puppet classes parameters') %></legend>
<%= render "puppetclasses/classes_parameters", { :obj => @host } %>
<h4><%= _('Puppet class overrides') %></h4>
<%= render "common_parameters/puppetclasses_parameters", :f => f %>
</fieldset>
<br/>
<fieldset>
<legend><%= _('Global parameters') %></legend>
<%= render "common_parameters/inherited_parameters", { :inherited_parameters => @host.host_inherited_params(true) } %>
<h4><%= _('Host parameters') %></h4>
<%= render "common_parameters/parameters", { :f => f, :type => :host_parameters } %>
</fieldset>
66afbc33 Joseph Mitchell Magen
</div>

<div class="tab-pane" id="info">
4d4557e9 Joseph Magen
<% if SETTINGS[:login] %>
66afbc33 Joseph Mitchell Magen
<%= selectable_f f, :is_owned_by, option_groups_from_collection_for_select(
cad9cce9 Dominic Cleal
[User, Usergroup], :visible, :table_name, :id_and_type, :select_title,
19579f87 Martin Ducar
@host.is_owned_by || User.current.id_and_type), { :include_blank => _("select an owner") }, { :label => _("Owned By") }
66afbc33 Joseph Mitchell Magen
%>
4d4557e9 Joseph Magen
<% end %>
66afbc33 Joseph Mitchell Magen
<%= checkbox_f f, :enabled,
:help_inline => _("Include this host within Foreman reporting")
05ab4c16 Ohad Levy
%>
66afbc33 Joseph Mitchell Magen
<div id='model_name'>
<%= select_f f, :model_id, Model.all, :id, :to_label, { :include_blank => true }, {:label => _("Hardware Model")} unless @host.compute_resource_id%>
</div>
c88c48f5 Ondrej Prazak
<%= textarea_f f, :comment, :help_block => _("Additional information about this host"), :size => "col-md-8", :rows => "3", :class => "no-stretch" %>
c8d89c66 Amos Benari
</div>
611f5bff Amos Benari
66afbc33 Joseph Mitchell Magen
</div>
611f5bff Amos Benari
66afbc33 Joseph Mitchell Magen
<%= f.hidden_field :overwrite? %>
90ff2a3a Dmitri Dolguikh
<%= submit_or_cancel f, @host.overwrite?, :cancel_path => @host.new_record? || !@host.name_changed? ? @host : edit_host_path(@host.name_was) %>
66afbc33 Joseph Mitchell Magen
<% end %>
c5e90813 Greg Sutcliffe
<% end %>