diff --git a/src/app.rs b/src/app.rs index 0182d15..12d9049 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2,10 +2,10 @@ use std::time::{Duration, Instant}; -use eframe::egui::{self, RichText}; +use eframe::egui::{self, RichText, Vec2}; use vidya::{ - apply, body, card, central_page, compact_card, dim_label, grid_cols, lead_trail, title, - title_2, ColSpec, Theme, + apply, body, card, central_page, compact_card, dim_label, grid_cols, grid_cols_with, + lead_trail, title, title_2, ColSpec, GridOpts, Theme, }; use crate::gauge::{arc_gauge, heat_color, mini_bar, PeakScale}; @@ -231,7 +231,8 @@ impl UsageApp { fn anomaly_section(&self, ui: &mut egui::Ui, th: &Theme) { let read = &self.disk_read_anomalies; let write = &self.disk_write_anomalies; - const CARD_W: f32 = 340.0; + // Wide enough for Process (flex) + Time (fixed stamp) + Usage (MetricBps). + const CARD_W: f32 = 450.0; let has_read = !read.is_empty(); let has_write = !write.is_empty(); @@ -433,11 +434,18 @@ fn gauge_tile( /// Abnormal I/O list via vidya grid DSL. fn anomaly_table(ui: &mut egui::Ui, th: &Theme, hits: &[AnomalyHit], id: &str) { - grid_cols( + // Pin Time to stamp width so Process flex absorbs leftover (avoids equal-flex + // squeeze that jammed names against timestamps). + let time_w = th.type_scale.caption * 0.65 * 11.0 + th.spacing.md; + grid_cols_with( ui, th, id, - &[ColSpec::Flex, ColSpec::Flex, ColSpec::MetricBps], + &[ColSpec::Flex, ColSpec::Fixed(time_w), ColSpec::MetricBps], + GridOpts { + striped: true, + spacing: Vec2::new(th.spacing.lg, 2.0), + }, |g| { g.row(|r| { r.heading("Process"); @@ -663,7 +671,8 @@ mod layout_dsl_consumer { #[test] fn anomaly_table_uses_grid_row_dsl() { let body = section(app_src(), "fn anomaly_table(", "\nfn truncate_chars("); - assert!(body.contains("grid_cols")); + assert!(body.contains("grid_cols_with") || body.contains("grid_cols")); + assert!(body.contains("ColSpec::Fixed")); assert!(body.contains(".warn(") || body.contains("r.warn")); assert!(body.contains("metric_bps")); }