{% load static %}
{% include "header.html" %}
{% include "navigation.html" %}
{% include "logo.html" %}

<div class="container">
  <div class="dashboard">
    <div class="span8 offset2">
      <h1><a href="/storage/?manage=True">Storage</a> <span style="font-size:18px">/ add</span></h1>
      <hr>

      {% if data.error %}
        <div class="alert alert-danger">{{ data.error }}</div>
      {% endif %}
      {% if data.added %}
        <div class="alert alert-success">Storage added successfully.</div>
      {% endif %}

      <form action="#" method="POST">
      {% csrf_token %}
      <table class="dashboard" style="width:500px; margin-bottom:25px">
        <tr>
          <td><b>Computing</b></td>
          <td>
            <select name="computing_uuid" style="width: 220px;">
              <option value="">None</option>
              {% for computing in data.computings %}
                <option value="{{ computing.uuid }}">{{ computing.name }}</option>
              {% endfor %}
            </select>
          </td>
        </tr>
        <tr>
          <td><b>Name</b></td>
          <td><input type="text" name="name" value="" size="30" required /></td>
        </tr>
        <tr>
          <td><b>Owner</b></td>
          <td>
            <select name="user_id" style="width: 220px;">
              <option value="{{ data.user.id }}">{{ data.user.email }}</option>
              {% if data.user.is_staff %}<option value="">Platform</option>{% endif %}
            </select>
          </td>
        </tr>
        <tr>
          <td><b>Group</b></td>
          <td>
            <select name="group_id" style="width: 220px;">
              <option value="">None</option>
              {% for group in data.groups %}
                <option value="{{ group.id }}">{{ group.name }}</option>
              {% endfor %}
            </select>
          </td>
        </tr>
        <tr>
          <td><b>Type</b></td>
          <td>
            <select name="type" style="width: 220px;" required>
              <option value="bind">bind</option>
              <option value="volume">volume</option>
              <option value="nfs">nfs</option>
              <option value="object">object</option>
              <option value="posix">posix</option>
              <option value="s3">s3</option>
              <option value="lustre">lustre</option>
              <option value="cephfs">cephfs</option>
              <option value="other">other</option>
            </select>
          </td>
        </tr>
        <tr>
          <td><b>Access mode</b></td>
          <td>
            <select name="access_mode" style="width: 220px;" required>
              <option value="ssh+cli">ssh+cli</option>
              <option value="internal">internal</option>
            </select>
          </td>
        </tr>
        <tr>
          <td><b>Access via computing</b></td>
          <td><input type="checkbox" name="access_through_computing" value="True" /></td>
        </tr>
        <tr>
          <td><b>Auth mode</b></td>
          <td>
            <select name="auth_mode" style="width: 220px;" required>
              <option value="user_keys">user_keys</option>
              <option value="platform_keys">platform_keys</option>
              <option value="internal">internal</option>
            </select>
          </td>
        </tr>
        <tr>
          <td><b>Base path</b></td>
          <td><input type="text" name="base_path" value="" size="30" required /></td>
        </tr>
        <tr>
          <td><b>Bind path</b></td>
          <td><input type="text" name="bind_path" value="" size="30" /></td>
        </tr>
        <tr>
          <td><b>Read only</b></td>
          <td><input type="checkbox" name="read_only" value="True" /></td>
        </tr>
        <tr>
          <td><b>Browsable</b></td>
          <td><input type="checkbox" name="browsable" value="True" checked /></td>
        </tr>
        <tr>
          <td><b>Conf</b><br/><span style="font-size:0.8em">(JSON dict)</span></td>
          <td><textarea name="conf" rows="2" cols="30"></textarea></td>
        </tr>
      </table>
      <table style="width:500px; border:0; background:#ffffff; margin-top:20px">
        <tr><td align="center">
          <input type="submit" value="Create" class="btn btn-primary">
        </td></tr>
      </table>
      </form>
    </div>
  </div>
</div>

{% include "footer.html" %} 