diff --git a/musician/static/musician/css/default.css b/musician/static/musician/css/default.css index 23bd5b1..1d07ea0 100644 --- a/musician/static/musician/css/default.css +++ b/musician/static/musician/css/default.css @@ -172,3 +172,51 @@ h1.service-name { .service-card .card-body .service-brand i.fab { color: #9C9AA7; } + +.card.resource-usage { + border-left: 5px solid #4C426A; +} + +.card.resource-usage .progress { + height: 0.5rem; + margin-top: 0.75rem; +} + +.card.resource-usage h5.card-title { + position: relative; +} + +.card.resource-usage h5.card-title:after { + font-family: "Font Awesome 5 Free"; + font-style: normal; + font-variant: normal; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + + position: absolute; + top: 0; + right: 10px; + + color: #E8E7EB; + font-size: 2em; +} + +.card.resource-usage.resource-disk h5.card-title:after { + content: "\f0a0"; + font-weight: 900; +} + +.card.resource-usage.resource-traffic h5.card-title:after { + content: "\f362"; + font-weight: 900; +} + +.card.resource-usage.resource-mailbox h5.card-title:after { + content: "\f0e0"; + font-weight: 900; +} + +.card.resource-usage.resource-notifications h5.card-title:after { + content: "\f0f3"; + font-weight: 900; +} diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html index b738440..aefea23 100644 --- a/musician/templates/musician/dashboard.html +++ b/musician/templates/musician/dashboard.html @@ -3,20 +3,33 @@ {% block content %} -

Welcome back {{ user.username }}

-

Last time you logged in was {{ user.last_login }}

+

{% trans "Welcome back" %} {{ profile.username }}

+

{% blocktrans with last_login=profile.last_login|default:"N/A" %}Last time you logged in was: {{ last_login }}{% endblocktrans %}

-
- {% for i in "1234"|make_list %} -
- Resource usage block +
+ {% for resource, usage in resource_usage.items %} +
+
+
{{ usage.verbose_name }}
+ {% include "musician/components/usage_progress_bar.html" with detail=usage %} +
{% endfor %} +
+
+
{% trans "Notifications" %}
+ {% for message in notifications %} +

{{ message }}

+ {% empty %} +

{% trans "There is no notifications at this time." %}

+ {% endfor %} +
+
-

Domains and websites

-

Little description of what to be expected...

+

{% trans "Your domains and websites" %}

+

Little description of what to be expected...

{% for domain in domains %}
diff --git a/musician/views.py b/musician/views.py index aa7ee8c..271c753 100644 --- a/musician/views.py +++ b/musician/views.py @@ -6,6 +6,7 @@ from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse_lazy from django.utils.http import is_safe_url +from django.utils.translation import gettext_lazy as _ from django.views.generic.base import RedirectView, TemplateView from django.views.generic.detail import DetailView from django.views.generic.edit import FormView @@ -30,8 +31,37 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): # TODO retrieve all data needed from orchestra raw_domains = self.orchestra.retrieve_service_list('domain') + # TODO(@slamora) update when backend provides resource usage data + resource_usage = { + 'disk': { + 'verbose_name': _('Disk usage'), + 'usage': 534, + 'total': 1024, + 'unit': 'MB', + 'percent': 50, + }, + 'traffic': { + 'verbose_name': _('Traffic'), + 'usage': 300, + 'total': 2048, + 'unit': 'MB/month', + 'percent': 25, + }, + 'mailbox': { + 'verbose_name': _('Mailbox usage'), + 'usage': 1, + 'total': 2, + 'unit': 'accounts', + 'percent': 50, + }, + } + # TODO(@slamora) update when backend supports notifications + notifications = [] + context.update({ - 'domains': raw_domains + 'domains': raw_domains, + 'resource_usage': resource_usage, + 'notifications': notifications, }) return context