From 87717a0790f930102bfcf4ffe412ebb232eee418 Mon Sep 17 00:00:00 2001 From: logicog Date: Mon, 15 Dec 2025 08:08:00 +0100 Subject: [PATCH] Move drawing of ports into main.js This reduces the number of .js which are pulled by the browser when loading a http page, which should reduce the loading time. Also prepare for device-dependent logical to physical port mappings. --- html/eee.html | 1 - html/index.html | 1 - html/lag.html | 1 - html/main.js | 24 ++++++++++++++++++++++++ html/mirror.html | 1 - html/ports.js | 24 ------------------------ html/stat.html | 1 - html/vlan.html | 1 - 8 files changed, 24 insertions(+), 30 deletions(-) delete mode 100644 html/ports.js diff --git a/html/eee.html b/html/eee.html index d7c78c8..e5ec472 100644 --- a/html/eee.html +++ b/html/eee.html @@ -1,6 +1,5 @@ - EEE Configuration diff --git a/html/index.html b/html/index.html index 765f065..04532db 100644 --- a/html/index.html +++ b/html/index.html @@ -1,6 +1,5 @@ - diff --git a/html/lag.html b/html/lag.html index 85c6dff..29b2b66 100644 --- a/html/lag.html +++ b/html/lag.html @@ -1,6 +1,5 @@ - Link Aggregation Configuration diff --git a/html/main.js b/html/main.js index 5d5246e..415e9b5 100644 --- a/html/main.js +++ b/html/main.js @@ -6,6 +6,30 @@ const linkS = ["Disabled", "No Link", "100M", "1000M", "500M", "10G", "2.5G", "5 var pState = new Int8Array(10); var pIsSFP = new Int8Array(10); var numPorts = 0; +const logToPhysPort = [0, 0, 0, 5, 1, 2, 3, 4, 6]; +const physToLogPort = [ 4, 5, 6, 7, 3, 8]; + +function drawPorts() { + var f = document.getElementById('ports'); + console.log("DRAWING PORTS: ", numPorts); + for (let i = 0; i < numPorts; i++) { + console.log("DRAWING isSFP: ", pIsSFP[i]); + const l = document.createElement("object"); + l.type = "image/svg+xml"; + if (!pIsSFP[i]) { + l.data = "port.svg"; + l.width ="40"; + l.height ="40"; + } else { + l.data = "sfp.svg"; + l.width = "60"; + l.height = "60"; + } + l.id="port" + (i+1); + f.appendChild(l); + } + console.log("DRAWING DONE "); +} function update() { var xhttp = new XMLHttpRequest(); diff --git a/html/mirror.html b/html/mirror.html index 0b8ea8e..edf5b77 100644 --- a/html/mirror.html +++ b/html/mirror.html @@ -1,6 +1,5 @@ - Mirror Configuration diff --git a/html/ports.js b/html/ports.js deleted file mode 100644 index 0a2fe2a..0000000 --- a/html/ports.js +++ /dev/null @@ -1,24 +0,0 @@ -const logToPhysPort = [0, 0, 0, 5, 1, 2, 3, 4, 6]; -const physToLogPort = [ 4, 5, 6, 7, 3, 8]; - -function drawPorts() { - var f = document.getElementById('ports'); - console.log("DRAWING PORTS: ", numPorts); - for (let i = 0; i < numPorts; i++) { - console.log("DRAWING isSFP: ", pIsSFP[i]); - const l = document.createElement("object"); - l.type = "image/svg+xml"; - if (!pIsSFP[i]) { - l.data = "port.svg"; - l.width ="40"; - l.height ="40"; - } else { - l.data = "sfp.svg"; - l.width = "60"; - l.height = "60"; - } - l.id="port" + (i+1); - f.appendChild(l); - } - console.log("DRAWING DONE "); -} diff --git a/html/stat.html b/html/stat.html index 467f0bf..5cfaf05 100644 --- a/html/stat.html +++ b/html/stat.html @@ -1,6 +1,5 @@ - FreeSwitchOS Port Statistics diff --git a/html/vlan.html b/html/vlan.html index 8bc66f9..a3f91e0 100644 --- a/html/vlan.html +++ b/html/vlan.html @@ -1,6 +1,5 @@ - FreeSwitchOS VLAN Configuration