refactor(NetworkVisualiser.vue): update physics simulation parameters and improve interface node positioning for better visualization
Some checks failed
CI / lint (push) Successful in 9m48s
CI / test-backend (pull_request) Successful in 5s
Build and Publish Docker Image / build (pull_request) Has been skipped
OSV-Scanner PR Scan / scan-pr (pull_request) Successful in 1m3s
Benchmarks / benchmark (push) Successful in 14m35s
Benchmarks / benchmark (pull_request) Successful in 14m35s
CI / lint (pull_request) Successful in 9m40s
CI / build-frontend (pull_request) Successful in 9m40s
CI / test-lang (pull_request) Successful in 9m37s
Build and Publish Docker Image / build-dev (pull_request) Successful in 12m39s
Tests / test (push) Failing after 23m47s
Build Test / Build and Test (push) Failing after 26m34s
CI / test-backend (push) Successful in 4s
Tests / test (pull_request) Failing after 16m19s
Build Test / Build and Test (pull_request) Failing after 5m56s
CI / build-frontend (push) Successful in 9m46s
CI / test-lang (push) Successful in 9m42s

This commit is contained in:
2026-01-03 21:53:57 -06:00
parent 44c263ba96
commit 7bd681e217

View File

@@ -637,15 +637,15 @@ export default {
enabled: this.enablePhysics,
solver: "barnesHut",
barnesHut: {
gravitationalConstant: -8000,
springConstant: 0.04,
springLength: 150,
damping: 0.09,
avoidOverlap: 0.5,
gravitationalConstant: -10000,
springConstant: 0.02,
springLength: 200,
damping: 0.4,
avoidOverlap: 1,
},
stabilization: {
enabled: true,
iterations: 100,
iterations: 150,
updateInterval: 25,
},
},
@@ -763,6 +763,8 @@ export default {
title: `Local Node: ${meLabel}\nIdentity: ${this.config?.identity_hash ?? "Unknown"}`,
color: { border: "#3b82f6", background: isDarkMode ? "#1e40af" : "#eff6ff" },
font: { color: fontColor, size: 16, bold: true },
x: 0,
y: 0,
};
this.nodes.update([meNode]);
processedNodeIds.add("me");
@@ -771,13 +773,22 @@ export default {
// Add interfaces
const interfaceNodes = [];
const interfaceEdges = [];
for (const entry of this.interfaces) {
const interfaceCount = this.interfaces.length;
const radius = 400; // Start interfaces at 400px from center
for (let idx = 0; idx < interfaceCount; idx++) {
const entry = this.interfaces[idx];
let label = entry.interface_name ?? entry.name;
if (entry.type === "LocalServerInterface" || entry.parent_interface_name != null) {
label = entry.name;
}
if (matchesSearch(label) || matchesSearch(entry.name)) {
// Distribute interfaces in a circle
const angle = (idx / interfaceCount) * 2 * Math.PI;
const initialX = Math.cos(angle) * radius;
const initialY = Math.sin(angle) * radius;
interfaceNodes.push({
id: entry.name,
group: "interface",
@@ -793,6 +804,8 @@ export default {
background: isDarkMode ? "#064e3b" : "#ecfdf5",
},
font: { color: fontColor, size: 12, bold: true },
x: initialX,
y: initialY,
});
processedNodeIds.add(entry.name);
@@ -847,12 +860,32 @@ export default {
}
const conversation = this.conversations[announce.destination_hash];
const interfaceNode = this.nodes.get(entry.interface);
let initX = 0,
initY = 0;
if (interfaceNode && interfaceNode.x !== undefined) {
// Place around their parent interface with some randomness to avoid stacking
const angle = Math.random() * 2 * Math.PI;
const dist = 150 + Math.random() * 150;
initX = interfaceNode.x + Math.cos(angle) * dist;
initY = interfaceNode.y + Math.sin(angle) * dist;
} else {
// Fallback far from center
const angle = Math.random() * 2 * Math.PI;
const dist = 600 + Math.random() * 200;
initX = Math.cos(angle) * dist;
initY = Math.sin(angle) * dist;
}
const node = {
id: entry.hash,
group: "announce",
size: 25,
_announce: announce,
font: { color: fontColor, size: 11 },
x: initX,
y: initY,
};
node.label = displayName;