From 381c008665cf4089b4fd46a495f8d6a877a061a8 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Sat, 18 Feb 2023 14:04:56 -0800 Subject: [PATCH] =?UTF-8?q?tui:=20Add=20a=20`fwd`=20column=20with=20a=20?= =?UTF-8?q?=E2=9C=93=20to=20show=20that=20ports=20are=20being=20forwarded?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I didn't realize that everything was forwarded by default, this makes it more obvious. --- src/client/ui.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/ui.rs b/src/client/ui.rs index 3a1f3d4..e53efe7 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs @@ -248,6 +248,7 @@ impl UI { let listener = self.ports.get(&port).unwrap(); rows.push( Row::new(vec![ + if listener.enabled { " ✓ " } else { "" }, &port_strings[index][..], match &listener.desc { Some(port_desc) => &port_desc.desc, @@ -265,11 +266,14 @@ impl UI { // TODO: I don't know how to express the lengths I want here. // That last length is extremely wrong but guaranteed to work I // guess. - let widths = - vec![Constraint::Length(5), Constraint::Length(size.width)]; + let widths = vec![ + Constraint::Length(3), + Constraint::Length(5), + Constraint::Length(size.width), + ]; let port_list = Table::new(rows) - .header(Row::new(vec!["Port", "Description"])) + .header(Row::new(vec!["fwd", "Port", "Description"])) .block(Block::default().title("Ports").borders(Borders::ALL)) .column_spacing(1) .widths(&widths)