Browse Source

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.
lunar-mining 3 years ago
parent
commit
75cbdeca86
3 changed files with 4 additions and 10 deletions
  1. 2 3
      bin/dnetview/src/model.rs
  2. 1 2
      bin/dnetview/src/parser.rs
  3. 1 5
      bin/dnetview/src/view.rs

+ 2 - 3
bin/dnetview/src/model.rs

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

+ 1 - 2
bin/dnetview/src/parser.rs

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

+ 1 - 5
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)));