{% extends "base.html" %}
{% from "_macros.html" import empty %}
{% block title %}Floating IPs · mgf-cloud-web{% endblock %}
{% block content %}
<header class="page-header">
  <div>
    <p class="eyebrow">networking</p>
    <h1>Floating IPs</h1>
  </div>
</header>
<div class="split">
  <div>
    {% if fips %}
    <div class="table-wrap">
      <table class="table">
        <thead><tr><th>Address</th><th>Attached to</th><th class="actions"></th></tr></thead>
        <tbody>
        {% for f in fips %}
          <tr>
            <td class="mono">{{ f.address }}</td>
            <td class="mono">{{ f.attached_server_id or "—" }}</td>
            <td class="actions"><form method="post" action="/floating-ips/{{ f.address }}/release"><button class="button button-danger button-sm">release</button></form></td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </div>
    {% else %}
    {{ empty("No floating IPs.", "Allocate a public address to attach to an instance.") }}
    {% endif %}
  </div>
  <aside class="card">
    <p class="eyebrow">allocate</p>
    <form class="form" method="post" action="/floating-ips">
      <div class="field"><label class="label" for="fnet">Network</label><input class="input" id="fnet" name="network" placeholder="(default)"></div>
      <button class="button button-accent" type="submit">Allocate</button>
    </form>
  </aside>
</div>
{% endblock %}
