feat(32.2-02): My account item rows with per-row actions; connect screen docs

- AccountContributions renders a section's items as list rows (title,
  subtitle, meta joined with ' · ') with one button per item action, or
  the dashed empty block; sections without items render as before
- item actions confirm with :title filled as text, post to
  /account/contribution-items/{name}/{item}/actions/{action}, reload and
  focus the section heading; 404 toasts item_gone and reloads
- myaccount.items_empty, item_gone, item_action_named in en and pl
- docs/backend/admin-spa.md: the /connect screen and My account item rows
This commit is contained in:
Jakub Zych
2026-11-21 00:52:23 +01:00
parent 6900bd1a72
commit 2708982601
5 changed files with 269 additions and 4 deletions

View File

@@ -37,10 +37,20 @@ A form whose schema carries `preview` has a read-only record screen at `<control
The user menu in the top bar has a My account item that opens `<prefix>/account`. That screen edits the signed-in administrator's own first name, last name, email and subtitle, uploads and removes their avatar, shows the login read-only, changes the password when a new one is typed together with the current one, and manages personal API tokens (list, create with a show-once plaintext, revoke, show revoked). Server validation errors show on their fields, and a successful save updates the name and the avatar in the top bar without a reload. See [My account](users-and-permissions.md#my-account) and [API tokens](users-and-permissions.md#api-tokens).
A plugin section on My account can also list rows that belong to the signed-in administrator, such as connected agents. The section card then shows one row per item under its status line (title, subtitle and meta lines joined with " · ") with the section's item buttons on each row, or a dashed empty block with the section's `items_empty` line (else the admin's own "Nothing here yet."). A button with a confirmation or a danger variant asks first, with `:title` in the confirmation replaced by the row's title as text, and posts to `<prefix>/api/v1/account/contribution-items/{name}/{item}/actions/{action}`. While it runs every action button is disabled; afterwards the section reloads and focus returns to the section heading. A row that is gone meanwhile (404) shows a toast and reloads the section. A section without items looks exactly as before. See [My account](users-and-permissions.md#my-account).
The button at the top of the plugin rail switches the theme: each click moves from system (follow the browser's `prefers-color-scheme`) to light, to dark and back to system, and its icon and label name the current choice. The choice is saved for the signed-in administrator through `PUT <prefix>/api/v1/account/preferences` and comes back as `preferences.theme` in `GET .../auth/me`, so another browser shows the same theme after sign-in. The SPA also caches the last choice in `localStorage` (`summer-admin.theme`) and applies it before anything renders. When the save fails the previous theme returns with an error message. See [My account](users-and-permissions.md#my-account).
When the server offers more than one admin language (`meta.locales` of `GET .../lang`), the user menu lists them under Language, each named in its own language. Choosing one saves it as the administrator's `locale` preference, caches it in `localStorage` (`summer-admin.locale`) and reloads the page, so the strings, navigation, settings, schemas and validation messages all come back in that language, in any browser and whatever `Accept-Language` says. A form with unsaved changes asks before the reload.
## Connect screen
`<prefix>/connect?request=<id>` is the consent screen for MCP clients that connect as an administrator. The OAuth server hands the browser off to it when the application sets `wristband.Options.ConsentPath` to that path (see [Consent](../services/oauth-server.md#consent)). The screen is part of the framework SPA, not plugin code, and talks only to cabana's `GET` and `POST <prefix>/api/v1/mcp/consent/{request}`.
The route is standalone, without the navigation shell, and needs a session: an anonymous visitor goes to the login screen with the connect path as its redirect, signs in (with any second step the login asks for) and comes back to the same request. The login screen then says why the administrator is signing in.
The card names the client, the signed-in administrator (with a "Use another account" button that signs out of this browser and goes through login again) and the host the browser returns to, which is always shown in full. Below are the scopes the server offered, in catalog order: every one starts ticked except `*`, which starts ticked only when it is the only scope, and ticking `*` clears and disables the others, as on API token creation. A "Stay connected" box, ticked by default, appears only when the client asked for offline access. Nothing is sent until the administrator clicks Allow or Deny, even for a client allowed before, and neither button has initial focus or a shortcut. The answer's `redirect_uri` is opened with `window.location.assign`, never through the router or the login redirect check, and a `javascript:`, `data:` or `vbscript:` URI is refused as a failed answer. An unknown, expired or used request shows an expired card with a link to the admin; when the administrator holds none of the requested scopes only Deny is offered.
## Plugins screen
Settings → System → Plugins opens `<prefix>/system/plugins`, a read-only screen for administrators holding `backend.view_plugins` (`cabana.PermissionViewPlugins`; superusers always pass). Its Installed tab lists the plugins the binary was built with, from `GET <prefix>/api/v1/plugins`: the name and description from each plugin's `plugin.yaml` (only the ID for a plugin without one), the version and where the plugin came from (Go module, git submodule or the application itself), with the framework version the application was built with above the tabs. When the plugin registry knows a newer release that the framework version allows, the row shows an update badge and the `summer plugin:update <id>` command with a copy button. The Marketplace tab searches the registry by text and category and shows each plugin's `summer plugin:install <id>` command with a copy button; nothing is installed from the admin. With the registry disabled (`plugins.registry_url` empty) the Marketplace tab and the badges are hidden; when it does not answer, a notice says so and the Installed tab still lists every plugin. The settings entry carries a `path` instead of a controller, so the settings index, the settings panel and the breadcrumbs treat the screen like any other System entry. The SPA never calls the plugin registry itself; see [Publishing plugins](../plugins/marketplace.md#admin-plugins-screen).