Skip to content

Commit

Permalink
added wireless to filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Hall authored and Brian Hall committed Jan 1, 2025
1 parent 5a68e74 commit 81e7d06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/components/Filters/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const labels = [
"linkNYC 5G",
"sector",
"fiber",
"wireless",
"VPN"
];

Expand Down
12 changes: 8 additions & 4 deletions src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const kiosks5g = kiosks.filter(kiosk => kiosk.type.toLowerCase().includes("5g"))
const kiosksClassic = kiosks.filter(kiosk => !kiosk.type.toLowerCase().includes("5g"));
let vpnCounter = 0;
let fiberCounter = 0;
let activeCounter = 0;

const initialFilters = {
remote: true,
Expand All @@ -20,7 +21,7 @@ const initialFilters = {
"potential-supernode": true,
sector: true,
VPN: false,
vpnCount: 6,
wireless: true,
backbone: false,
changelog: false
};
Expand All @@ -40,7 +41,7 @@ const reducer = (
kiosks5g: initialFilters["linkNYC 5G"] === false ? [] : kiosks5g,
nodesById,
filters: initialFilters,
statusCounts: getCounts(nodes, kiosksClassic, kiosks5g, vpnCounter, fiberCounter),
statusCounts: getCounts(nodes, kiosksClassic, kiosks5g, vpnCounter, fiberCounter, activeCounter),
showFilters: false
},
action
Expand Down Expand Up @@ -92,7 +93,9 @@ function addGraphData(nodes, links, sectors) {
if (link.status === "vpn") {
vpnCounter++;
} else if (link.status === "fiber") {
fiberCounter++;
vpnCounter++;
} else if (link.status === "active") {
activeCounter++;
}
});

Expand Down Expand Up @@ -162,7 +165,7 @@ function addGraphData(nodes, links, sectors) {
return { nodes, links, sectors, nodesById };
}

function getCounts(nodes, kiosksClassic, kiosks5g, vpnCount, fiberCount) {
function getCounts(nodes, kiosksClassic, kiosks5g, vpnCount, fiberCount, activeCount) {
const counts = {};
nodes.forEach(node => {
const { type } = node;
Expand All @@ -176,6 +179,7 @@ function getCounts(nodes, kiosksClassic, kiosks5g, vpnCount, fiberCount) {
counts["linkNYC 5G"] = kiosks5g.length;
counts["VPN"] = vpnCount;
counts["fiber"] = fiberCount;
counts["wireless"] = activeCount;
return counts;
}

Expand Down

0 comments on commit 81e7d06

Please sign in to comment.