Fix bug when editing xlinks on single port devices (#866)

This commit is contained in:
Tim Wilkinson 2023-06-06 21:54:08 -07:00 committed by GitHub
parent da7b894c39
commit 8287742822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -679,14 +679,12 @@ for _, xlink in ipairs(xlinks)
do
html.print("<tr id='" .. xlink.name .. "'>")
html.print("<td><input type='text' value='" .. xlink.vlan .. "'></td><td><input type='text' value='" .. xlink.ipaddr .. "'></td><td><input type='text' value='" .. xlink.peer .. "'></td><td>255.255.255.252</td><td><input type='text' value='" .. xlink.weight .. "'></td>")
if #layout.ports > 1 then
html.print("<td><select>")
for pos, port in ipairs(layout.ports)
do
html.print("<option value='" .. port .. "'" .. (xlink.port == port and " selected" or "") .. ">" .. pos .. "</option>")
end
html.print("</td></select>")
html.print("<td" .. (#layout.ports <= 1 and " style='display:none'" or "") .. "><select>")
for pos, port in ipairs(layout.ports)
do
html.print("<option value='" .. port .. "'" .. (xlink.port == port and " selected" or "") .. ">" .. pos .. "</option>")
end
html.print("</td></select>")
html.print("<td><button onclick='xlink_remove(this)'>-</button></td>")
html.print("</tr>")
end