<commit_before><% hidden_if_virtual = @machine.virtual? ? 'display:none;' : '' %>

<%= simple_form_for(@machine) do |f| %>
  <%= action_links do %>
    <%= f.button :submit %>
    ou <%= link_to "Retourner à la liste", machines_path %>
    <% unless @machine.new_record? %>
      | <%= link_to "Voir", @machine %>
    <% end %>
  <% end %>

  <div id="machine_general" class="grid_4">
  <table class="inputs full">
    <tbody>
      <%= tabular_errors @machine %>
      <%= f.input :name, :required => true, :wrapper_class => 'th', :input_html => { :style => "width:10em;" } %>
      <tr class="wrapper machine_applications">
        <td colspan="2"><label for="machine[description]" class="input">Description :</label><br/><%= f.text_area :description, :size => "30x6" %></td>
      </tr>
      <tr class="input string optional">
        <td class="content" colspan="2">
          <label for="machine[ipaddresses]" class="input"><%= t(:ipaddresses) %> :</label><br />
          <% f.object.ipaddresses.build if f.object.ipaddresses.size == 0 %>
          <%= f.simple_fields_for :ipaddresses do |ip_form| %>
            <%= render 'ipaddress_fields', :f => ip_form %>
          <% end %>
          <p class="add-field">
            <%= link_to_add_fields image_tag("new_button.png", :class=>"inline")+" ajouter", f, :ipaddresses %>
          </p>
        </td>
      </tr>
      <!--<%= f.input :server_type %>-->
      <%= f.association :operating_system, :collection => ancestry_options(
                                                            OperatingSystem.scoped.arrange(:order => 'name')
                                                          ){|i| "#{'-'*i.depth} #{i.name}"} %>
      <%= f.input :virtual %>
      <%= f.association :service %>
      <%= f.association :theme %>
      <!--<%= f.input :previous_name %>-->
    </tbody>
    <tbody id="machine-maintenance" style="<%= hidden_if_virtual %>">
      <tr><th colspan="2">Maintenance</th></tr>
      <%= f.association :mainteneur %>
      <%= f.input :delivered_on, :as => :date, :order => [:day, :month, :year], :use_month_numbers => true,
                                 :start_year => Date.today.year-5, :end_year => Date.today.year+10 %>
      <%= f.input :maintained_until, :as => :date, :order => [:day, :month, :year], :use_month_numbers => true,
                                     :start_year => Date.today.year-5, :end_year => Date.today.year+10 %>
      <%= f.input :contract_type %>
      <%= f.input :serial_number %>
    </tbody>
  </table>
  </div>

  <div id="machine_hardware" class="grid_4">
  <table class="inputs full">
    <thead>
      <tr><th colspan="2" id="machine-hardware-title"><%= @machine.virtual? ? "Ressources" : "Matériel" %></th></tr>
    </thead>
    <tbody id="machine-physical-hardware" style="<%= hidden_if_virtual %>">
      <%= f.association :physical_rack, :collection => PhysicalRack.all.map{|r| [r,r.id]} %>
      <%= f.input :model %>
      <%= f.input :manufacturer %>
    </tbody>
    <tbody>
      <%= f.input :nb_proc, :collection => [1,2,4,6,8,10,12,16,24,32] %>
      <%= f.input :ref_proc %>
      <%= f.input :frequency, :as => :string %>
      <%= f.input :nb_coeur, :collection => [1,2,4,6,8] %>
      <%= f.input :memory %>
      <%= f.input :disk_type %>
      <%= f.input :nb_disk, :as => :string %>
      <%= f.input :disk_size, :as => :string %>
      <%= f.input :disk_type_alt %>
      <%= f.input :nb_disk_alt, :as => :string %>
      <%= f.input :disk_size_alt, :as => :string %>
      <%= f.association :media_drive %>
      <%= f.input :nb_rj45, :collection => 0..32 %>
      <%= f.input :nb_fc, :collection => 0..12 %>
      <%= f.input :nb_iscsi, :collection => 0..12 %>
    </tbody>
  </table>
  </div>

  <div id="machine_applications" class="grid_4">
  <table class="inputs full">
    <thead>
      <tr><th colspan="2"><%= t(:application_instances) %></th></tr>
    </thead>
    <tbody>
      <%= f.association :application_instances, :collection => ApplicationInstance.order(:name).map{|i| [i.fullname, i.id]}, :as => :multiselect %>
    </tbody>
  </table>
  </div>

<% end %><commit_msg>Sort application instances correctly in machines/form<commit_after><% hidden_if_virtual = @machine.virtual? ? 'display:none;' : '' %>

