theforeman/foreman_fog_proxmox

View on GitHub
app/views/compute_resources_vms/form/proxmox/_general.html.erb

Summary

Maintainability
Test Coverage
<%# Copyright 2018 Tristan Robert

This file is part of ForemanFogProxmox.

ForemanFogProxmox is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

ForemanFogProxmox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>

<% untemplatable = new_vm || f.object.templated? %>

<%= field_set_tag _("General"), :id => "general" do %>
  <%= checkbox_f f, :templated, :label => _('Create image?'), :disabled => untemplatable, :class => ('hide' if untemplatable), :no_label => untemplatable %>
  <%= counter_f f, :vmid, :label => _('VM ID'), :label_size => "col-md-2", :required => true, :disabled => (!new_vm || from_profile) %>
  <%= select_f f, :node_id, compute_resource.nodes, :node, :node, { }, :label => _('Node'), :label_size => "col-md-2", :required => true, :onchange => 'nodeSelected(this)' %>
  <% unless !new_vm || from_profile %>
    <% checked = params[:host] && params[:host][:compute_attributes] && params[:host][:compute_attributes][:start_after_create] || '1' %>
    <%= checkbox_f f, :start_after_create, {:checked => (checked == '1'), :label => _('Start after creation?')} %>
  <% end %>
  <% unless local_assigns[:hide_image] && !new_vm %>
    <%
      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 => true }, 
      :disabled => true,
      :help_inline => :indicator,
      :label => _('Image'), 
      :label_size => "col-md-2" %>
    </div>
  <% end %>
  <%= select_f f, :pool, compute_resource.pools, :poolid, :poolid, { :include_blank => true }, :label => _('Pool'), :label_size => "col-md-2", :required => false %>
<% end %>