{% extends "base.html" %}{% block content %}
{% set ok = ["ACTIVE","available","running"] %}
{% set info = ["BUILD","BUILDING","REBOOT","HARD_REBOOT","RESIZE"] %}
{% set warn = ["VERIFY_RESIZE","PAUSED","SUSPENDED","SHUTOFF","pending"] %}
<div class="page-header">
 <div class="titles"><h1>VMs</h1></div>
 <div class="actions"><a class="btn btn-primary" href="/vms/new">+ New VM</a></div>
</div>
<div class="table-wrap">
<table>
<thead><tr><th>Name</th><th>Status</th><th>Flavor</th><th>Image</th><th>Floating IPs</th><th class="actions"></th></tr></thead>
<tbody>
{% for vm in vms %}
<tr>
 <td><a href="/vms/{{ vm.name }}">{{ vm.name }}</a></td>
 <td><span class="badge {% if vm.status in ok %}badge-ok{% elif vm.status in info %}badge-info{% elif vm.status in warn %}badge-warn{% elif vm.status == 'ERROR' %}badge-danger{% else %}badge-neutral{% endif %}">{{ vm.status }}</span></td>
 <td>{{ vm.flavor }}</td><td>{{ vm.image }}</td>
 <td class="mono">{{ vm.floating_ips|join(", ") }}</td>
 <td class="actions">
  <form class="inline" method="post" action="/vms/{{ vm.name }}/reboot"><button>reboot</button></form>
  <form class="inline" method="post" action="/vms/{{ vm.name }}/delete"><button class="danger">delete</button></form>
 </td>
</tr>
{% else %}<tr><td colspan="6" class="muted">No VMs.</td></tr>{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
