From 40eaba17e0408e0136332cad51a8c5d58f4987d2 Mon Sep 17 00:00:00 2001 From: jamesgiu Date: Sun, 23 Nov 2025 23:06:58 +1100 Subject: [PATCH 1/4] QK-XX bump --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7639ab6..a028f99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "qk" -version = "0.1.4" +version = "0.1.8" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From e34b0fe7c2affa8c999507a8d2cc4d20b132affc Mon Sep 17 00:00:00 2001 From: jamesgiu Date: Sat, 10 Jan 2026 00:45:31 +1100 Subject: [PATCH 2/4] QK-XX random % chart --- Cargo.toml | 5 +++-- src/gui.rs | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a028f99..18a0550 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] crossterm = "0.27.0" -ratatui = "0.26.2" +ratatui = "0.29" regex = "1.8.4" config = "0.14.0" strum = "0.26.2" @@ -15,6 +15,7 @@ color-eyre = "0.6.3" clap = { version = "4.5.4", features = ["derive"] } rand = "0.9.0" thiserror = "2.0.12" +tui-piechart = "0.2.8" [dev-dependencies] -assert_cmd = "2" \ No newline at end of file +assert_cmd = "2" diff --git a/src/gui.rs b/src/gui.rs index f12ee30..e3b875b 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -5,13 +5,15 @@ use crossterm::{event, execute}; use crossterm::terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}; use rand::Rng; use ratatui::backend::{Backend, CrosstermBackend}; +use ratatui::style::palette::tailwind; use ratatui::text::{Line, Span}; use ratatui::{Frame, Terminal}; use ratatui::layout::{Constraint, Layout, Rect}; use ratatui::prelude::Stylize; use ratatui::style::{Color, Style}; use color_eyre::eyre::{Result}; -use ratatui::widgets::{Block, Clear, Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState, Wrap}; +use ratatui::widgets::{Block, Clear, Gauge, Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState, Widget, Wrap}; +use tui_piechart::{PieChart, PieSlice}; use crate::kubectl::{self, FoundPod, KubectlRunnerAgent, get_pod_status}; use crate::cli::{self}; @@ -306,6 +308,40 @@ fn ui(f: &mut Frame, app: &mut App, text: &str) { .wrap(Wrap { trim: true }); f.render_widget(paragraph, chunks[1]); + + if app.last_action == Some(InternalAction::World) { + let vertical_chunks = Layout::vertical([ + Constraint::Percentage(5), + Constraint::Percentage(90), + Constraint::Percentage(5), + ]) + .split(size); + + let horiz_chunks = Layout::horizontal([ + Constraint::Percentage(60), + Constraint::Percentage(40), + ]) + .split(vertical_chunks[1]); + + // Do really bad way of counting by coutning substr matches + let total_pods: f64 = text.lines().count() as f64; + let running_pods: f64 = text.matches("🏃").count() as f64; + let starting_pods: f64 = text.matches("✨️").count() as f64; + // Create slices + let slices = vec![ + PieSlice::new("Failed", (((&total_pods - (&starting_pods + &running_pods)) / &total_pods) * 100.0) + 0.0001, Color::Red), + PieSlice::new("Starting", ((&starting_pods / &total_pods) * 100.0) + 0.001, Color::Blue), + PieSlice::new("Running", ((&running_pods / &total_pods) * 100.0) + 0.001, Color::Green), + ]; + + let piechart = PieChart::new(slices) + .show_legend(true) + .show_percentages(true); + + f.render_widget(Block::new(), vertical_chunks[0]); + f.render_widget(piechart, horiz_chunks[1]); + } + f.render_stateful_widget( Scrollbar::new(ScrollbarOrientation::VerticalRight) .begin_symbol(Some("↑")) From 1e217d8f08cbc4c7f973fc4e34df459ee3cee3a2 Mon Sep 17 00:00:00 2001 From: jamesgiu Date: Sat, 24 Jan 2026 22:43:52 +1100 Subject: [PATCH 3/4] QK-?? pie chart --- src/gui.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gui.rs b/src/gui.rs index e3b875b..9eca039 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -46,6 +46,7 @@ struct App { pub horizontal_scroll: usize, pub show_pod_deleted_pop_up: bool, pub show_switch_error_text: bool, + pub show_pie_chart_for_running_pods: bool, pub new_pod_search_pop_up: bool, pub input_text: String, pub target_pod: FoundPod, @@ -206,11 +207,13 @@ fn run_app( KeyCode::Char('w') => { text = kubectl::get_pods(&runner, &app.target_pod).unwrap(); app.vertical_scroll = 0; + app.show_pie_chart_for_running_pods = true; app.last_action = Some(InternalAction::World); }, KeyCode::Char('W') => { text = kubectl::get_all(&runner, &app.target_pod).unwrap(); app.vertical_scroll = 0; + app.show_pie_chart_for_running_pods = false; app.last_action = Some(InternalAction::World); }, KeyCode::Char('e') => { @@ -309,11 +312,11 @@ fn ui(f: &mut Frame, app: &mut App, text: &str) { f.render_widget(paragraph, chunks[1]); - if app.last_action == Some(InternalAction::World) { + if app.last_action == Some(InternalAction::World) && app.show_pie_chart_for_running_pods == true { let vertical_chunks = Layout::vertical([ - Constraint::Percentage(5), - Constraint::Percentage(90), - Constraint::Percentage(5), + Constraint::Percentage(20), + Constraint::Percentage(60), + Constraint::Percentage(20), ]) .split(size); From b59029f6e733d432c53ccd132c8a3675bc370bec Mon Sep 17 00:00:00 2001 From: jamesgiu Date: Sat, 24 Jan 2026 22:44:22 +1100 Subject: [PATCH 4/4] QK-XX Bump qk vers --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 18a0550..72513c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "qk" -version = "0.1.8" +version = "0.1.9" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html