refactor(#2591): hivectl derives DagView label + roll-up state from nodes
hivectl/dag_progress.rs was reading the now-removed DagView.kind/state. Derive both from the node set via the shared DagView::rollup_state() + DagView::label() helpers (added to hive-sh4re). Timestamps are DateTime<Utc> now — elapsed calcs compare in unix seconds. Dropped the live step display (step left the wire). Test fixtures updated to the slim shape.
This commit is contained in:
parent
52dd9ede23
commit
33c3fb3b34
2 changed files with 71 additions and 60 deletions
|
|
@ -192,4 +192,32 @@ impl DagView {
|
|||
State::Done
|
||||
}
|
||||
}
|
||||
|
||||
/// A short human label for the DAG, derived from its node kinds — the
|
||||
/// shared replacement for the old `Template` wire string now that the kind
|
||||
/// isn't sent. Priority-ordered so the most distinctive node wins (an
|
||||
/// approval deploy reads as "deploy" even though it also rebuilds). Purely
|
||||
/// cosmetic (progress/queue display); consumers that need exactness inspect
|
||||
/// the node kinds directly.
|
||||
#[must_use]
|
||||
pub fn label(&self) -> &'static str {
|
||||
let has = |k: &str| self.nodes.iter().any(|n| n.kind == k);
|
||||
if has("approval_deploy") {
|
||||
"deploy"
|
||||
} else if has("meta_lock") {
|
||||
"meta-update"
|
||||
} else if has("create") || has("provision") {
|
||||
"spawn"
|
||||
} else if has("swap") || has("prebuild") || has("post_swap") {
|
||||
"rebuild"
|
||||
} else if has("write_perm_file") {
|
||||
"perm-change"
|
||||
} else if has("signal") || has("drain") {
|
||||
"graceful"
|
||||
} else if has("set_wanted") || has("stop_for_update") {
|
||||
"power"
|
||||
} else {
|
||||
"reconcile"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue