mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2026-10-03 12:16:57 -05:00
Hotfix: handle node "type" entry
Adding "type" to `network.json` is awesome, but it broke a bit of Rust. This patch adds support for the `type` field, and fixes a rare "none" issue that mostly seems to affect my UISP setup.
This commit is contained in:
1 parent
125ef55e35
commit
629ebb0293
3 files changed
+6
-1
No files matched your search
@@ -285,7 +285,7 @@ def handleMultipleInternetNodes(sites, dataLinks, uispSite):
|
|||||||
internetConnectedSites = []
|
internetConnectedSites = []
|
||||||
for link in dataLinks:
|
for link in dataLinks:
|
||||||
if link['canDelete'] == False:
|
if link['canDelete'] == False:
|
||||||
if link['from']['device']['identification']['id'] == link['to']['device']['identification']['id']:
|
if link['from']['device'] is not None and link['to']['device'] is not None and link['from']['device']['identification']['id'] == link['to']['device']['identification']['id']:
|
||||||
siteID = link['from']['site']['identification']['id']
|
siteID = link['from']['site']['identification']['id']
|
||||||
# Found internet link
|
# Found internet link
|
||||||
internetConnectedSites.append(siteID)
|
internetConnectedSites.append(siteID)
|
||||||
|
|||||||
@@ -48,6 +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(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,6 +70,9 @@ pub struct NetworkJsonTransport {
|
|||||||
pub parents: Vec<usize>,
|
pub parents: Vec<usize>,
|
||||||
/// The immediate parent node in the tree
|
/// The immediate parent node in the tree
|
||||||
pub immediate_parent: Option<usize>,
|
pub immediate_parent: Option<usize>,
|
||||||
|
/// The type of node (site, ap, etc.)
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
pub node_type: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Holder for the network.json representation.
|
/// Holder for the network.json representation.
|
||||||
|
|||||||
@@ -96,6 +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(),
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user