Project

General

Profile

Download (3.8 KB) Statistics
| Branch: | Tag: | Revision:
<%= javascript 'host_edit', 'compute_resource', 'lookup_keys'%>
<%= render "conflicts" if @host.errors[:conflict].any? %>
<%= form_for @host do |f| %>
<%= base_errors_for @host %>

<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active"><a href="#primary" data-toggle="tab">Primary</a></li>
<li><a href="#puppet_klasses" data-toggle="tab">Puppet Classes</a></li>
<% if SETTINGS[:unattended] and @host.managed -%>
<li><a href="#network" data-toggle="tab">Network</a></li>
<li><a href="#os" data-toggle="tab">Operating System</a></li>
<% if authorized_for("Hypervisors::Guests", :create) -%>
<% if @host.new_record? and !Hypervisor.first.nil? -%>
<li id="libvirt_tab" <%= display? !(params[:host] && params[:host][:hypervisor_id].present?) %>><a href="#virtual_machine" data-toggle="tab">Virtual Machine</a></li>
<% end -%>
<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" data-toggle="tab">Parameters</a></li>
<li><a href="#info" data-toggle="tab">Additional Information</a></li>
</ul>

<div class="tab-content">

<div class="tab-pane active" id="primary">
<%= text_f f, :name, :class => "input-xlarge", :value => name_field(@host) %>
<% libvirt = Hypervisor.first.nil? ? [] : [OpenStruct.new(:to_label => 'Libvirt')] -%>
<%= select_f f, :compute_resource_id, libvirt + ComputeResource.all, :id, :to_label,
{ :include_blank => 'Bare Metal' },
{:label => "Deploy on", :disabled => !@host.new_record?, :'data-url' => compute_resource_selected_hosts_path ,
:onchange => 'computeResourceSelected(this);'} if @host.new_record? || @host.compute_resource_id %>
<%= select_f f, :hostgroup_id, accessible_hostgroups, :id, :to_label,
{ :include_blank => true},
{ :onchange => 'hostgroup_changed(this);', :'data-host-id' => @host.id, "data-type" => controller_name,
:help_inline => image_tag('spinner.gif', :id => 'hostgroup_indicator', :class => 'hide').html_safe } %>

<%= select_f f, :environment_id, Environment.all, :id, :to_label, { :include_blank => true },
{:onchange => 'update_puppetclasses(this);', "data-type" => controller_name } %>
<%= puppet_master_fields f %>
</div>

<div class="tab-pane" id="puppet_klasses">
<% if @environment or @hostgroup -%>
<%= render 'puppetclasses/class_selection', :obj => @host %>
<% else -%>
<p class="alert alert-message">Please select an Environment first</p>
<% end -%>
</div>

<%= f.hidden_field :managed %>

<%= render('unattended', :f => f) if SETTINGS[:unattended] and @host.managed -%>

<div class="tab-pane" id="params">
<%= render "common_parameters/parameters", { :f => f, :type => :host_parameters } %>
</div>

<div class="tab-pane" id="info">
<% if SETTINGS[:login] -%>
<%= selectable_f f, :is_owned_by, option_groups_from_collection_for_select(
[User, Usergroup], :all, :table_name, :id_and_type, :select_title,
@host.is_owned_by), { :include_blank => "select an owner" }, { :label => "Owned By" }
%>
<% end -%>
<%= checkbox_f f, :enabled, :label => "Alerts Enabled",
:help_inline => "Include this host within Foreman reporting"
%>
<%= select_f f, :model_id, Model.all, :id, :to_label, { :include_blank => true }, {:label => "Hardware Model"} %>
<%= textarea_f f, :comment, :help_block => "Additional information about this host", :class => "input-xxlarge", :rows => "3" %>
</div>
</div>
<%= f.hidden_field :overwrite? %>
<%= submit_or_cancel f, @host.overwrite? %>
<% end %>
(3-3/28)