dashboard: tombstones + meta_inputs events — last /api/state refetches drop
new DashboardEvent::TombstonesChanged + MetaInputsChanged carry full snapshots (lists are tiny; snapshot beats diff for race avoidance). Coordinator-side helpers emit_tombstones_snapshot + emit_meta_inputs_snapshot fire from every mutation site: actions::destroy + post_purge_tombstone + actions::approve (spawn finalise consumes tombstone) + run_meta_update + auto_update::rebuild_agent (lock bumps). client adds derived stores + apply* handlers + drops the post-submit refetch on PURG3 (container row + tombstone row) and meta-update. after this commit /api/state is fetched exactly once per page session (cold load); every other change rides the SSE channel.
This commit is contained in:
parent
76e4034e01
commit
aed43ce4df
5 changed files with 123 additions and 24 deletions
|
|
@ -26,6 +26,7 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use crate::container_view::ContainerView;
|
||||
use crate::dashboard::{MetaInputView, TombstoneView};
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "snake_case", tag = "kind")]
|
||||
|
|
@ -156,4 +157,25 @@ pub enum DashboardEvent {
|
|||
/// `nixos-container destroy` (operator-driven or otherwise) on the
|
||||
/// next rescan.
|
||||
ContainerRemoved { seq: u64, name: String },
|
||||
/// Full snapshot of the tombstones list. Emitted on every
|
||||
/// mutation that could add / remove a tombstone: destroy
|
||||
/// (with or without purge), purge-tombstone, spawn approval
|
||||
/// (which can consume a tombstone of the same name). Snapshot
|
||||
/// shape (not diff) because the list is tiny (single-digit
|
||||
/// typical) and recomputing avoids the add/remove races a
|
||||
/// per-row event would have.
|
||||
TombstonesChanged {
|
||||
seq: u64,
|
||||
tombstones: Vec<TombstoneView>,
|
||||
},
|
||||
/// Full snapshot of `meta/flake.lock`'s root inputs. Emitted
|
||||
/// after every operation that bumps a lock: `meta-update`,
|
||||
/// `rebuild_agent` (lock bumps via two-phase staging),
|
||||
/// `update-all`. Same snapshot-shape rationale as
|
||||
/// `TombstonesChanged` — the list is small (one row per agent
|
||||
/// plus their fetched inputs).
|
||||
MetaInputsChanged {
|
||||
seq: u64,
|
||||
inputs: Vec<MetaInputView>,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue