Skip to main content

Module admin

Module admin 

Source
Expand description

The administration app (docs/design/admin-forms.md), titled “Settings”: every setting, and later every tool and task that is not the work surface, as full pages generated from declarations. Nothing here draws a component’s own widgets: a component declares a Manifest and the shell renders it with egui-pop’s bricks.

Experimental: may change in any release (docs/stability.md).
  • Full page: an overlay of the whole main window, or “Pop out” to a window of its own; the mode used last is remembered (the admin.window setting). The window is an application window (crate::windows, id APP_WINDOW): it repaints on its own, gets the application’s title bar, keeps its size and place, and closing the main window while it is open moves it into the main window. Where the backend has no windows of its own, the overlay.

  • Two panes: on the left, a tree of the scopes with their sections nested under them; on the right, the section’s page, which wraps to the width it gets. The divider between them is dragged (or moved by its arrow keys) and its width kept (NAV_WIDTH). The search above the tree searches every scope.

  • Rows: each setting’s editor, a modified bar, an origin tag (a host scope’s label, command line), its reset (of the layer shown), and a labelled “Set for” menu only on a setting that opted into a host scope open now. Applied live, undone with the settings’ history.

  • Generated: the declared settings become pages with no hand-written page (egui_pop_model::admin::generate); manifests add scopes and sections (Admin::manifest).

  • Value scopes: a setting is app-wide by default. The host declares its own scopes above app (Admin::declare_scope, a later one winning), a setting opts into them in its declaration (Descriptor::scopes) or a manifest’s field (model::Field::scopes); Admin::offer opens a scope’s layer, the store fills it, Admin::set_run records a command line override (egui_pop_model::admin::layers).

  • Storage: the host provides where the values are kept, a store::SettingsStore (Admin::attach_store): loaded when attached and when a scope is offered, saved away from the UI thread as values change, followed when they change elsewhere; its errors are shown in the window. egui-pop keeps no location of its own: without a store, the values last the session, and the window says so.

  • Records and statuses: lists and tables read their rows from a read_only command or a records hook, statuses their value from a read_only command or a status hook; read once, and again after a command that changes something or an event they name.

  • Clauses: a node’s when hides it and its enabled greys it (with its reason), read against the application’s context keys and the section’s values as form.<field id>.

  • Commands: admin.open ({"path": "scope/section/key"}, or {"key": "<setting id>"}, and {"mode": "overlay" | "window"}), admin.close, admin.popOut, admin.set and admin.reset (a value in a scope, for agents); {"wizard": "<id>"} opens a wizard. The admin collector shows the tree.

  • Settings files: settings.export and settings.import (with dryRun), and their wizards in General › Advanced (transfer).

  • Wizards: multi-step flows declared in a manifest (egui_pop_model::admin::wizard) fill the page while they run (wizard): admin.wizard.open and its sibling commands drive one.

Ctrl+, and app.settings open it (crate::settings_window). The shortcuts editor, the gestures, the Fonts page and the custom settings pages are its pages, as registered widget kinds (shortcuts, gestures, fonts, settings-page); the settings window of before opens from General › Advanced.

Re-exports§

pub use wizard::CMD_WIZARD_BACK;
pub use wizard::CMD_WIZARD_CANCEL;
pub use wizard::CMD_WIZARD_FINISH;
pub use wizard::CMD_WIZARD_GO;
pub use wizard::CMD_WIZARD_NEXT;
pub use wizard::CMD_WIZARD_OPEN;
pub use wizard::CMD_WIZARD_SET;
pub use wizard::CMD_WIZARD_SKIP;

Modules§

focus
The focus the Settings edit: whose host values (a library’s, a workspace’s…) the Settings show and write, when the host has several windows that each have their own.
model
The administration app’s model (docs/design/admin-forms.md): a declarative form tree for everything an application shows that is not its work surface (settings, tools, tasks).
quick
Quick settings: a small panel over the window it is asked in (admin.quick, Ctrl+Shift+Q) that edits a setting without the full Settings app. Before anything is typed it shows the settings the manifests mark quick (model::Manifest::quick), then those changed lately in this session (RECENT_SECONDS, at most RECENT_MAX); typing searches every setting. Each row is the Settings app’s own row: its editor, its reset, and its “Set for” choice only on a setting that also has a host level open now (a library). A change goes where the Settings app would write it, through the host’s store. Each row links to its page in Settings.
store
Where the settings’ values are kept: a contract the host provides (SettingsStore), which the Settings app calls. egui-pop holds no storage location and no default store: without one (super::Admin::attach_store), the values live in memory for the session and the Settings window says so.
transfer
Settings export and import, in the Settings app: General › Advanced holds “Export settings…” and “Import settings…”, each a wizard of the wizard kit, and both are commands an agent or a test runs alone.
wizard
The wizard kit’s surface (docs/design/admin-forms.md, section 5.3): a wizard declared in a manifest (egui_pop_model::admin::wizard) fills the Settings app’s page while it runs: the stepper on the left, the step’s form, and a footer with Cancel, Back, Skip and Next (Finish on the summary).

Structs§

Admin
The administration app’s state, manifests, hooks, widget kinds and value layers.
AdminPlugin
The plugin: the admin service, its commands, its setting and its overlay. Not in DefaultPlugins yet: the settings window keeps Ctrl+, until the migration.
ExtraScope
A value scope the host application declares above app (egui-pop has none of its own): its name, its label and what it means. A setting is app-wide unless its field opts into a declared scope (model::Field::scopes); the “Set for” choice shows only then.

Constants§

ADMIN
The service.
APP_WINDOW
The id of its application window (crate::windows), in the window mode: appWindow == 'settings' in when clauses, window: "settings" for agents, its size and place kept under it.
CMD_CLOSE
Closes it.
CMD_OPEN
Opens the administration app ({"path"}, {"key"}, {"mode"}).
CMD_POP_OUT
Moves it between the overlay and a window of its own.
CMD_RESET
Takes a value scope’s value of a setting back ({"key", "scope"}).
CMD_SET
Sets a setting’s value in a value scope ({"key", "scope", "value"}).
NAV_WIDTH
Where the width of the tree of sections is kept, in points (dragged, not typed: no setting of its own in the settings).
NAV_WIDTH_DEFAULT
The tree’s width when none is kept.
OWNER
The plugin owning the Settings app (its window, its listeners).
SURFACE
The focus surface the pages are drawn in: its local scope is the settings’ history.
WINDOW
Whether it opens in a window of its own: the mode used last.
WINDOW_LISTENER
The Settings app’s listener on the bus’s pop.window.open and pop.window.close: the app is open while its window is, and its window closing closes the app, whoever asked (ADR 0029).

Functions§

focus_screen
Whether a wizard runs as a focus screen: the shell draws its title bar alone under it.
in_window
Whether it opens in a window of its own: never while a wizard runs as a focus screen (Admin::open_focus_wizard).
is_open
Whether the application’s administration app is open.
nav_width
The width of the tree of sections, as kept (the room in the page may hold it smaller).
scope_named
A value scope from its name (app, run or a host’s).
want_nav_width
Keeps the width of the tree of sections.

Type Aliases§

WidgetKindFn
A registered widget kind: draws a node of its kind with its options (the declared exception to “components never draw”).
WidgetSearchFn
A widget kind’s search: the items of a node of its kind matching the query (every word), each as its key and its title. The key is what scope/section/<key> lands on: the widget marks the item while its section shows (Admin::marked) and scrolls to it once (Admin::take_key).