From 0a65536a7ffcc97f83bcba6b20b2be6f0acc4e5f Mon Sep 17 00:00:00 2001 From: bloqaudio Date: Fri, 18 Sep 2026 13:57:07 -0500 Subject: [PATCH] web: send an eee command in the documented argument order The EEE toggle posted `eee `, the reverse of the `eee [on|off|status] [port] [100m|1g|2g5]` the parser and the documentation describe, so the switch answered with its usage line and the checkbox sprang back. The multi-page UI this replaced sent `eee on` with no port at all, which toggled every port instead of one. Moving the port to the end breaks the stored-configuration merge, which builds its drop key as a line prefix: with the port trailing, a per-port line matches the bare eee entry and replaces every eee line in the configuration rather than the one for that port. Give the command its own case beside the bandwidth one, so a line with a port replaces only that port and a line without one clears them all, and accept the optional speed word the command has always taken. Reported by tofurky in issue #459. --- html/app.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/html/app.js b/html/app.js index 0a50b322..497a2ce9 100644 --- a/html/app.js +++ b/html/app.js @@ -434,7 +434,7 @@ var CONF_CMDS=[ /^ingress(\s+\d{1,2}[tua])+$/,/^ingress\s+[tua]$/, /^port\s+\d{1,2}\s+(10m|100m|1g|2g5|5g|10g|auto|on|off)(\s+(half|full))?$/, /^port\s+\d{1,2}\s+name\s+\S+$/, - /^eee(\s+\d{1,2})?\s+(on|off)$/, + /^eee\s+(on|off)(\s+\d{1,2})?(\s+(100m|1g|2g5))?$/, /^mirror(\s+\d{1,2})(\s+\d{1,2}[tr]?)+$/,/^mirror\s+off$/, /^lag\s+[1-4](\s+\d{1,2})+$/,/^lag\s+[1-4]\s+d$/,/^laghash\s+[1-4](\s+\w+)+$/, /^isolate\s+\d{1,2}(\s+(off|\d{1,2}))+$/, @@ -1424,7 +1424,7 @@ function eeeLoad(){ var on=parseInt(p.eee,2)!==0; var sw=h("label",{class:"switch"},[ h("input",{type:"checkbox",onchange:function(){ - postCmd("eee "+p.portNum+" "+(this.checked?"on":"off")) + postCmd("eee "+(this.checked?"on":"off")+" "+p.portNum) .then(function(){setTimeout(eeeLoad,300)}).catch(function(){}); }}),h("i")]); sw.firstChild.checked=on; @@ -1616,7 +1616,7 @@ var CONF_OVERWRITE=[ /^vlan\s+\d{1,4}\s+mgmt$/,/^vlan\s+\d{1,4}(?!\s+mgmt\b)/, /^pvid\s+\d{1,2}\b/,/^ingress\b/, /^port\s+\d{1,2}(?!\s+name\b)/,/^port\s+\d{1,2}\s+name\b/, - /^eee\s+\d{1,2}\b/,/^eee\b/,/^mirror\b/, + /^mirror\b/, /^lag\s+\d\b/,/^laghash\s+\d\b/,/^isolate\s+\d{1,2}\b/, /^stp\s+(prio|hello|maxage|fwd|txhold|version)\b/, /^stp\s+(port\s+\d{1,2}|lag\s+[1-4])\s+(edge|cost|prio|guard|filter|p2p)\b/, @@ -1633,6 +1633,11 @@ function mergeConf(base,texts){ var m; if((m=line.match(/^vlan (\d{1,4}) d$/))){drop(new RegExp("^vlan "+m[1]+"( |$)"));return;} if((m=line.match(/^lag (\d) d$/))){drop(new RegExp("^lag(hash)? "+m[1]+"( |$)"));return;} + if((m=line.match(/^eee (on|off)(?: (\d{1,2}))?(?: (?:100m|1g|2g5))?$/))){ + if(m[2])drop(new RegExp("^eee (on|off) "+m[2]+"\\b")); + else drop(/^eee /); + conf.push(line);return; + } if(line==="mirror off"){drop(/^mirror /);return;} if(!isConfCmd(line))return; if((m=line.match(/^bw (in|out) (\d{1,2}) (\S+)$/))){