Handle cases where the field isn't present in network.json for backwards compatibility.

This commit is contained in:
Herbert Wolverson committed 2023-04-24 13:48:19 +00:00
1 parent 629ebb0293
commit 36440bdd9c
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -48,7 +48,7 @@ impl NetworkJsonNode {
rtts: self.rtts.iter().map(|n| *n as f32 / 100.0).collect(), rtts: self.rtts.iter().map(|n| *n as f32 / 100.0).collect(),
parents: self.parents.clone(), parents: self.parents.clone(),
immediate_parent: self.immediate_parent, immediate_parent: self.immediate_parent,
node_type: String::new(), node_type: None,
} }
} }
} }
@@ -72,7 +72,7 @@ pub struct NetworkJsonTransport {
pub immediate_parent: Option<usize>, pub immediate_parent: Option<usize>,
/// The type of node (site, ap, etc.) /// The type of node (site, ap, etc.)
#[serde(rename = "type")] #[serde(rename = "type")]
pub node_type: String, pub node_type: Option<String>,
} }
/// Holder for the network.json representation. /// Holder for the network.json representation.
@@ -96,7 +96,7 @@ pub fn get_top_n_root_queues(n_queues: usize) -> BusResponse {
rtts: Vec::new(), rtts: Vec::new(),
parents: Vec::new(), parents: Vec::new(),
immediate_parent: None, immediate_parent: None,
node_type: String::new(), node_type: None,
}, },
)); ));
} }