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.
This commit is contained in:
lunar-mining
2023-08-02 12:42:24 +02:00
parent bfa6a9e3c5
commit 75cbdeca86
3 changed files with 4 additions and 10 deletions

View File

@@ -140,13 +140,12 @@ impl ConnectInfo {
pub struct LilithInfo {
pub id: String,
pub name: String,
pub urls: Vec<String>,
pub networks: Vec<NetworkInfo>,
}
impl LilithInfo {
pub fn new(id: String, name: String, urls: Vec<String>, networks: Vec<NetworkInfo>) -> Self {
Self { id, name, urls, networks }
pub fn new(id: String, name: String, networks: Vec<NetworkInfo>) -> Self {
Self { id, name, networks }
}
}

View File

@@ -209,7 +209,6 @@ impl DataParser {
reply: serde_json::Map<String, Value>,
name: String,
) -> DnetViewResult<()> {
let urls: Vec<String> = serde_json::from_value(reply.get("urls").unwrap().clone()).unwrap();
let spawns: Vec<serde_json::Map<String, Value>> =
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);

View File

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