From 6557fc53e5b8641cc86dff2b1f644580d84ab7d1 Mon Sep 17 00:00:00 2001 From: logicog Date: Sun, 30 Nov 2025 22:24:56 +0100 Subject: [PATCH] Add LAG configuration web-page --- html/lag.html | 28 +++++++++++++++++ html/lag.js | 78 ++++++++++++++++++++++++++++++++++++++++++++++ html/navigation.js | 2 +- 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 html/lag.html create mode 100644 html/lag.js diff --git a/html/lag.html b/html/lag.html new file mode 100644 index 0000000..85c6dff --- /dev/null +++ b/html/lag.html @@ -0,0 +1,28 @@ + + + + + + Link Aggregation Configuration + + + +
+
+

Link Aggregation Groups Configuration

+

LAG 1

+
+
+

LAG 2

+
+
+

LAG 3

+
+
+

LAG 4

+
+ +
+ + + diff --git a/html/lag.js b/html/lag.js new file mode 100644 index 0000000..4006880 --- /dev/null +++ b/html/lag.js @@ -0,0 +1,78 @@ +var lagInterval = Number(); + +function lagForm() { + if (!numPorts) + return; + clearInterval(lagInterval); + for (let j=0; j < 4; j++) { + var lag = "mLAG" + j + console.log("Adding LAG " + lag) + var m = document.getElementById(lag); + for (let i = 1; i <= numPorts; i++) { + const d = document.createElement("div"); + d.classList.add("cbgroup"); + const l = document.createElement("label"); + l.innerHTML = "" + i; + l.classList.add("cbgroup"); + const inp = document.createElement("input"); + inp.type = "checkbox"; inp.setAttribute("class","psel"); + inp.id = "p_" + lag + "_" + i; + const o = document.createElement("img"); + if (pIsSFP[i - 1]) { + o.src = "sfp.svg"; o.width ="60"; o.height ="60"; + } else { + o.src = "port.svg"; o.width = "40"; o.height = "40"; + } + l.appendChild(inp); l.appendChild(o); + d.appendChild(l) + m.appendChild(d); + } + } + fetchLag(); +} + +function setL(p, c){ + console.log("LAG setting: ", p, " to ", c); + document.getElementById(p).checked=c; +} +window.addEventListener("load", function() { + lagInterval = setInterval(lagForm, 200); +}); + +function fetchLag() { + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + const s = JSON.parse(xhttp.responseText); + console.log("LAG: ", JSON.stringify(s)); + for (let l = 0; l < 4; l++) { + let members = parseInt(s[l].members, 2); + let hash = parseInt(s[l].hash, 16); + for (let i = 1; i <= numPorts; i++) { + let p = i - 1; + if (numPorts < 9) + p = physToLogPort[p]; + setL("p_mLAG"+l+"_"+i, members & (1<Port Statistics" + "
  • VLAN
  • " + "
  • Mirroring
  • " - + "
  • Port Aggregation
  • " + + "
  • Link Aggregation
  • " + "
  • EEE
  • " + "
  • System Settings
  • " + "
  • Firmware Update
  • ";