tui: Add a fwd column with a ✓ to show that ports are being forwarded

I didn't realize that everything was forwarded by default, this makes it more
obvious.
This commit is contained in:
Brandon W Maister 2023-02-18 14:04:56 -08:00 committed by John Doty
parent 7410ec5143
commit 381c008665

View file

@ -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)