summaryrefslogtreecommitdiff
path: root/horizon
diff options
context:
space:
mode:
authorMatt Joyce <matt.joyce@cloudscaling.com>2012-08-15 14:54:26 -0700
committerMatt Joyce <matt.joyce@cloudscaling.com>2012-08-15 15:33:51 -0700
commit705aef0ef5b655e471b21cefef04fe3094365992 (patch)
treef02fba11a953390970f0f3761327c26b9445ef94 /horizon
parentd854ea0f55248fa58b8034a2046fa7337c491cef (diff)
downloadtuskar-ui-705aef0ef5b655e471b21cefef04fe3094365992.tar.gz
Bug #1018560 Adding quota display to Overview template
Change-Id: I8b7d5070dade4f0caae0ca9794a169cfc15b985f
Diffstat (limited to 'horizon')
-rw-r--r--horizon/dashboards/nova/overview/templates/overview/usage.html1
-rw-r--r--horizon/templates/horizon/common/_quota_summary.html13
-rw-r--r--horizon/usage/base.py4
3 files changed, 18 insertions, 0 deletions
diff --git a/horizon/dashboards/nova/overview/templates/overview/usage.html b/horizon/dashboards/nova/overview/templates/overview/usage.html
index 60732797..ecc7d684 100644
--- a/horizon/dashboards/nova/overview/templates/overview/usage.html
+++ b/horizon/dashboards/nova/overview/templates/overview/usage.html
@@ -7,6 +7,7 @@
{% endblock page_header %}
{% block main %}
+ {% include "horizon/common/_quota_summary.html" %}
{% include "horizon/common/_usage_summary.html" %}
{{ table.render }}
{% endblock %}
diff --git a/horizon/templates/horizon/common/_quota_summary.html b/horizon/templates/horizon/common/_quota_summary.html
new file mode 100644
index 00000000..b4ad64bf
--- /dev/null
+++ b/horizon/templates/horizon/common/_quota_summary.html
@@ -0,0 +1,13 @@
+{% load i18n horizon humanize sizeformat %}
+
+<div class="quota-dynamic">
+ <h3>{% trans "Quota Summary" %}</h3>
+ <strong>{% trans "Used" %}<span> {{ usage.quota.instances.used|intcomma }} </span> {% trans "of" %} <span> {{ usage.quota.instances.quota|intcomma }} </span>{% trans "Available Instances" %} </strong>
+ {% horizon_progress_bar usage.quota.instances.used usage.quota.instances.quota %}
+
+ <strong>{% trans "Used" %} <span> {{ usage.quota.cores.used|intcomma }} </span>{% trans "of" %}<span> {{ usage.quota.cores.quota|intcomma }} </span>{% trans "Available vCPUs" %} </strong>
+ {% horizon_progress_bar usage.quota.cores.used usage.quota.cores.quota %}
+
+ <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>
+ {% horizon_progress_bar usage.quota.ram.used usage.quota.ram.quota %}
+</div>
diff --git a/horizon/usage/base.py b/horizon/usage/base.py
index 1bfb3dd7..d9b54ac5 100644
--- a/horizon/usage/base.py
+++ b/horizon/usage/base.py
@@ -104,6 +104,10 @@ class BaseUsage(object):
self.summary.setdefault(key, 0)
self.summary[key] += value
+ def quota(self):
+ quotas = api.nova.tenant_quota_usages(self.request)
+ return quotas
+
def csv_link(self):
form = self.get_form()
if hasattr(form, "cleaned_data"):