From 193a83b1d51c63e04cebababd1e5aa79ae8f7fa1 Mon Sep 17 00:00:00 2001 From: wisplite Date: Mon, 8 Sep 2025 14:45:17 -0500 Subject: [PATCH] add bulk node modal --- index.html | 8 ++++++++ script.js | 29 +++++++++++++++++++++++++++++ style.css | 27 +++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/index.html b/index.html index 584bdc0..db8f8c6 100644 --- a/index.html +++ b/index.html @@ -49,6 +49,7 @@ +
@@ -64,6 +65,13 @@
Incoming Connections
Outgoing Connections
+
+
+ + + +
+
diff --git a/script.js b/script.js index 5d1da9a..8d87d87 100644 --- a/script.js +++ b/script.js @@ -479,4 +479,33 @@ document.getElementById('maxOutgoingConnections').addEventListener('change', fun document.getElementById('maxIncomingConnections').addEventListener('change', function() { MAX_INCOMING_CONNECTIONS = parseInt(this.value); +}); + +document.getElementById('createRandomGraph').addEventListener('click', function() { + document.getElementById('randomGraphModal').style.display = 'block'; +}); + +document.getElementById('createRandomGraphConfirm').addEventListener('click', function() { + const nodeCount = parseInt(document.getElementById('randomGraphNodes').value); + network.setOptions({ + nodes: { + shape: 'box', + physics: true, + }, + }); + for (let i = 0; i < nodeCount; i++) { + const nodeId = generateRealisticLabel(); + nodes.add({id: nodeId, label: nodeId, x: Math.random() * 100, y: Math.random() * 100}); + nodeTable[nodeId] = {'incoming': [], 'outgoing': [], 'packetCache': []}; + } + + setTimeout(() => { + network.setOptions({ + nodes: { + shape: 'box', + physics: false, + } + }); + }, 2000); + document.getElementById('randomGraphModal').style.display = 'none'; }); \ No newline at end of file diff --git a/style.css b/style.css index 7095698..1eb3509 100644 --- a/style.css +++ b/style.css @@ -78,4 +78,31 @@ html, body { #simpleSettings, #hardwareConstraints, #engineSettings { margin-bottom: 10px; +} + +#randomGraphModal { + display: none; + position: absolute; + top: 0%; + left: 0%; + transform: translate(0%, 0%); + background-color: rgba(0, 0, 0, 0.5); + padding: 20px; + border: 1px solid #000; + width: 100%; + height: 100%; +} + +#randomGraphModalContent { + padding: 20px; + background-color: #fff; + border: 1px solid #000; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +#createRandomGraphConfirm { + margin-top: 10px; } \ No newline at end of file