From 826760bcf644d9d507820a7397c83552dd1760e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20H=C3=A5kansson?= Date: Wed, 11 Mar 2026 10:16:04 +0100 Subject: [PATCH] Sort indicator Added * as a way to indicate which sorting column is currently active since it was sort of confusing. This was just tested locally. --- src/ui/app/render_loop.rs | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/ui/app/render_loop.rs b/src/ui/app/render_loop.rs index 949dca4..4f5344d 100644 --- a/src/ui/app/render_loop.rs +++ b/src/ui/app/render_loop.rs @@ -616,7 +616,6 @@ impl App { .style(severity_style(&theme, sev)) }) .collect(); - let table = Table::new( rows, [ @@ -628,8 +627,30 @@ impl App { ], ) .header( - Row::new(vec!["Namespace", "Name", "Status", "Age", "Summary"]) - .style(theme.table_header), + Row::new(vec![ + label_with_sort_marking( + "Namespace".to_string(), + SortColumn::Namespace, + &active.sort, + ), + label_with_sort_marking( + "Name".to_string(), + SortColumn::Name, + &active.sort, + ), + label_with_sort_marking( + "Status".to_string(), + SortColumn::Status, + &active.sort, + ), + label_with_sort_marking( + "Age".to_string(), + SortColumn::Age, + &active.sort, + ), + "Summary".to_string(), + ]) + .style(theme.table_header), ) .block(Block::default().borders(Borders::ALL).title(format!( "[KIND] {} ({})", @@ -1028,3 +1049,11 @@ impl App { items.join(" | ") } } + +fn label_with_sort_marking(s: String, column: SortColumn, current: &SortColumn) -> String { + if column == *current { + format!("{}*", s) + } else { + s + } +}