diff --git a/musician/settings.py b/musician/settings.py
new file mode 100644
index 0000000..5581061
--- /dev/null
+++ b/musician/settings.py
@@ -0,0 +1,14 @@
+# allowed resources limit hardcoded because cannot be retrieved from the API.
+ALLOWED_RESOURCES = {
+ 'INDIVIDUAL':
+ {
+ # 'disk': 1024,
+ # 'traffic': 2048,
+ 'mailbox': 2,
+ },
+ 'ASSOCIATION': {
+ # 'disk': 5 * 1024,
+ # 'traffic': 20 * 1024,
+ 'mailbox': 10,
+ }
+}
diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html
index abee939..53c694e 100644
--- a/musician/templates/musician/dashboard.html
+++ b/musician/templates/musician/dashboard.html
@@ -54,8 +54,11 @@
{% trans "Mail" %}
- {{ domain.mails|length }} {% trans "mail addresses created" %}
- 1 mail address left
+ {{ domain.mails|length }} {% trans "mail addresses created" %}
+ {% if domain.address_left.alert %}
+
+ {{ domain.address_left.count }} mail address left
+ {% endif %}
diff --git a/musician/views.py b/musician/views.py
index 5b39f50..4b46dcc 100644
--- a/musician/views.py
+++ b/musician/views.py
@@ -20,6 +20,7 @@ from .mixins import (CustomContextMixin, ExtendedPaginationMixin,
UserTokenRequiredMixin)
from .models import (DatabaseService, MailinglistService, MailService,
PaymentSource, SaasService, UserAccount)
+from .settings import ALLOWED_RESOURCES
class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
@@ -57,6 +58,22 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
# TODO(@slamora) update when backend supports notifications
notifications = []
+ # show resource usage based on plan definition
+ # TODO(@slamora): validate concept of limits with Pangea
+ profile_type = context['profile'].type
+ for domain in domains:
+ address_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails)
+ alert = None
+ if address_left == 1:
+ alert = 'warning'
+ elif address_left < 1:
+ alert = 'danger'
+
+ domain.address_left = {
+ 'count': address_left,
+ 'alert': alert,
+ }
+
context.update({
'domains': domains,
'resource_usage': resource_usage,