refactor: set speed and state of the slowest link

main
Josue 4 years ago committed by Tsu-ba-me
parent 0386bf1b83
commit 84c46412d5
  1. 10
      striker-ui/components/processNetwork.ts

@ -13,6 +13,8 @@ const processNetworkData = (data: AnvilNetwork): ProcessedNetwork => {
displayBonds.bonds.push({
bond_name: bond.bond_name,
bond_uuid: bond.bond_uuid,
bond_speed: 0,
bond_state: 'degraded',
nodes: [
{
host_name: node.host_name,
@ -31,6 +33,14 @@ const processNetworkData = (data: AnvilNetwork): ProcessedNetwork => {
});
});
/* eslint-disable no-param-reassign */
displayBonds.bonds.forEach((bond) => {
const nodeIndex =
bond.nodes[0].link.link_speed > bond.nodes[1].link.link_speed ? 1 : 0;
bond.bond_speed = bond.nodes[nodeIndex].link.link_speed;
bond.bond_state = bond.nodes[nodeIndex].link.link_state;
});
return displayBonds;
};

Loading…
Cancel
Save