Browse Source

Merge "Bug #1018560 Adding quota display to Overview template"

Jenkins 6 years ago
parent
commit
fbb33d1b49

+ 1
- 0
horizon/dashboards/nova/overview/templates/overview/usage.html View File

@@ -7,6 +7,7 @@
7 7
 {% endblock page_header %}
8 8
 
9 9
 {% block main %}
10
+  {% include "horizon/common/_quota_summary.html" %}
10 11
   {% include "horizon/common/_usage_summary.html" %}
11 12
   {{ table.render }}
12 13
 {% endblock %}

+ 13
- 0
horizon/templates/horizon/common/_quota_summary.html View File

@@ -0,0 +1,13 @@
1
+{% load i18n horizon humanize sizeformat %}
2
+
3
+<div class="quota-dynamic">
4
+  <h3>{% trans "Quota Summary" %}</h3>
5
+    <strong>{% trans "Used" %}<span> {{ usage.quota.instances.used|intcomma }} </span> {% trans "of" %} <span> {{ usage.quota.instances.quota|intcomma }} </span>{% trans "Available Instances" %} </strong>
6
+    {% horizon_progress_bar usage.quota.instances.used usage.quota.instances.quota %}
7
+
8
+    <strong>{% trans "Used" %} <span> {{ usage.quota.cores.used|intcomma }} </span>{% trans "of" %}<span> {{ usage.quota.cores.quota|intcomma }} </span>{% trans "Available vCPUs" %} </strong>
9
+    {% horizon_progress_bar usage.quota.cores.used usage.quota.cores.quota %}
10
+
11
+    <strong>{% trans "Used" %} <span> {{ usage.quota.ram.used|intcomma }} MB </span>{% trans "of" %}<span> {{ usage.quota.ram.quota|intcomma }} MB </span>{% trans "Available Memory" %} </strong>
12
+    {% horizon_progress_bar usage.quota.ram.used usage.quota.ram.quota %}
13
+</div>

+ 4
- 0
horizon/usage/base.py View File

@@ -104,6 +104,10 @@ class BaseUsage(object):
104 104
                 self.summary.setdefault(key, 0)
105 105
                 self.summary[key] += value
106 106
 
107
+    def quota(self):
108
+        quotas = api.nova.tenant_quota_usages(self.request)
109
+        return quotas
110
+
107 111
     def csv_link(self):
108 112
         form = self.get_form()
109 113
         if hasattr(form, "cleaned_data"):

Loading…
Cancel
Save