Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ dash-TUI, in `crates/rocm-dash-tui/src/ui/`:
- **[`job_console.rs`](crates/rocm-dash-tui/src/ui/job_console.rs)**'s `draw_job_console`/`on_console_key` — the shared "a job is running" surface (streamed output, status header, Ctrl+C cancels/`q` always closes/Esc-Enter dismiss a finished job); every operational manager already routes through this instead of building its own console
- **[`spinner.rs`](crates/rocm-dash-tui/src/ui/spinner.rs)**'s `spinner_frame`/`parse_progress_pct` — the braille animation and percentage parsing `job_console.rs` renders with
- **[`panel.rs`](crates/rocm-dash-tui/src/ui/panel.rs)**'s `bento`/`popup` — bordered, titled panels; prefer these over an inline `Block::default()`. Popup geometry and framing live here too: `centered_rect`/`centered_width` size and place a popup, `draw_popup_frame` clears and frames it, and `grey_overlay` dims the backdrop
- **[`theme.rs`](crates/rocm-dash-tui/src/ui/theme.rs)**'s `StatusTone` and `Theme::tone_color` — the shared status→color mapping. A status enum gets one exhaustive `fn …_tone(status) -> StatusTone` beside them (`job_status_tone`, `instance_status_tone`) and a `Theme::…_color` wrapper (`job_status_color`, `instance_status_color`); screens call the wrapper (or `tone_color(…)` on a tone) instead of an inline `match … => theme.ok/warn/err`. `BoxRole::from_tone` in [`panel.rs`](crates/rocm-dash-tui/src/ui/panel.rs) derives a card border from the same tone. To color a new status enum, add its tone function there rather than a bespoke match per screen
- **[`theme.rs`](crates/rocm-dash-tui/src/ui/theme.rs)**'s `StatusTone` and `Theme::tone_color` — the shared status→color mapping. A status enum gets one exhaustive `fn …_tone(status) -> StatusTone` beside them (`job_status_tone`, `instance_status_tone`) and a `Theme::…_color` wrapper (`job_status_color`, `instance_status_color`); screens call the wrapper (or `tone_color(…)` on a tone) instead of an inline `match … => theme.ok/warn/err`. To color a new status enum, add its tone function there rather than a bespoke match per screen
- **[`widgets.rs`](crates/rocm-dash-tui/src/ui/widgets.rs)**'s `apply_char_key`/`apply_char_key_filtered` — the append-only text-field edit (`Char` appends, `Backspace` pops one char); call it from a form's key handler instead of writing another `push`/`pop` match arm. The `_filtered` form takes a predicate to refuse some chars (a digits-only port); there is no cursor or mid-string editing. The Chat tab's input is the one exception: its keys are first mapped to a `KeyAction` by the pure, separately tested table in [`actions.rs`](crates/rocm-dash-tui/src/app/actions.rs), which also applies them

**Two different components are both informally "the spinner"; they are not interchangeable.** The CLI's [`cli_progress.rs`](apps/rocm/src/cli_progress.rs) `Spinner`/`AnimatedSpinner` above is TTY/stderr-gated for a plain terminal and lives in `apps/rocm`. The dash-TUI's [`spinner.rs`](crates/rocm-dash-tui/src/ui/spinner.rs) above is a pure frame/percentage helper rendered through `job_console.rs` inside a ratatui frame loop, and lives in `crates/rocm-dash-tui`. A dash-TUI screen needs the latter.
Expand Down
5 changes: 3 additions & 2 deletions crates/rocm-dash-daemon/src/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ struct ContainerSpec {
tp: u32,
port: u16,
/// Phase of the activity sinusoid in seconds — staggers the three
/// instances so the heatmap and per-GPU sparklines aren't synchronised.
/// instances so their curves in the Observe table (throughput, queue,
/// kv-cache) and the per-GPU utilization sparklines aren't synchronised.
phase_s: f64,
/// Mean kv-cache utilization (0..100) around which it oscillates.
kv_mean: f32,
Expand All @@ -199,7 +200,7 @@ struct ContainerSpec {
req_mean: u32,
/// Quantization label shown in the detail modal.
quantization: Option<&'static str>,
/// Launch args excerpt rendered in the instance card / detail modal.
/// Launch args excerpt rendered in the instance detail modal.
launch_args: &'static [&'static str],
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rocm-dash-tui/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub struct AppState {
/// Whether the active domain tab's focus is on the Actions list or the
/// Details pane. `→`/Enter moves focus into Details; `←`/Esc returns to it.
pub pane_focus: PaneFocus,
/// Cursor into the sorted Instances grid.
/// Cursor into the sorted Instances table.
pub instance_sel: usize,
/// Cursor into the bench_rows VecDeque (0 = oldest, len-1 = newest).
pub bench_sel: usize,
Expand Down
32 changes: 1 addition & 31 deletions crates/rocm-dash-tui/src/ui/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@ pub fn pct(value: f32) -> String {
}
}

/// `Option<f32>` percentage → `-` when None.
pub fn pct_opt(value: Option<f32>) -> String {
match value {
Some(v) => pct(v),
None => "-".to_string(),
}
}

/// SI-suffixed number: 1234 → "1.23 k", 1_234_567 → "1.23 M".
/// Below 1000 returns the raw integer with no suffix.
pub fn si(value: f64) -> String {
Expand Down Expand Up @@ -201,15 +193,6 @@ pub fn duration(seconds: f64) -> String {
}
}

/// Request counter rendered with SI suffix for big numbers and `-` for None.
pub fn reqs_opt(value: Option<u32>) -> String {
match value {
Some(v) if v >= 1_000 => si(f64::from(v)),
Some(v) => v.to_string(),
None => "-".to_string(),
}
}

/// Power in watts. One decimal, always trailing `W`.
pub fn watts(value: f32) -> String {
format!("{value:.1} W")
Expand Down Expand Up @@ -262,7 +245,7 @@ pub fn gen_tps_cell(tps: Option<f64>, obs: Option<&ObservationMetadata>) -> Stri
}
}

/// Full-unit gen_tps for cards, pane rows, and services views.
/// Full-unit gen_tps for pane rows and services views.
/// Mirrors [`tps_opt`] format and appends [`HELD_MARKER`] when metadata is Held.
///
/// - `None` → `"-"`
Expand Down Expand Up @@ -514,12 +497,6 @@ mod tests {
assert_eq!(pct(100.0), "100.0%");
}

#[test]
fn pct_opt_handles_none() {
assert_eq!(pct_opt(None), "-");
assert_eq!(pct_opt(Some(75.0)), "75.0%");
}

#[test]
fn si_scales_into_k_m_b() {
assert_eq!(si(0.0), "0");
Expand Down Expand Up @@ -586,13 +563,6 @@ mod tests {
assert_eq!(duration(3700.0), "1h 1m 40s");
}

#[test]
fn reqs_opt_collapses_big_counts() {
assert_eq!(reqs_opt(None), "-");
assert_eq!(reqs_opt(Some(5)), "5");
assert_eq!(reqs_opt(Some(12_000)), "12.00 k");
}

#[test]
fn watts_and_celsius_and_mhz() {
assert_eq!(watts(123.4), "123.4 W");
Expand Down
Loading
Loading