From 11998102579808735255689e3a64b03e8f592c9a Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Sun, 22 Nov 2026 22:23:55 +0100 Subject: [PATCH] Show installation details to server administrators --- src/coulobre/hosting/installation_views.py | 60 +++++++++++++++++++ src/coulobre/hosting/static/hosting/panel.css | 8 +++ .../hosting/templates/hosting/base.html | 10 +++- .../templates/hosting/installation.html | 35 +++++++++++ src/coulobre/hosting/test_service_health.py | 31 ++++++++++ src/coulobre/hosting/urls.py | 2 + 6 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 src/coulobre/hosting/installation_views.py create mode 100644 src/coulobre/hosting/templates/hosting/installation.html diff --git a/src/coulobre/hosting/installation_views.py b/src/coulobre/hosting/installation_views.py new file mode 100644 index 0000000..8c437e1 --- /dev/null +++ b/src/coulobre/hosting/installation_views.py @@ -0,0 +1,60 @@ +from importlib.metadata import PackageNotFoundError, version + +from django.conf import settings +from django.contrib.auth.mixins import PermissionRequiredMixin +from django.utils.decorators import method_decorator +from django.views.decorators.cache import never_cache +from django.views.generic import TemplateView + +from .access import OperatorOnlyMixin + + +@method_decorator(never_cache, name="dispatch") +class InstallationView( + OperatorOnlyMixin, PermissionRequiredMixin, TemplateView +): + permission_required = "hosting.view_servicehealth" + template_name = "hosting/installation.html" + + def get_context_data(self, **kwargs): + try: + installed_version = version("coulobre-panel") + except PackageNotFoundError: + installed_version = "Unavailable" + + features = ( + ("Local website provisioning", settings.LOCAL_WEB_ACTIVATION), + ("Managed website certificates", settings.LOCAL_WEB_HTTPS), + ("Website file manager", settings.WEB_FILE_MANAGER), + ("Website scheduled tasks", settings.WEBSITE_JOBS), + ("Local DNS publishing", settings.LOCAL_DNS_PUBLISHING), + ( + "Default managed DNS zones for new accounts", + settings.LOCAL_DNS_PUBLISHING + and settings.HOSTING_NAMESERVERS + and settings.HOSTING_PUBLIC_ADDRESSES, + ), + ( + "Local mailbox provisioning", + settings.LOCAL_MAILBOX_PROVISIONING, + ), + ("Managed mail DNS records", settings.MANAGE_MAIL_DNS), + ( + "Local database provisioning", + settings.LOCAL_DATABASE_PROVISIONING, + ), + ("Local account backups", settings.LOCAL_ACCOUNT_BACKUPS), + ( + "Off-site backup destinations", + settings.OFFSITE_BACKUP_DESTINATIONS, + ), + ("phpMyAdmin sign-in", settings.PHPMYADMIN_URL), + ("Roundcube sign-in", settings.ROUNDCUBE_URL), + ) + return super().get_context_data( + installed_version=installed_version, + features=[ + (name, bool(configured)) for name, configured in features + ], + **kwargs, + ) diff --git a/src/coulobre/hosting/static/hosting/panel.css b/src/coulobre/hosting/static/hosting/panel.css index 87ecf81..2bb54df 100644 --- a/src/coulobre/hosting/static/hosting/panel.css +++ b/src/coulobre/hosting/static/hosting/panel.css @@ -273,6 +273,14 @@ button, input, select, textarea { linear-gradient(currentColor, currentColor) 75% bottom / 1px 55% no-repeat; } +.nav-icon-information { + display: grid; + place-content: center; + border-radius: 50%; + font-size: 0.7rem; + font-weight: 700; +} + .nav-icon-customers { position: relative; height: 0.46rem; diff --git a/src/coulobre/hosting/templates/hosting/base.html b/src/coulobre/hosting/templates/hosting/base.html index 57a9644..31170d0 100644 --- a/src/coulobre/hosting/templates/hosting/base.html +++ b/src/coulobre/hosting/templates/hosting/base.html @@ -52,8 +52,8 @@ {% endif %} {% if group_customer_navigation %}{% endif %} - {% if is_operator and perms.hosting.view_webprovisioningplan and perms.hosting.view_servicehealth %} - {% endif %} {% endwith %}