mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 17:11:52 +08:00
switch: server-side IDs
This commit is contained in:
@@ -306,7 +306,7 @@ export function Switch() {
|
||||
if (active < 0 || active >= __state.model.ports.length) {
|
||||
$("switch-active-port").innerText = "N/A";
|
||||
} else {
|
||||
$("switch-active-port").innerText = "p" + __formatPort(__state.model, active);
|
||||
$("switch-active-port").innerText = "p" + summary.active_id;
|
||||
}
|
||||
for (let port = 0; port < __state.model.ports.length; ++port) {
|
||||
__setLedState($(`__switch-port-led-p${port}`), "green", (port === active));
|
||||
@@ -361,7 +361,7 @@ export function Switch() {
|
||||
content += `
|
||||
<tr>
|
||||
<td>Port:</td>
|
||||
<td class="value">${__formatPort(model, port)}</td>
|
||||
<td class="value">${pa.id}</td>
|
||||
<td> </td>
|
||||
<td>
|
||||
<div class="buttons-row">
|
||||
@@ -541,7 +541,7 @@ export function Switch() {
|
||||
}
|
||||
};
|
||||
|
||||
wm.modal(`Port ${__formatPort(__state.model, port)} settings`, create_content, true, true).then(function(ok) {
|
||||
wm.modal(`Port ${__state.model.ports[port].id} settings`, create_content, true, true).then(function(ok) {
|
||||
if (ok) {
|
||||
let params = {
|
||||
"port": port,
|
||||
@@ -557,14 +557,6 @@ export function Switch() {
|
||||
});
|
||||
};
|
||||
|
||||
var __formatPort = function(model, port) {
|
||||
if (model.units.length > 1) {
|
||||
return `${model.ports[port].unit + 1}.${model.ports[port].channel + 1}`;
|
||||
} else {
|
||||
return `${port + 1}`;
|
||||
}
|
||||
};
|
||||
|
||||
var __setLedState = function(el, color, on) {
|
||||
el.classList.toggle(`led-${color}`, on);
|
||||
el.classList.toggle("led-gray", !on);
|
||||
|
||||
Reference in New Issue
Block a user