mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
ports: drop the SFP row, keep the link-state index fix
Leaving SFP ports out of the table is deliberate for now, and being able to force a module's speed belongs in a feature of its own rather than arriving inside a fix, so that half goes again. What remains is the off-by-one: createPortTable() read pState[i] where the array is filled by portNum - 1, so every row started out showing the next port's link speed until the first refresh corrected it. The debug line above it goes too; it printed a third index, pState[i-2].
This commit is contained in:
1 parent
38b8e38c04
commit
30547cc453
1 file changed
+5
-5
+5
-5
@@ -14,16 +14,14 @@ function createPortTable() {
|
|||||||
+ '</select>';
|
+ '</select>';
|
||||||
const dSwitch = '<input type="checkbox" id="disable_port" onchange="portOnOff();">'
|
const dSwitch = '<input type="checkbox" id="disable_port" onchange="portOnOff();">'
|
||||||
for (let i = 1; i <= numPorts; i++) {
|
for (let i = 1; i <= numPorts; i++) {
|
||||||
|
if (pIsSFP[i-1])
|
||||||
|
continue;
|
||||||
const tr = tbl.insertRow();
|
const tr = tbl.insertRow();
|
||||||
let td = tr.insertCell(); td.appendChild(document.createTextNode(t('common_port') + i));
|
let td = tr.insertCell(); td.appendChild(document.createTextNode(t('common_port') + i));
|
||||||
let portName = portNames[physToLogPort[i-1]] || '';
|
let portName = portNames[physToLogPort[i-1]] || '';
|
||||||
td = tr.insertCell(); td.appendChild(document.createTextNode(portName));
|
td = tr.insertCell(); td.appendChild(document.createTextNode(portName));
|
||||||
td = tr.insertCell(); td.innerHTML = linkText(pState[i-1] + 1);
|
td = tr.insertCell(); td.innerHTML = linkText(pState[i-1] + 1);
|
||||||
tr.insertCell(); // filled by devRender()
|
tr.insertCell(); // filled by devRender()
|
||||||
if (pIsSFP[i-1]) {
|
|
||||||
tr.insertCell(); tr.insertCell(); tr.insertCell();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
td = tr.insertCell(); td.innerHTML = sSelect.replaceAll("speed_sel", "speed_sel_" + i);
|
td = tr.insertCell(); td.innerHTML = sSelect.replaceAll("speed_sel", "speed_sel_" + i);
|
||||||
td = tr.insertCell(); td.innerHTML = dSwitch.replaceAll("disable_port", "disable_port_" + i)
|
td = tr.insertCell(); td.innerHTML = dSwitch.replaceAll("disable_port", "disable_port_" + i)
|
||||||
.replace("portOnOff()", "portOnOff(" + i + ")");
|
.replace("portOnOff()", "portOnOff(" + i + ")");
|
||||||
@@ -68,9 +66,9 @@ function updatePortTable() {
|
|||||||
if (tbl.rows.length <= 2 || !numPorts)
|
if (tbl.rows.length <= 2 || !numPorts)
|
||||||
return;
|
return;
|
||||||
for (let i = 1; i <= numPorts ; i++) {
|
for (let i = 1; i <= numPorts ; i++) {
|
||||||
tbl.rows[i].cells[2].innerHTML = linkText(pState[i-1]+1);
|
|
||||||
if (pIsSFP[i-1])
|
if (pIsSFP[i-1])
|
||||||
continue;
|
continue;
|
||||||
|
tbl.rows[i].cells[2].innerHTML = linkText(pState[i-1]+1);
|
||||||
if (!clicked[i] && pState[i - 1] < 0) {
|
if (!clicked[i] && pState[i - 1] < 0) {
|
||||||
document.getElementById('speed_sel_' + i).disabled = true;
|
document.getElementById('speed_sel_' + i).disabled = true;
|
||||||
document.getElementById('disable_port_' + i).checked = true;
|
document.getElementById('disable_port_' + i).checked = true;
|
||||||
@@ -134,6 +132,8 @@ function devRender(entries) {
|
|||||||
perPort[e.port].push(e.mac);
|
perPort[e.port].push(e.mac);
|
||||||
}
|
}
|
||||||
for (let i = 1; i <= numPorts; i++) {
|
for (let i = 1; i <= numPorts; i++) {
|
||||||
|
if (pIsSFP[i-1])
|
||||||
|
continue;
|
||||||
var cell = tbl.rows[i].cells[3];
|
var cell = tbl.rows[i].cells[3];
|
||||||
var macs = perPort[i] || [];
|
var macs = perPort[i] || [];
|
||||||
if (macs.length == 1) {
|
if (macs.length == 1) {
|
||||||
|
|||||||
Reference in new issue
Block a user