<% javascript 'compute_resource', 'lookup_keys' %>
<%= text_f f, :name, :label => _('Name') if show_vm_name? %>
<% clusters = compute_resource.clusters %>
<%= select_f f, :cluster, clusters, :id, :name, { },
             { :disabled    => !new_host, :'data-url' => cluster_selected_compute_resource_path(compute_resource),
               :onchange    => 'ovirt_clusterSelected(this);',
               :help_inline => :indicator,
               :label      => _('Cluster') } %>
<%= f.hidden_field :cluster if !new_host %>
<%= select_f f, :template, compute_resource.templates, :id, :full_name, {:include_blank => _("Select template")},
             { :disabled    => !new_host, :'data-url' => template_selected_compute_resource_path(compute_resource),
               :onchange    => 'ovirt_templateSelected(this);',
               :help_inline => :indicator,
               :help_block  => _("oVirt/RHEV template to use"),
               :label       => _('Template') } %>
<%= f.hidden_field :template if !new_host %>

<% selected_cluster ||= params[:host] && params[:host][:compute_attributes] && params[:host][:compute_attributes][:cluster] %>

<%= selectable_f f, :cores, 1..compute_resource.max_cpu_count, { }, :class => "col-md-2", :label => _('Cores') %>
<%= selectable_f f, :memory, memory_options(compute_resource.max_memory), { }, :class => "col-md-2", :label => _('Memory') %>

<% checked = params[:host] && params[:host][:compute_attributes] && params[:host][:compute_attributes][:start] || '1' %>
<%= checkbox_f f, :start, { :checked => (checked == '1'), :help_inline => _("Power ON this machine"), :label => _('Start') } if new_host && controller_name != "compute_attributes" %>

<%
   arch ||= nil ; os ||= nil
   images = possible_images(compute_resource, arch, os)
-%>

<div id='image_selection'>
  <%= select_f f, :image_id, images, :uuid, :name,{:include_blank => (images.empty? || images.size == 1) ? false : _('Please select an image')},
             { :disabled    => true, :'data-url' => template_selected_compute_resource_path(compute_resource),
               :onchange    => 'ovirt_templateSelected(this);',
               :help_inline => :indicator,
               :help_block  => _("Image to use"),
               :label => _('Image')} %>
</div>

<%= nic_info_js(compute_resource) %>
