Link unconfigured features to setup instructions
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s

This commit is contained in:
parkel committed 2026-11-24 14:52:11 +01:00
1 parent fbe6571afc
commit aebe978780
6 files changed
+98 -3

No files matched your search

@@ -10,15 +10,26 @@ from coulobre.linked_updates import UNIT_DIR
from .dns_defaults import zone_defaults from .dns_defaults import zone_defaults
from .models import PanelFeaturePolicy from .models import PanelFeaturePolicy
DEPLOYMENT_GUIDE = (
"https://code.hosting.hippogrief.nl/hippogrief/coulobre/"
"src/branch/main/docs/deployment.md"
)
@dataclass(frozen=True) @dataclass(frozen=True)
class Feature: class Feature:
setting: str setting: str
label: str label: str
prerequisite: str prerequisite: str
setup_anchor: str
setup_instruction: str
socket: str = "" socket: str = ""
role: str = "" role: str = ""
@property
def setup_url(self):
return f"{DEPLOYMENT_GUIDE}#{self.setup_anchor}"
@property @property
def configured(self): def configured(self):
if self.setting == "DEFAULT_DNS_ZONES": if self.setting == "DEFAULT_DNS_ZONES":
@@ -68,30 +79,40 @@ FEATURES = (
"LOCAL_WEB_ACTIVATION", "LOCAL_WEB_ACTIVATION",
"Website provisioning", "Website provisioning",
"Apache and PHP provisioning", "Apache and PHP provisioning",
"activate-local-websites-from-the-panel",
"Install and enable the local web provisioning worker.",
"coulobre-web-apply", "coulobre-web-apply",
), ),
Feature( Feature(
"LOCAL_WEB_HTTPS", "LOCAL_WEB_HTTPS",
"Managed website certificates", "Managed website certificates",
"Website certificate provisioning", "Website certificate provisioning",
"request-https-from-the-panel",
"Configure Certbot and install the website certificate worker.",
"coulobre-https-apply", "coulobre-https-apply",
), ),
Feature( Feature(
"WEB_FILE_MANAGER", "WEB_FILE_MANAGER",
"Website file manager", "Website file manager",
"Website file service", "Website file service",
"enable-the-website-file-manager",
"Install the website file service and enable it for the panel.",
"coulobre-website-files", "coulobre-website-files",
), ),
Feature( Feature(
"WEBSITE_JOBS", "WEBSITE_JOBS",
"Website scheduled tasks", "Website scheduled tasks",
"Website task service", "Website task service",
"enable-scheduled-website-jobs",
"Install the task worker and allow tasks in the hosting package.",
"coulobre-website-jobs", "coulobre-website-jobs",
), ),
Feature( Feature(
"LOCAL_DNS_PUBLISHING", "LOCAL_DNS_PUBLISHING",
"DNS publishing", "DNS publishing",
"Local BIND9 or a linked DNS receiver", "Local BIND9 or a linked DNS receiver",
"publish-local-dns-zones-from-the-panel",
"Configure local BIND9 or connect a Coulobre DNS receiver.",
"coulobre-dns-apply", "coulobre-dns-apply",
"dns", "dns",
), ),
@@ -99,11 +120,15 @@ FEATURES = (
"DEFAULT_DNS_ZONES", "DEFAULT_DNS_ZONES",
"Default managed DNS zones for new accounts", "Default managed DNS zones for new accounts",
"DNS publishing, nameservers and hosting IP addresses", "DNS publishing, nameservers and hosting IP addresses",
"set-defaults-for-new-hosting-accounts",
"Enable DNS publishing and set nameservers and hosting IPs.",
), ),
Feature( Feature(
"LOCAL_MAILBOX_PROVISIONING", "LOCAL_MAILBOX_PROVISIONING",
"Mailbox provisioning", "Mailbox provisioning",
"Local mail services or a linked mail receiver", "Local mail services or a linked mail receiver",
"provision-local-mailboxes-from-the-panel",
"Set up local mail services or connect a Coulobre mail receiver.",
"coulobre-mail-apply", "coulobre-mail-apply",
"mail", "mail",
), ),
@@ -111,35 +136,47 @@ FEATURES = (
"MANAGE_MAIL_DNS", "MANAGE_MAIL_DNS",
"Managed mail DNS records", "Managed mail DNS records",
"Mail exchanger and sending IP addresses", "Mail exchanger and sending IP addresses",
"check-and-provision-mail-dns",
"Set the mail exchanger and public sending IPs, then enable mail DNS.",
), ),
Feature( Feature(
"LOCAL_DATABASE_PROVISIONING", "LOCAL_DATABASE_PROVISIONING",
"Database provisioning", "Database provisioning",
"MariaDB provisioning", "MariaDB provisioning",
"provision-local-databases-from-the-panel",
"Install the MariaDB provisioning worker and enable it for the panel.",
"coulobre-database-apply", "coulobre-database-apply",
), ),
Feature( Feature(
"LOCAL_ACCOUNT_BACKUPS", "LOCAL_ACCOUNT_BACKUPS",
"Local account backups", "Local account backups",
"Local backup service", "Local backup service",
"start-local-account-backups-from-the-panel",
"Install the account backup worker and enable it for the panel.",
"coulobre-account-backup", "coulobre-account-backup",
), ),
Feature( Feature(
"OFFSITE_BACKUP_DESTINATIONS", "OFFSITE_BACKUP_DESTINATIONS",
"Off-site backup destinations", "Off-site backup destinations",
"A configured destination and the transfer service", "A configured destination and the transfer service",
"copy-scheduled-account-backups-off-site",
"Set up local backups, a restic destination and the transfer worker.",
"coulobre-account-offsite", "coulobre-account-offsite",
), ),
Feature( Feature(
"PHPMYADMIN_URL", "PHPMYADMIN_URL",
"phpMyAdmin sign-in", "phpMyAdmin sign-in",
"phpMyAdmin bridge and MariaDB credential service", "phpMyAdmin bridge and MariaDB credential service",
"open-phpmyadmin-from-the-panel",
"Enable database credential access and set up the HTTPS bridge.",
"coulobre-service-credentials", "coulobre-service-credentials",
), ),
Feature( Feature(
"ROUNDCUBE_URL", "ROUNDCUBE_URL",
"Roundcube sign-in", "Roundcube sign-in",
"Roundcube bridge and mailbox credential service", "Roundcube bridge and mailbox credential service",
"open-a-mailbox-in-roundcube",
"Enable mailbox credential access and set up the HTTPS bridge.",
), ),
) )
+8 -2
View File
@@ -84,12 +84,18 @@ class FeatureConfigurationForm(forms.Form):
def __init__(self, *args, policy, section=None, **kwargs): def __init__(self, *args, policy, section=None, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.initial["revision"] = policy.saved.revision self.initial["revision"] = policy.saved.revision
self.configured_features = [ features = [
feature feature
for feature in FEATURES for feature in FEATURES
if (section is None or feature.setting in section) if (section is None or feature.setting in section)
and feature.configured
] ]
self.configured_features = []
self.features_requiring_setup = []
for feature in features:
if feature.configured:
self.configured_features.append(feature)
else:
self.features_requiring_setup.append(feature)
for feature in self.configured_features: for feature in self.configured_features:
self.fields[feature.setting] = forms.BooleanField( self.fields[feature.setting] = forms.BooleanField(
required=False, required=False,
@@ -42,5 +42,23 @@
</div> </div>
</form> </form>
</div> </div>
{% if form.features_requiring_setup %}
<section class="surface" aria-labelledby="feature-setup-heading">
<header class="section-heading"><h2 id="feature-setup-heading">Requires setup</h2></header>
<div class="table-scroll">
<table>
<thead><tr><th scope="col">Feature</th><th scope="col">Setup</th></tr></thead>
<tbody>
{% for feature in form.features_requiring_setup %}
<tr>
<th scope="row">{{ feature.label }}</th>
<td>{% include "hosting/feature_setup.html" with show_dns_link=True %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
{% endif %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
@@ -0,0 +1,7 @@
<p class="heading-meta">{{ feature.setup_instruction }}</p>
<div class="table-actions">
<a class="record-link" href="{{ feature.setup_url }}" aria-label="Setup guide for {{ feature.label }}">Setup guide</a>
{% if show_dns_link and feature.setting == 'DEFAULT_DNS_ZONES' %}
<a class="record-link" href="{% url 'panel:dns_defaults' %}">Configure DNS defaults</a>
{% endif %}
</div>
@@ -42,7 +42,13 @@
{% endif %} {% endif %}
</div> </div>
</td> </td>
<td>{{ feature.prerequisite }}</td> <td>
{% if configured and feature.socket_ready %}
{{ feature.prerequisite }}
{% else %}
{% include "hosting/feature_setup.html" %}
{% endif %}
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@@ -5,6 +5,7 @@ from django.test import TestCase, override_settings
from django.urls import reverse from django.urls import reverse
from django_otp.plugins.otp_totp.models import TOTPDevice from django_otp.plugins.otp_totp.models import TOTPDevice
from .installation_features import FEATURES
from .models import AccountBackupJob, HostingAccount, PanelFeaturePolicy from .models import AccountBackupJob, HostingAccount, PanelFeaturePolicy
@@ -28,6 +29,26 @@ class FeatureConfigurationTests(TestCase):
def save(self, **data): def save(self, **data):
return self.client.post(reverse("panel:feature_configuration"), data) return self.client.post(reverse("panel:feature_configuration"), data)
@override_settings(LOCAL_WEB_HTTPS=False)
def test_setup_guides_are_visible_where_unconfigured_features_appear(self):
self.sign_in()
certificates = next(
feature
for feature in FEATURES
if feature.setting == "LOCAL_WEB_HTTPS"
)
for route, args in (
("installation", ()),
("feature_configuration", ()),
("operator_settings", ("security",)),
):
with self.subTest(route=route):
page = self.client.get(reverse(f"panel:{route}", args=args))
self.assertContains(page, "Requires setup")
self.assertContains(page, certificates.setup_instruction)
self.assertContains(page, f'href="{certificates.setup_url}"')
self.assertNotContains(page, 'name="LOCAL_WEB_HTTPS"')
def test_paused_backup_option_blocks_new_jobs_but_archives_stay_visible( def test_paused_backup_option_blocks_new_jobs_but_archives_stay_visible(
self, self,
): ):