commit
af3bf2cda7
|
@ -5,6 +5,8 @@ from django.utils.dateparse import parse_datetime
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
from . import settings as musician_settings
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -249,9 +251,8 @@ class MailinglistService(OrchestraModel):
|
||||||
return "{}@{}".format(self.data['address_name'], self.data['address_domain']['name'])
|
return "{}@{}".format(self.data['address_name'], self.data['address_domain']['name'])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def configure(self):
|
def manager_url(self):
|
||||||
# TODO(@slamora): build mailtran absolute URL
|
return musician_settings.URL_MAILTRAIN
|
||||||
return format_html('<a href="#TODO">Mailtrain</a>')
|
|
||||||
|
|
||||||
|
|
||||||
class SaasService(OrchestraModel):
|
class SaasService(OrchestraModel):
|
||||||
|
@ -266,6 +267,17 @@ class SaasService(OrchestraModel):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def manager_url(self):
|
||||||
|
URLS = {
|
||||||
|
'gitlab': musician_settings.URL_SAAS_GITLAB,
|
||||||
|
'owncloud': musician_settings.URL_SAAS_OWNCLOUD,
|
||||||
|
'wordpress': musician_settings.URL_SAAS_WORDPRESS,
|
||||||
|
}
|
||||||
|
|
||||||
|
return URLS.get(self.service, '#none')
|
||||||
|
|
||||||
|
|
||||||
class WebSite(OrchestraModel):
|
class WebSite(OrchestraModel):
|
||||||
api_name = 'website'
|
api_name = 'website'
|
||||||
param_defaults = {
|
param_defaults = {
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
# allowed resources limit hardcoded because cannot be retrieved from the API.
|
from django.conf import settings
|
||||||
ALLOWED_RESOURCES = {
|
|
||||||
|
|
||||||
|
def getsetting(name):
|
||||||
|
value = getattr(settings, name, None)
|
||||||
|
return value or DEFAULTS.get(name)
|
||||||
|
|
||||||
|
|
||||||
|
DEFAULTS = {
|
||||||
|
# allowed resources limit hardcoded because cannot be retrieved from the API.
|
||||||
|
"ALLOWED_RESOURCES": {
|
||||||
'INDIVIDUAL':
|
'INDIVIDUAL':
|
||||||
{
|
{
|
||||||
# 'disk': 1024,
|
# 'disk': 1024,
|
||||||
|
@ -11,4 +20,22 @@ ALLOWED_RESOURCES = {
|
||||||
# 'traffic': 20 * 1024,
|
# 'traffic': 20 * 1024,
|
||||||
'mailbox': 10,
|
'mailbox': 10,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"URL_DB_PHPMYADMIN": "https://www.phpmyadmin.net/",
|
||||||
|
"URL_MAILTRAIN": "https://mailtrain.org/",
|
||||||
|
"URL_SAAS_GITLAB": "https://gitlab.org/",
|
||||||
|
"URL_SAAS_OWNCLOUD": "https://owncloud.org/",
|
||||||
|
"URL_SAAS_WORDPRESS": "https://wordpress.org/",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ALLOWED_RESOURCES = getsetting("ALLOWED_RESOURCES")
|
||||||
|
|
||||||
|
URL_DB_PHPMYADMIN = getsetting("URL_DB_PHPMYADMIN")
|
||||||
|
|
||||||
|
URL_MAILTRAIN = getsetting("URL_MAILTRAIN")
|
||||||
|
|
||||||
|
URL_SAAS_GITLAB = getsetting("URL_SAAS_GITLAB")
|
||||||
|
|
||||||
|
URL_SAAS_OWNCLOUD = getsetting("URL_SAAS_OWNCLOUD")
|
||||||
|
|
||||||
|
URL_SAAS_WORDPRESS = getsetting("URL_SAAS_WORDPRESS")
|
||||||
|
|
|
@ -66,9 +66,9 @@
|
||||||
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
|
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
|
||||||
<p class="card-text text-dark">
|
<p class="card-text text-dark">
|
||||||
{{ domain.mails|length }} {% trans "mail addresses created" %}
|
{{ domain.mails|length }} {% trans "mail addresses created" %}
|
||||||
{% if domain.address_left.alert_level %}
|
{% if domain.addresses_left.alert_level %}
|
||||||
<br/>
|
<br/>
|
||||||
<span class="text-{{ domain.address_left.alert_level }}">{{ domain.address_left.count }} mail address left</span>
|
<span class="text-{{ domain.addresses_left.alert_level }}">{{ domain.addresses_left.count }} mail address left</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<a class="stretched-link" href="{% url 'musician:mails' %}?domain={{ domain.id }}"></a>
|
<a class="stretched-link" href="{% url 'musician:mails' %}?domain={{ domain.id }}"></a>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>{{ resource.address_name}}</td>
|
<td>{{ resource.address_name}}</td>
|
||||||
<td>{{ resource.admin_email }}</td>
|
<td>{{ resource.admin_email }}</td>
|
||||||
<td><a href="#TODO-{{ resource.manager_url }}" target="_blank" rel="noopener noreferrer">Mailtrain</a></td>
|
<td><a href="{{ resource.manager_url }}" target="_blank" rel="noopener noreferrer">Mailtrain <i class="fas fa-external-link-alt"></i></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5 text-right">
|
<div class="col-md-5 text-right">
|
||||||
<div class="service-manager-link">
|
<div class="service-manager-link">
|
||||||
<a class="btn btn-primary" href="#open-service">{% trans "Open service admin panel" %} <i class="fas fa-external-link-alt"></i></a>
|
<a class="btn btn-primary" href="{{ saas.manager_url }}" target="_blank" rel="noopener noreferrer">{% trans "Open service admin panel" %} <i class="fas fa-external-link-alt"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -147,3 +147,15 @@ STATIC_ROOT = config('STATIC_ROOT')
|
||||||
# Backend API configuration
|
# Backend API configuration
|
||||||
|
|
||||||
API_BASE_URL = config('API_BASE_URL')
|
API_BASE_URL = config('API_BASE_URL')
|
||||||
|
|
||||||
|
|
||||||
|
# External services URLs
|
||||||
|
URL_DB_PHPMYADMIN = config('URL_DB_PHPMYADMIN', None)
|
||||||
|
|
||||||
|
URL_MAILTRAIN = config('URL_MAILTRAIN', None)
|
||||||
|
|
||||||
|
URL_SAAS_GITLAB = config('URL_SAAS_GITLAB', None)
|
||||||
|
|
||||||
|
URL_SAAS_OWNCLOUD = config('URL_SAAS_OWNCLOUD', None)
|
||||||
|
|
||||||
|
URL_SAAS_WORDPRESS = config('URL_SAAS_WORDPRESS', None)
|
||||||
|
|
Loading…
Reference in New Issue