diff --git a/docs/deployment.md b/docs/deployment.md index 1e0aeb8..0dfc901 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -1177,7 +1177,7 @@ When creating an account, select the services it should use. The website option queues the Apache configuration. A new managed website with an empty web root gets a neutral starter page unless you skip it during setup or activation. Already provisioned sites are not changed by an upgrade, and -the starter page never replaces existing files. Replace or remove the +the branded starter page never replaces existing files. Replace or remove the generated `index.html` when you publish manually. Managed WordPress installation can replace an unmodified starter page automatically. Coulobre DNS can publish the apex, `www`, and a wildcard @@ -1797,13 +1797,27 @@ sudo systemctl enable --now coulobre-https-apply.socket \ coulobre-https-provisioner.service ``` -On an active site's Apache preview, select **Enable HTTPS** and use -**Refresh status** to follow the request. This requires the **Can add -website HTTPS request** permission and access to view hosting accounts -and web provisioning plans. The worker uses the manifest's primary -domain and keeps Certbot logs and credentials on the web node. If the -request fails, check the diagnostic and use **Retry HTTPS** after -resolving the problem. Certbot handles later renewals. +Open **Manage HTTPS** in the hosting account's **Overview** or **Websites** +tab. The hostname table shows the primary site, its existing web aliases, +and any independent websites. Select the hostnames to enable. The primary +hostname and eligible existing aliases, such as `www`, are selected by +default. Each hostname has its own request and result. A failed hostname +can be retried without reissuing certificates for working hostnames. + +For a new hostname, first give it a website route. Operators with alias +management access can attach it to the primary website. Use an independent +website if it should serve separate content. DNS records provide suggestions +only. Adding a website alias does not edit DNS, and a published DNS zone +does not prove that visitors or Let's Encrypt reach the correct web node. +With external DNS, update the records at the DNS provider. + +Initial issuance checks the web node's configuration and uses Certbot +HTTP-01 validation for the exact hostname. If issuance fails, verify that +the public A, AAAA or CNAME routes to the intended web server and that +port 80 reaches it. See Certbot's log on the web node for more detail. +A ready Apache preview is not a deployed HTTPS virtual host. Apache +previews remain available for diagnosis, and the existing Certbot hook +continues to reload Apache after renewal. The panel uses HTTP-01 for initial issuance. For DNS validation, obtain the certificate on the web node with its configured Certbot DNS plugin diff --git a/docs/panel-design.md b/docs/panel-design.md index 502268f..7c26ade 100644 --- a/docs/panel-design.md +++ b/docs/panel-design.md @@ -18,6 +18,15 @@ only use shared components available in its supported Core versions. separate from forms so they cannot erase edits or move keyboard focus. For background jobs, show progress and the terminal result in that same region. Keep recovery actions discoverable without a manual page refresh. +- Show a background job beside the resource it affects without replacing + its main status. For example, a configured mailbox can also have an + import in progress. Replace the start action with a link to progress + while work is active, then link to the result or recovery workflow. + Keep refreshed content separate from inputs and focused actions. +- Account overviews should surface the current state and next step for + each service. Keep metadata compact and link to the relevant workflow + for the active role. Distinguish configuration from public reachability + or delivery. Use measured usage only when the panel has it. - Use `.surface` for sections, `.section-heading` for ordinary section headers, and `.table-scroll` around tables. Keep horizontal overflow in the table wrapper and give empty or pending states an explicit label. @@ -59,6 +68,14 @@ heading, help, fields, and actions should share a left edge. - Prefer the shared compact type and spacing. Use [the panel stylesheet][css] and its theme tokens for type, color, spacing, and focus states. Avoid fixed control widths, inline styles, and page-specific font sizes. +- Keep short forms in a compact card. For longer forms, use + `.editor-wide` and group related fields with `.editor-columns` and + `.editor-group`. Use the available width where it saves scrolling. + Groups stack in source and keyboard order when space is limited. + Use the same approach for parallel summary cards. +- For a small multi-selection, use a visible checklist with a fieldset + label and an empty state. Keep create and refresh actions beside the + picker. Refresh the options without clearing selections or other edits. ### Resource actions @@ -66,9 +83,11 @@ heading, help, fields, and actions should share a left edge. for row-level actions such as **Import mail**, **Change password**, and **Manage logins**. Use `.button danger compact` for opening a removal workflow. Keep the final destructive confirmation visually distinct. -- Group row actions in a wrapping `.table-actions` or `.form-actions` - container. Keep a single, full-size primary action in the page or section - header when the page offers one, such as **Add mailbox**. +- Group table actions in a wrapping `.table-actions` container. Center + them vertically within the row and allow labels to wrap instead of + widening the whole table. Keep overflow within `.table-scroll`. + Use `.form-actions` for submit and cancel controls, and keep a single + full-size primary action in the page or section header when applicable. - Keep ordinary navigation, record names, and contextual help as links. An action that opens a form, confirmation page, or download is still an `` styled as a button. An action that submits the change uses a @@ -88,7 +107,9 @@ Django's label association, error state, and description IDs. Keep radio choices and multi-checkbox groups in a fieldset with a visible legend naming the group. - Keep a compound control, such as a numeric quota with **Unlimited**, - in its own editor row. Its checkbox still sits next to its own label. + together in `.limit-control`. Keep **Unlimited** unbroken. When the + numeric input and checkbox cannot sit side by side, wrap the checkbox + and its label as one unit. - Use the shared stylesheet in both Core and Premium. Check click and keyboard operation, wrapping, and focus in both themes at a narrow width. diff --git a/pyproject.toml b/pyproject.toml index 23a6f98..169acf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "coulobre-panel" -version = "1.6.0" +version = "1.7.0" description = "A web hosting control panel for hosting providers and resellers." readme = "README.md" requires-python = ">=3.12" diff --git a/src/coulobre/hosting/domain_services.py b/src/coulobre/hosting/domain_services.py index fcd004a..04536e4 100644 --- a/src/coulobre/hosting/domain_services.py +++ b/src/coulobre/hosting/domain_services.py @@ -18,6 +18,7 @@ from .dns_forms import zone_record_rows from .domain_policies import managed_mail_domains, policy_for from .independent_websites import account_websites from .installation_features import panel_feature_allowed +from .mailbox_imports import with_import_status from .models import DomainServicePolicy, HostingAccount, SmtpApplication from .resource_requests import ( customer_mailbox_quota_limit, @@ -288,8 +289,8 @@ def domain_workspace(request, pk, page): ), "mail_imap_host": settings.MAIL_IMAP_HOST, "mail_submission_host": settings.MAIL_SUBMISSION_HOST, - "mailboxes": mail_domain.mailboxes.select_related( - "provisioning", "removal" + "mailboxes": with_import_status( + mail_domain.mailboxes.select_related("provisioning", "removal") ) if mail_domain else (), diff --git a/src/coulobre/hosting/mailbox_imports.py b/src/coulobre/hosting/mailbox_imports.py index a6d5725..ea1904e 100644 --- a/src/coulobre/hosting/mailbox_imports.py +++ b/src/coulobre/hosting/mailbox_imports.py @@ -13,7 +13,7 @@ from cryptography.fernet import Fernet, InvalidToken, MultiFernet from django.conf import settings from django.core.exceptions import ValidationError from django.db import transaction -from django.db.models import F +from django.db.models import Exists, F, OuterRef from django.utils import timezone from django.views.decorators.debug import sensitive_variables @@ -45,6 +45,19 @@ class BatchYieldError(Exception): """Yield the worker at a saved checkpoint.""" +def with_import_status(mailboxes): + imports = MailboxImport.objects.filter(mailbox_id=OuterRef("pk")) + return mailboxes.annotate( + import_active=Exists(imports.filter(finished_at__isnull=True)), + import_failed=Exists( + imports.filter(finished_at__isnull=False).exclude(problem="") + ), + import_completed=Exists( + imports.filter(finished_at__isnull=False, problem="") + ), + ) + + def available(): return ( settings.MAILBOX_IMAP_IMPORT diff --git a/src/coulobre/hosting/reseller_profiles.py b/src/coulobre/hosting/reseller_profiles.py index 7b5dc41..ed39083 100644 --- a/src/coulobre/hosting/reseller_profiles.py +++ b/src/coulobre/hosting/reseller_profiles.py @@ -22,6 +22,7 @@ class ResellerProfileForm(forms.ModelForm): model = ResellerProfile fields = ("name", "account_limit", "hosting_plans") labels = {"hosting_plans": "Allowed hosting packages"} + widgets = {"hosting_plans": forms.CheckboxSelectMultiple} help_texts = { "account_limit": "Enter 0 to manage existing accounts only.", } diff --git a/src/coulobre/hosting/reseller_views.py b/src/coulobre/hosting/reseller_views.py index f527b75..ad27719 100644 --- a/src/coulobre/hosting/reseller_views.py +++ b/src/coulobre/hosting/reseller_views.py @@ -35,6 +35,7 @@ class ResellerPolicyForm(forms.ModelForm): model = Reseller fields = ("is_active", "account_limit", "hosting_plans") labels = {"hosting_plans": "Allowed hosting packages"} + widgets = {"hosting_plans": forms.CheckboxSelectMultiple} help_texts = { "account_limit": "Enter 0 to manage existing accounts only.", "hosting_plans": ( diff --git a/src/coulobre/hosting/static/hosting/package-picker.js b/src/coulobre/hosting/static/hosting/package-picker.js new file mode 100644 index 0000000..2542d95 --- /dev/null +++ b/src/coulobre/hosting/static/hosting/package-picker.js @@ -0,0 +1,34 @@ +"use strict"; + +for (const picker of document.querySelectorAll("[data-package-picker]")) { + const reload = picker.querySelector('button[name="refresh_plans"]'); + if (!reload) continue; + + const choices = picker.querySelector("[data-package-choices]"); + const status = picker.querySelector("[data-package-refresh-status]"); + reload.addEventListener("click", async (event) => { + event.preventDefault(); + reload.disabled = true; + status.hidden = false; + status.textContent = "Refreshing available packages…"; + try { + const response = await fetch(location.href, {cache: "no-store"}); + if (!response.ok || response.redirected) throw new Error(); + const page = new DOMParser().parseFromString(await response.text(), "text/html"); + const updated = page.querySelector("[data-package-choices]"); + if (!updated) throw new Error(); + const selected = new Set( + [...choices.querySelectorAll('input[type="checkbox"]:checked')].map((input) => input.value) + ); + for (const input of updated.querySelectorAll('input[type="checkbox"]')) { + input.checked = selected.has(input.value); + } + choices.replaceChildren(...updated.childNodes); + status.textContent = "Available packages refreshed."; + } catch { + status.textContent = "Could not reload packages. Try again."; + } finally { + reload.disabled = false; + } + }); +} diff --git a/src/coulobre/hosting/static/hosting/panel.css b/src/coulobre/hosting/static/hosting/panel.css index 9dbb81c..885c82b 100644 --- a/src/coulobre/hosting/static/hosting/panel.css +++ b/src/coulobre/hosting/static/hosting/panel.css @@ -609,8 +609,23 @@ h3, h4, h5, h6 { text-align: center; } +/* Keep row actions compact without pinning a wide layout to their labels. */ .table-scroll .button.compact { - white-space: nowrap; + white-space: normal; + overflow-wrap: anywhere; +} + +.table-scroll tr:has(.table-actions, .button.compact) > :is(th, td) { + vertical-align: middle; +} + +.table-scroll .table-actions { + gap: 0.35rem; +} + +.table-actions > form { + margin: 0; + min-inline-size: 0; } .toolbar, .section-heading, .pagination, .form-actions { @@ -1044,12 +1059,15 @@ fieldset > div:has(> div > label > input:is([type="checkbox"], [type="radio"])) .limit-control { display: flex; + flex-wrap: wrap; align-items: center; gap: 0.65rem; } .limit-control input[type="number"] { - min-width: 0; + flex: 1 1 8rem; + inline-size: 8rem; + min-inline-size: 0; } .limit-control input[type="checkbox"] { @@ -1057,12 +1075,15 @@ fieldset > div:has(> div > label > input:is([type="checkbox"], [type="radio"])) margin: 0; } -.limit-control label { +.editor .limit-control label { display: inline-flex; + flex: none; align-items: center; gap: 0.3rem; margin: 0; font-weight: inherit; + white-space: nowrap; + overflow-wrap: normal; } .welcome-email-preview { @@ -1494,3 +1515,70 @@ fieldset > div:has(> div > label > input:is([type="checkbox"], [type="radio"])) .hosting-node:focus .hosting-node-full { display: block; } + +.editor-wide { + max-width: 76rem; +} + +.editor-intro { + max-width: 35rem; + margin-block-end: 1rem; +} + +.editor-columns { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr)); + gap: 1rem; + align-items: start; +} + +.editor-columns > * { + min-inline-size: 0; +} + +.editor .editor-group { + padding: 0.8rem; + border: 1px solid var(--line); + border-radius: var(--radius); + margin: 0; + min-inline-size: 0; +} + +.editor-group legend { + padding-inline: 0.3rem; + font-weight: var(--font-weight-semibold); +} + +.package-choices > div { + display: grid; + gap: 0.45rem; +} + +.package-choices label { + font-weight: inherit; +} + +.package-details { + display: grid; + gap: 0.25rem 0.65rem; + grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); + min-inline-size: 12rem; +} + +.package-details dd { + margin: 0; +} + + +.account-overview-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); + gap: 1rem; + align-items: stretch; +} + +.account-overview-grid > .editor-surface { + max-width: none; + min-inline-size: 0; + grid-template-rows: auto auto 1fr auto; +} diff --git a/src/coulobre/hosting/templates/hosting/account_detail.html b/src/coulobre/hosting/templates/hosting/account_detail.html index af9ede8..171bd5b 100644 --- a/src/coulobre/hosting/templates/hosting/account_detail.html +++ b/src/coulobre/hosting/templates/hosting/account_detail.html @@ -54,20 +54,7 @@ {% endif %}
Added
{{ account.created_at|date:"j M Y, H:i" }} UTC
-
- {% if offer_account_setup %} -
-

Some services still need setup.

-
Complete hosting setup -
- {% endif %} -
- {% if show_website %}
Website
{{ website_readiness }}
{% endif %} - {% if show_website %}
HTTPS
{{ https_readiness }}
{% endif %} - {% if is_tenant or perms.hosting.view_hostingdnszone %}
DNS
{{ dns_readiness }}
{% endif %} - {% if is_tenant or perms.hosting.view_hostingmailbox %}
Email
{{ mail_readiness }}
{% endif %} -
-
+ {% include "hosting/account_overview.html" %} {% if can_change_hosting_services or service_change or can_retire_account or is_operator and perms.hosting.change_hostingaccount %}
{% if can_retire_account or is_operator and perms.hosting.change_hostingaccount %} @@ -87,8 +74,11 @@ {% endif %} {% if show_website or independent_websites or add_independent_website %}
- {% if show_website_usage or primary_file_access or manage_website_jobs or manage_sftp or manage_wordpress %} + {% if may_manage_https or show_website_usage or primary_file_access or manage_website_jobs or manage_sftp or manage_wordpress %}