horizon/django-openstack/django_openstack/templates/django_openstack/syspanel/instances/tenant_usage.html

103 lines
3.1 KiB
HTML

{% extends 'django_openstack/syspanel/base.html' %}
{% load parse_date %}
{% load sizeformat %}
{% block sidebar %}
{% with current_sidebar="tenants" %}
{{block.super}}
{% endwith %}
{% endblock %}
{% block page_header %}
{# to make searchable false, just remove it from the include statement #}
{% include "django_openstack/common/_page_header.html" with title="System Panel Overview" %}
{% endblock page_header %}
{% block syspanel_main %}
<form action="" method="get" id="date_form">
<!-- {% csrf_token %} -->
<h3> Select a month to query its usage: </h3>
<div class="form-row">
{{dateform.date}}
<input class="submit" type="submit"/>
</div>
</form>
<div id="usage">
<div class="usage_block">
<h3>CPU</h3>
<ul>
<li><span class="quantity">{{usage.total_active_vcpus}}</span><span class="unit">Cores</span> Active</li>
<li><span class="quantity">{{usage.total_cpu_usage|floatformat}}</span><span class="unit">CPU-HR</span> Used</li>
</ul>
</div>
<div class="usage_block">
<h3>RAM</h3>
<ul>
<li><span class="quantity">{{usage.total_active_ram_size}}</span><span class="unit">MB</span> Active</li>
</ul>
</div>
<div class="usage_block">
<h3>Disk</h3>
<ul>
<li><span class="quantity">{{usage.total_active_disk_size}}</span><span class="unit">GB</span> Active</li>
<li><span class="quantity">{{usage.total_disk_usage|floatformat}}</span><span class="unit">GB-HR</span> Used</li>
</ul>
</div>
</div>
<p id="activity" class="tenant">
<span><strong>Active Instances:</strong> {{usage.total_active_instances}}</span>
<span><strong>This month's VCPU-Hours:</strong> {{usage.total_cpu_usage|floatformat}}</span>
<span><strong>This month's GB-Hours:</strong> {{usage.total_disk_usage|floatformat}}</span>
</p>
{% if usage.instances %}
<div class='table_title wide'>
<a class="csv_download_link" href="{{csv_link}}">Download CSV &raquo;</a>
<h3>Tenant Usage: {{tenant_id}}</h3>
</div>
<table class="wide">
<tr id='headings'>
<th>ID</th>
<th>Name</th>
<th>User</th>
<th>VCPUs</th>
<th>Ram Size</th>
<th>Disk Size</th>
<th>Flavor</th>
<th>Uptime</th>
<th>Status</th>
</tr>
<tbody class='main'>
{% for instance in instances %}
{% if instance.ended_at %}
<tr class="terminated">
{% else %}
<tr class="{% cycle 'odd' 'even' %}">
{% endif %}
<td>{{instance.id}}</td>
<td>{{instance.name}}</td>
<td>{{instance.user_id}}</td>
<td>{{instance.vcpus}}</td>
<td>{{instance.ram_size|mbformat}}</td>
<td>{{instance.disk_size}}GB</td>
<td>{{instance.flavor}}</td>
<td>{{instance.uptime_at|timesince}}</td>
<td>{{instance.state|capfirst}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
{% endblock %}