Skip to main content

Module job_rows

Module job_rows 

Source
Expand description

Rows an application adds to the jobs list: its own row sources.

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

egui-pop’s jobs list shows the jobs the host publishes on pop.job.event (crate::jobs). An application whose background work is not a job of that kind (promises it waits on, links to other machines, things it keeps an eye on) declares a row source: a named set of rows it keeps up to date on the bus (pop.jobs.rows, the whole set each time; pop.jobs.source.drop to take it away). The list merges them with its own jobs, and a filter shows some sources and some states only (RowFilter).

A row says what the list draws: its title, its state (RowState), its progress when it knows it, a detail line (also its tooltip), a registry symbol (JobBadge), the group it sits under, and its actions (RowAction: cancel, retry, open), each a command the list runs with the action’s arguments.

use egui_pop_model::job_rows::{JobRow, RowAction, RowActionKind, RowState};
use serde_json::json;

let row: JobRow = serde_json::from_value(json!({
    "id": "sync-nas",
    "title": "Sync with the NAS",
    "state": "waiting",
    "detail": "The NAS is asleep",
    "badge": { "icon": "phosphor:hard-drives", "tip": "On the NAS" },
    "group": "Nodes",
    "actions": [{ "kind": "retry", "command": "nodes.wake", "args": { "node": "nas" } }],
}))
.unwrap();
assert_eq!(row.state, RowState::Waiting);
assert!(row.state.active());
assert_eq!(row.actions[0], RowAction::new(RowActionKind::Retry, "nodes.wake").args(json!({ "node": "nas" })));

Structs§

JobRow
One row of a source.
RowAction
An action a row offers: a button that runs command with args. Its label is the kind’s (“Cancel”, “Retry”, “Open”) unless title says otherwise.
RowFilter
What the list shows: every source but the hidden ones, in the states the state filter admits.
RowSource
A source as the list keeps it: its id, its title (the filter’s label), who declared it, and its rows.

Enums§

RowActionKind
What a row’s action does, for its label and its order.
RowState
Where a row is.
StateFilter
Which states the list shows.

Constants§

OWN_SOURCE
The source id of egui-pop’s own jobs, the ones published on pop.job.event, as the filter names them.