Skip to main content

Module notice

Module notice 

Source
Expand description

Notices: one message for people (an error, a warning, a success, a piece of information, a question), raised once and shown by whichever views an application’s policy picks.

A Notice is plain data, without egui: a headless process (a background service, a node on another machine) raises the same fact an interface does. It is said on the bus as pop.notice.raised (points::RAISED); a condition that ends is said as pop.notice.resolved, a notice read as pop.notice.seen and one put away by the user as pop.notice.dismissed, each a NoticeIds. NoticeStore keeps the last notices raised, bounded.

use egui_pop_model::notice::{Notice, Origin, Severity};

let n = Notice::error("cloudy was not added")
    .reason("The network found no route to it.")
    .hint("Check that cloudy is on and on the same network.")
    .details("cannot enrol with cloudy: connect: No route to host (os error 113)")
    .origin(Origin::User)
    .subject("node:cloudy")
    .place("settings/storage/nodes")
    .action("nodes.add", "Try again");
assert_eq!(n.severity, Severity::Error);
assert_eq!(n.actions[0].label, "Try again");

The JSON shape is stable: fields are added, never renamed, and VERSION (v) rises when a field changes meaning. Empty fields are left out.

Experimental: may change in any release (docs/stability.md).

Modules§

points
The bus points of notices, by name (egui-pop declares them; a process without egui-pop publishes on them by these names).
route
Routing: which views show a notice.

Structs§

Kept
A notice as the store keeps it: whether it was seen, and for a condition whether it was resolved.
Notice
One message for people: see the module.
NoticeAction
A button of a notice: the command or action it runs, by id, its label, and the arguments the command runs with (null, the default, for none): “Undo this restore”, “Show these photos”.
NoticeId
A notice’s id: unique in the process that raised it (n42); a notice from another node carries that node’s name before it (cloudy/n42).
NoticeIds
The notices a pop.notice.resolved, pop.notice.seen or pop.notice.dismissed names.
NoticeStore
The last notices raised, oldest first, at most NoticeStore::bound and none older than NoticeStore::max_age_ms, whichever keeps fewer: the oldest goes when a new one comes past the bound, and NoticeStore::prune drops the old ones. An error not seen yet stays until it is seen, past both. Seen and resolved notices are marked; dismissed ones leave.
NoticesDoc
The notices kept, as saved between sessions (the notices document, notices_schema): each notice with whether it was seen and resolved, the route each was given, and the next id.

Enums§

Kind
What kind of fact a notice is.
Origin
Where a notice comes from.
Severity
How serious a notice is.

Constants§

VERSION
The version of the notice’s JSON shape (v).

Functions§

notices_schema
The notices document’s schema: version 1; a document without a version has its shape.