From 75cbdeca860516042d171ad305a993f41f2151e2 Mon Sep 17 00:00:00 2001 From: lunar-mining Date: Wed, 2 Aug 2023 12:42:24 +0200 Subject: [PATCH] dnetview: update Lilith render to latest RPC API Lilith no longer returns a list of URLs in the top level json along with its own info, so we remove that from the view. We retain the list of URLs that are nested within NetworkInfo. --- bin/dnetview/src/model.rs | 5 ++--- bin/dnetview/src/parser.rs | 3 +-- bin/dnetview/src/view.rs | 6 +----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/bin/dnetview/src/model.rs b/bin/dnetview/src/model.rs index d64785c28..0f61a8400 100644 --- a/bin/dnetview/src/model.rs +++ b/bin/dnetview/src/model.rs @@ -140,13 +140,12 @@ impl ConnectInfo { pub struct LilithInfo { pub id: String, pub name: String, - pub urls: Vec, pub networks: Vec, } impl LilithInfo { - pub fn new(id: String, name: String, urls: Vec, networks: Vec) -> Self { - Self { id, name, urls, networks } + pub fn new(id: String, name: String, networks: Vec) -> Self { + Self { id, name, networks } } } diff --git a/bin/dnetview/src/parser.rs b/bin/dnetview/src/parser.rs index dbcb9504c..581491b0d 100644 --- a/bin/dnetview/src/parser.rs +++ b/bin/dnetview/src/parser.rs @@ -209,7 +209,6 @@ impl DataParser { reply: serde_json::Map, name: String, ) -> DnetViewResult<()> { - let urls: Vec = serde_json::from_value(reply.get("urls").unwrap().clone()).unwrap(); let spawns: Vec> = serde_json::from_value(reply.get("spawns").unwrap().clone()).unwrap(); @@ -225,7 +224,7 @@ impl DataParser { networks.push(network); } let id = make_node_id(&name)?; - let lilith = LilithInfo::new(id.clone(), name, urls, networks); + let lilith = LilithInfo::new(id.clone(), name, networks); let lilith_obj = SelectableObject::Lilith(lilith.clone()); self.model.selectables.lock().await.insert(id, lilith_obj); diff --git a/bin/dnetview/src/view.rs b/bin/dnetview/src/view.rs index cb443855d..55999f181 100644 --- a/bin/dnetview/src/view.rs +++ b/bin/dnetview/src/view.rs @@ -353,12 +353,8 @@ impl<'a> View { let text = self.parse_msg_list(connect.id.clone())?; f.render_stateful_widget(text, slice[1], &mut self.msg_list.state); } - Some(SelectableObject::Lilith(lilith)) => { + Some(SelectableObject::Lilith(_lilith)) => { lines.push(Spans::from(Span::styled("Type: Lilith", style))); - lines.push(Spans::from(Span::styled("URLs:", style))); - for url in &lilith.urls { - lines.push(Spans::from(Span::styled(format!(" {}", url), style))); - } } Some(SelectableObject::Network(network)) => { lines.push(Spans::from(Span::styled("URLs:", style)));