summaryrefslogtreecommitdiff
path: root/horizon/horizon/dashboards/syspanel/templates/syspanel/instances/tenant_usage.html
blob: 15a5cc73310ca4a18d34d588842a83f89ba7892c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{% extends 'syspanel/base.html' %}
{% load parse_date %}
{% load sizeformat %}
{%load i18n%}

{% 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 "horizon/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>{% trans "Active Instances"%}:</strong> {{usage.total_active_instances}}</span>
      <span><strong>{% trans "This month's VCPU-Hours"%}:</strong> {{usage.total_cpu_usage|floatformat}}</span>
      <span><strong>{% trans "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}}">{% trans "Download CSV"%} &raquo;</a>
        <h3>{% trans "Tenant Usage"%}: {{tenant_id}}</h3>
      </div>

      <table class="wide">
        <tr id='headings'>
          <th>{% trans "ID"%}</th>
          <th>{% trans "Name"%}</th>
          <th>{% trans "User"%}</th>
          <th>{% trans "VCPUs"%}</th>
          <th>{% trans "Ram Size"%}</th>
          <th>{% trans "Disk Size"%}</th>
          <th>{% trans "Flavor"%}</th>
          <th>{% trans "Uptime"%}</th>
          <th>{% trans "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 %}