Open Administration on a dashboard of what the role can read #360

Closed
opened 2026-09-15 15:06:58 +00:00 by jcoffey-dev · 0 comments
Owner

First of the five Administration PRs (dashboard, then groups, mailing lists, roles, tenants).

/admin now opens on a grid of cards. Each card only shows when the role has the permissions for it:

Card Source Needs
Users x:Account/query {"@type":"User"}, limit: 0, calculateTotal sysAccountQuery
Domains x:Domain/query, same sysDomainQuery
Pending x:QueuedMessage/query, same sysQueuedMessageQuery
Server memory latest server.memory Gauge sysMetricQuery + sysMetricGet
Received (24h) sum of queue.message-queued same
Sent (24h) sum of queue.authenticated-message-queued + queue.dsn-queued + queue.report-queued same
  • Tenants: Stalwart limits accounts, domains and queue to a tenant admin's own tenancy on its side. Metrics have no tenant field, and the default Tenant Administrator role doesn't have them, so a tenant's dashboard shows Users, Domains and Pending.
  • Helpdesk (account and domain read) gets Users and Domains.
  • Refused feeds: a card is dropped if Stalwart refuses its feed (forbidden, e.g. metrics on Community). If metrics aren't recorded, the card says "Not recorded on this server" rather than showing zeros. Any other failure shows "Could not be loaded" on the card.
  • Layout: the column count depends on the number of cards so rows stay even (6 → 3×2 → 2×3 → 1). It responds to the grid's own width via a container query, not the window's, because the folder pane beside it varies.
  • Server gate: grantsAdministration now matches the client again, since a count alone is enough to see the dashboard.
  • Mock: queue plus an hourly metric history ending in the current hour. MOCK_METRICS=off simulates Community. Tenant admin gets the queue, and helpdesk reads domains, matching the demo.
  • Docs: ROADMAP and FEATURES said reporting and queues were out of scope; they now say the dashboard shows a handful of numbers, while queue management, logs and settings stay out. KNOWN-ISSUES records what was confirmed live and what was only read from source.

Translation: 14 new strings in all nine catalogues (1452/1468 each, 16 falling back as before).

Checked

  • Filters and names: read-only on prod (0.16.22 Enterprise) before writing any code, including the metric filter names and metric names.

  • Not confirmed live:

    • tenant scoping (prod has no tenants);
    • Community refusing x:Metric (prod is Enterprise).

    Both come from the 0.16.22 source and are covered by tests.

  • Tests: typecheck, 1236 web and 204 server tests pass, as do build and i18n:check.

    • New tests cover gating, the received/sent/memory arithmetic, the exact queries sent, balanced columns, the mock feeds, and a component test per role (helpdesk, tenant, admin, Community, not recorded, load failure).
  • In Chrome against the mock as admin:

    • six cards, and the numbers match the mock's data;
    • Users and Domains link to their sections;
    • 3+3 at full width, 2+2+2 below 760px, one per row below 480px;
    • Refresh lines up with the grid;
    • no console errors.

Merged 2026-09-15 as coffey-labs/ihasmail@d17c9a6e1f

Rebuilt from: git history, session transcript.

First of the five Administration PRs (dashboard, then groups, mailing lists, roles, tenants). `/admin` now opens on a grid of cards. Each card only shows when the role has the permissions for it: | Card | Source | Needs | |---|---|---| | Users | `x:Account/query` `{"@type":"User"}`, `limit: 0`, `calculateTotal` | `sysAccountQuery` | | Domains | `x:Domain/query`, same | `sysDomainQuery` | | Pending | `x:QueuedMessage/query`, same | `sysQueuedMessageQuery` | | Server memory | latest `server.memory` Gauge | `sysMetricQuery` + `sysMetricGet` | | Received (24h) | sum of `queue.message-queued` | same | | Sent (24h) | sum of `queue.authenticated-message-queued` + `queue.dsn-queued` + `queue.report-queued` | same | - **Tenants:** Stalwart limits accounts, domains and queue to a tenant admin's own tenancy on its side. Metrics have no tenant field, and the default Tenant Administrator role doesn't have them, so a tenant's dashboard shows Users, Domains and Pending. - **Helpdesk** (account and domain read) gets Users and Domains. - **Refused feeds:** a card is dropped if Stalwart refuses its feed (`forbidden`, e.g. metrics on Community). If metrics aren't recorded, the card says "Not recorded on this server" rather than showing zeros. Any other failure shows "Could not be loaded" on the card. - **Layout:** the column count depends on the number of cards so rows stay even (6 → 3×2 → 2×3 → 1). It responds to the grid's own width via a container query, not the window's, because the folder pane beside it varies. - **Server gate:** `grantsAdministration` now matches the client again, since a count alone is enough to see the dashboard. - **Mock:** queue plus an hourly metric history ending in the current hour. `MOCK_METRICS=off` simulates Community. Tenant admin gets the queue, and helpdesk reads domains, matching the demo. - **Docs:** ROADMAP and FEATURES said reporting and queues were out of scope; they now say the dashboard shows a handful of numbers, while queue management, logs and settings stay out. KNOWN-ISSUES records what was confirmed live and what was only read from source. **Translation:** 14 new strings in all nine catalogues (1452/1468 each, 16 falling back as before). **Checked** - **Filters and names:** read-only on prod (0.16.22 Enterprise) before writing any code, including the metric filter names and metric names. - **Not confirmed live:** - tenant scoping (prod has no tenants); - Community refusing `x:Metric` (prod is Enterprise). Both come from the 0.16.22 source and are covered by tests. - **Tests:** typecheck, 1236 web and 204 server tests pass, as do build and i18n:check. - New tests cover gating, the received/sent/memory arithmetic, the exact queries sent, balanced columns, the mock feeds, and a component test per role (helpdesk, tenant, admin, Community, not recorded, load failure). - **In Chrome against the mock as admin:** - six cards, and the numbers match the mock's data; - Users and Domains link to their sections; - 3+3 at full width, 2+2+2 below 760px, one per row below 480px; - Refresh lines up with the grid; - no console errors. **Merged** 2026-09-15 as coffey-labs/ihasmail@d17c9a6e1f26 <sub>Rebuilt from: git history, session transcript.</sub>
This repo is archived. You cannot comment on issues.