<%= simple_form_for(@machine) do |f| %>
  <%= action_links do %>
    <%= f.button :submit %>
    ou <%= link_to "Retourner à la liste", machines_path %>
    <% unless @machine.new_record? %>
      | <%= link_to "Voir", @machine %>
    <% end %>
  <% end %>

  <div id="machine_general" class="grid_4">
  <table class="inputs full">
    <tbody>
      <%= tabular_errors @machine %>
      <%= f.input :name, :required => true, :wrapper_class => 'th', :input_html => { :style => "width:10em;" } %>
      <tr class="wrapper machine_applications">
        <td colspan="2"><label for="machine[description]" class="input">Description :</label><br/><%= f.text_area :description, :size => "30x6" %></td>
      </tr>
      <tr class="input string optional">
        <td class="content" colspan="2">
          <label for="machine[ipaddresses]" class="input"><%= t(:ipaddresses) %> :</label><br />
          <% f.object.ipaddresses.build if f.object.ipaddresses.size == 0 %>
          <%= f.simple_fields_for :ipaddresses do |ip_form| %>
            <%= render 'ipaddress_fields', :f => ip_form %>
          <% end %>
          <p class="add-field">
            <%= link_to_add_fields image_tag("new_button.png", :class=>"inline")+" ajouter", f, :ipaddresses %>
          </p>
        </td>
      </tr>
      <!--<%= f.input :server_type %>-->
      <%= f.association :operating_system, :collection => ancestry_options(
                                                            OperatingSystem.scoped.arrange(:order => 'name')
                                                          ){|i| "#{'-'*i.depth} #{i.name}"} %>
      <%= f.input :virtual %>
      <%= f.association :service %>
      <%= f.association :theme %>
      <!--<%= f.input :previous_name %>-->
    </tbody>
    <tbody id="machine-maintenance" style="<%= hidden_if_virtual %>">
      <tr><th colspan="2">Maintenance</th></tr>
      <%= f.association :mainteneur %>
      <%= f.input :delivered_on, :as => :date, :order => [:day, :month, :year], :use_month_numbers => true,
                                 :start_year => Date.today.year-5, :end_year => Date.today.year+10 %>
      <%= f.input :maintained_until, :as => :date, :order => [:day, :month, :year], :use_month_numbers => true,
                                     :start_year => Date.today.year-5, :end_year => Date.today.year+10 %>
      <%= f.input :contract_type %>
      <%= f.input :serial_number %>
    </tbody>
  </table>
  </div>

  <div id="machine_hardware" class="grid_4">
  <table class="inputs full">
    <thead>
      <tr><th colspan="2" id="machine-hardware-title"><%= @machine.virtual? ? "Ressources" : "Matériel" %></th></tr>
    </thead>
    <tbody id="machine-physical-hardware" style="<%= hidden_if_virtual %>">
      <%= f.association :physical_rack, :collection => PhysicalRack.all.map{|r| [r,r.id]} %>
      <%= f.input :model %>
      <%= f.input :manufacturer %>
    </tbody>
    <tbody>
      <%= f.input :nb_proc, :collection => [1,2,4,6,8,10,12,16,24,32] %>
      <%= f.input :ref_proc %>
      <%= f.input :frequency, :as => :string %>
      <%= f.input :nb_coeur, :collection => [1,2,4,6,8] %>
      <%= f.input :memory %>
      <%= f.input :disk_type %>
      <%= f.input :nb_disk, :as => :string %>
      <%= f.input :disk_size, :as => :string %>
      <%= f.input :disk_type_alt %>
      <%= f.input :nb_disk_alt, :as => :string %>
      <%= f.input :disk_size_alt, :as => :string %>
      <%= f.association :media_drive %>
      <%= f.input :nb_rj45, :collection => 0..32 %>
      <%= f.input :nb_fc, :collection => 0..12 %>
      <%= f.input :nb_iscsi, :collection => 0..12 %>
    </tbody>
  </table>
  </div>

  <div id="machine_applications" class="grid_4">
  <table class="inputs full">
    <thead>
      <tr><th colspan="2"><%= t(:application_instances) %></th></tr>
    </thead>
    <tbody>
      <%= f.association :application_instances, :collection => ApplicationInstance.includes(:application).order("applications.name, application_instances.name").map{|i| [i.fullname, i.id]}, :as => :multiselect %>
    </tbody>
  </table>
  </div>

<% end %>
{'fraction_non_alphanumeric': 0.212077813581573, 'fraction_numerical': 0.01217329036877909, 'mean_word_length': 2.607404218682738, 'pattern_counts': {'":': 0, '<': 221, '<?xml version=': 0, '>': 285, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3931069', 'n_tokens_mistral': 3123, 'n_tokens_neox': 2819, 'n_words': 534}