dnetview/ view: fixed bug wherein list had empty spaces

This commit is contained in:
lunar-mining
2022-04-30 10:50:23 +02:00
parent eb25d9a382
commit e6b88ec99a

View File

@@ -84,28 +84,30 @@ impl View {
let names = ListItem::new(lines);
nodes.push(names);
for connection in &session.children {
let mut lines: Vec<Spans> = Vec::new();
let mut info = Vec::new();
let name = Span::styled(format!(" {}", connection.addr), style);
info.push(name);
match connection.last_status.as_str() {
"recv" => {
let msg = Span::styled(
format!(" [R: {}]", connection.last_msg),
style,
);
lines.push(Spans::from(vec![name, msg]));
info.push(msg);
}
"sent" => {
let msg = Span::styled(
format!(" [S: {}]", connection.last_msg),
style,
);
lines.push(Spans::from(vec![name, msg]));
info.push(msg);
}
_ => {
// TODO
}
}
let lines = vec![Spans::from(info)];
let names = ListItem::new(lines);
nodes.push(names);
}
@@ -119,6 +121,9 @@ impl View {
.constraints(list_cnstrnts)
.split(f.size());
debug!("NODE INFO LENGTH {:?}", nodes.len());
debug!("ACTIVE IDS LENGTH {:?}", self.active_ids.ids.len());
let nodes =
List::new(nodes).block(Block::default().borders(Borders::ALL)).highlight_symbol(">> ");