%# 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 . %>
<%= javascript_include_tag 'foreman_fog_proxmox/proxmox_compute_resource', "data-turbolinks-track" => true %>
<% user_token = f.object.auth_method == 'user_token' %>
<% access_ticket = f.object.auth_method == 'access_ticket' %>
<% ssl_verify_peer = f.object.ssl_verify_peer == '1' %>
<%= select_f f, :auth_method, proxmox_auth_methods_map, :id, :name, { }, :label_help => _("Click Test connection button before changing it"), :label => _('Authentication method'), :label_size => "col-md-2", :required => true, :onchange => 'authMethodSelected();' %>
<%= field_set_tag _("Common fields"), :id => "compute_ressource_common_field_set" do %>
<%= text_f f, :url, :help_block => _("e.g. https://127.0.0.1:8006/api2/json") %>
<%= text_f f, :user , :help_block => _("e.g. root@pam") %>
<% end %>
<%= field_set_tag _("User token fields"), :id => "compute_ressource_user_token_field_set", :class => ('hide' unless user_token), :disabled => !user_token do %>
<%= text_f f, :token_id, :label => _('User token id'), :required => user_token %>
<%= text_f f, :token, :label => _('User token value'), :required => user_token, :label_help => _("Click Test connection button to check token") %>
<% end %>
<%= field_set_tag _("Access ticket fields"), :id => "compute_ressource_access_ticket_field_set", :class => ('hide' unless access_ticket), :disabled => !access_ticket do %>
<%= password_f f, :password, :keep_value => true, :unset => unset_password?, :required => access_ticket %>
<% end %>
<%= field_set_tag _("SSL fields"), :id => "compute_ressource_ssl_field_set" do %>
<%= checkbox_f f, :ssl_verify_peer, :label => _("SSL verify peer"), :label_help => _("Click Test connection button before changing it"), :checked_value => '1', :onchange => 'sslVerifyPeerSelected();' %>
<%= textarea_f f, :ssl_certs, :label => _("X509 Certification Authorities"), :size => "col-md-4",
:placeholder => _("Optionally provide a CA, or a correctly ordered CA chain. If left blank, disable ssl_verify_peer.") %>
<% end %>
<%= test_connection_button_f(f, (f.object.nodes rescue true)) %>