{% extends "base.html" %}
{% from "_macros.html" import empty %}
{% block title %}Object storage · mgf-cloud-web{% endblock %}
{% block content %}
<header class="page-header">
  <div>
    <p class="eyebrow">object storage</p>
    <h1>Containers</h1>
  </div>
</header>
<div class="split">
  <div>
    {% if containers %}
    <div class="table-wrap">
      <table class="table">
        <thead><tr><th>Container</th><th class="num">Objects</th><th class="num">Bytes</th><th class="actions"></th></tr></thead>
        <tbody>
        {% for c in containers %}
          <tr>
            <td><a href="/objects/{{ c.name }}">{{ c.name }}</a></td>
            <td class="num">{{ c.object_count }}</td>
            <td class="num">{{ c.bytes }}</td>
            <td class="actions"><form method="post" action="/objects/{{ c.name }}/delete"><button class="button button-danger button-sm">delete</button></form></td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </div>
    {% else %}
    {{ empty("No containers.", "Create a container to store objects.") }}
    {% endif %}
  </div>
  <aside class="card">
    <p class="eyebrow">create container</p>
    <form class="form" method="post" action="/objects">
      <div class="field"><label class="label" for="cname">Name</label><input class="input" id="cname" name="name" required></div>
      <button class="button button-accent" type="submit">Create</button>
    </form>
  </aside>
</div>
{% endblock %}
