Update dashboard to use retrieved domains data.

This commit is contained in:
Santiago Lamora 2019-12-12 14:19:39 +01:00
parent 07b15faf8e
commit fbf12f65f2
2 changed files with 9 additions and 14 deletions

View File

@ -54,7 +54,7 @@
<h4>{% trans "Mail" %}</h4>
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
<p class="card-text text-dark">
3 mail addresses created<br/>
{{ domain.mails|length }} {% trans "mail addresses created" %}<br/>
<span class="text-warning">1 mail address left</span>
</p>
</div>
@ -66,8 +66,13 @@
<h4>{% trans "Databases" %}</h4>
<p class="card-text"><i class="fas fa-database fa-3x"></i></p>
<p class="card-text text-dark">
1 database created<br/>
0 {% trans "databases created" %}
{% comment %}
<!-- TODO databases related to a domain and resource usage
{{ domain.databases|length }} {% trans "databases created" %}<br/>
20 MB of 45MB
-->
{% endcomment %}
</p>
</div>
<div class="col-md-2 border-right">

View File

@ -27,9 +27,7 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# TODO retrieve all data needed from orchestra
raw_domains = self.orchestra.retrieve_service_list('domain')
domains = self.orchestra.retrieve_domain_list()
# TODO(@slamora) update when backend provides resource usage data
resource_usage = {
@ -56,19 +54,11 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
},
}
for domain in raw_domains:
domain['usage'] = {
'usage': 300,
'total': 650,
'unit': 'MB',
'percent': 50,
}
# TODO(@slamora) update when backend supports notifications
notifications = []
context.update({
'domains': raw_domains,
'domains': domains,
'resource_usage': resource_usage,
'notifications': notifications,
})