Documentation
¶
Overview ¶
Package admin is the shell: the pages a person sees, as opposed to the routes a program calls.
It writes almost no screens. ARCHITECTURE.md's eighth idea is that list, detail and form come from an entity's schema, and kit/httpx carries that schema for every resource kit/rest mounted. The generated screens are ui/screens'; this module composes them with its own chrome, frame and navigation, adds the five pages no schema describes — the dashboard, the health page, the sign-in page, the gallery and the tenant switcher — and serves the same knowledge as JSON at /api/v1/admin/resources for a shell that is not a browser. A sixth hand-written page arrives only when an interaction cannot be derived.
It is composed last, and that is load-bearing rather than tidy: kit/app calls each module's Routes in composition order, so a module mounted after this one registers a resource whose screens were already generated — which is to say, were not.
Index ¶
Constants ¶
const PermissionGalleryRead = "gallery:read"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Deps ¶
type Deps struct {
// Modules is the composition, for navigation. The shell draws the sidebar
// from every module's Nav, so it needs the list main built; a copy
// maintained here would be a second answer to "what is in this
// application", and the one that goes stale.
Modules []module.Module
// Authorize is the same value the kernel enforces with. The sidebar shows a
// link only when the caller may follow it, and asking the authorizer is
// what makes that the same answer the route would give — a nav filter with
// rules of its own is a menu that lies in one direction or the other.
Authorize httpx.Authorizer
// Tenants is the control plane, for the switcher. It is the one cross-tenant
// read in this module, and it needs the token Routes is handed.
Tenants tenantcontracts.Service
// Theme is the installation's two palettes. The zero value is the palette
// this repository ships; a client with its own colours sets this and
// changes nothing else, because every rule above the tokens is written in
// terms of a role. See design.Pair.
Theme design.Pair
// Messages and Locale opt the sign-in page into translated copy. Compose
// Messages() or an application catalog before mounting. Other pages keep
// their authored language. Locale selects a preference before the browser.
Messages page.Messages
Locale func(context.Context, page.Request) string
// Storybook selects and authorizes the composition for the resolved tenant
// and principal in ctx. Return an error to deny access; never select from a
// query parameter or fall back to another tenant. Nil exposes Core only to
// the operator tenant. Empty Examples stays empty. Every gallery endpoint
// also requires PermissionGalleryRead before calling this function.
Storybook func(context.Context) (export.Storybook, error)
}
Deps is what the shell cannot make for itself.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package internal is the shell's implementation: one chrome, one frame, the five pages written by hand, the catalog, and the screens ui/screens generates for every resource kit/rest registered before this module was composed.
|
Package internal is the shell's implementation: one chrome, one frame, the five pages written by hand, the catalog, and the screens ui/screens generates for every resource kit/rest registered before this module was composed. |