diff --git a/bin/dnetview/src/ui.rs b/bin/dnetview/src/ui.rs index 99b72eda3..8a399dd4c 100644 --- a/bin/dnetview/src/ui.rs +++ b/bin/dnetview/src/ui.rs @@ -33,7 +33,13 @@ pub fn ui(f: &mut Frame<'_, B>, mut view: View) { // // 2. Fix error whereby duplicates outbounds are being printed (nested loop) Some(node) => { + // create the title + if !node.outbound.is_empty() { + lines.push(Spans::from(Span::styled(" Outgoing", Style::default()))); + data.push("Outgoing".to_string()); + } for outbound in &node.outbound.clone() { + debug!("{:?}", outbound); if outbound.is_empty == false { for slot in outbound.slots.clone() { let addr = Span::styled(format!(" {}", slot.addr), style); @@ -54,12 +60,13 @@ pub fn ui(f: &mut Frame<'_, B>, mut view: View) { } } } - //debug!("{:?}", &node.inbound); + // create the title + if !node.inbound.is_empty() { + lines.push(Spans::from(Span::styled(" Incoming", Style::default()))); + data.push("Incoming".to_string()); + } for inbound in &node.inbound { - //debug!("{:?}", inbound); if inbound.is_empty == false { - lines.push(Spans::from(Span::styled(" Incoming", Style::default()))); - data.push("Incoming".to_string()); let addr = Span::styled(format!(" {}", inbound.connected), style); data.push(format!("{}", inbound.connected)); let msg: Span = match inbound.channel.last_status.as_str() { @@ -77,9 +84,12 @@ pub fn ui(f: &mut Frame<'_, B>, mut view: View) { lines.push(Spans::from(vec![addr, msg])); } } - for connect in &node.manual { + // create the title + if !node.manual.is_empty() { lines.push(Spans::from(Span::styled(" Manual", Style::default()))); data.push("Manual".to_string()); + } + for connect in &node.manual { lines.push(Spans::from(Span::styled(format!(" {}", connect.key), style))); data.push(format!("{}", connect.key)); } @@ -90,7 +100,7 @@ pub fn ui(f: &mut Frame<'_, B>, mut view: View) { } } - //debug!("{:?}", data); + debug!("{:?}", data); let ids = ListItem::new(lines); nodes.push(ids); }