Fix four reported bugs: no-VLAN blocking, link_down, scroll jump, mobile nav
Summary
-
#1 (closed) An interface with no VLAN in NetBox took the whole device page down (502).
resolveVLANTagnow resolves toVLANTag=0— a legitimate untagged Proxmox NIC, not a blocker.nicLine/diff's Before-After formatters now omittag=entirely for an untagged interface (via a sharedvlanTagSuffix) instead of writing the out-of-rangetag=0, which Proxmox's API rejects. -
#2 (closed) Rax never read NetBox's
enabledfield on an interface. AddedInterfaceSpec.LinkDown/NICState.LinkDown, wired throughapply.nicLine(link_down=1) anddiff.nicChanged, so a NetBox-disabled interface is created/updated disabled on Proxmox. -
#3 (closed) Every auto-saved field on the device page scrolled back to the top of
#device-workspaceafter its htmx swap — htmx'sscrollIntoViewOnBoostdefault does this independently of the existinghx-target/hx-selectscoping. Disabled globally inbase.html. - #4 (closed) The topbar nav wrapped across several rows on narrow screens, eating a large share of the viewport. Added a hamburger toggle that collapses it into a dropdown below 720px.
- Also: NetBox device tags are now lower-cased on read (
netbox.BuildDeviceSpec) — Proxmox's own tag convention is all-lowercase, but an operator can type a NetBox tag in any case; without normalizing, a mixed-case tag would never converge against the live Proxmox value and proposeset_tagson every Apply forever.
Test plan
-
go build ./... && go vet ./... && go test ./...— all green -
Unit tests: netbox.TestResolveVLANTag,netbox.TestBuildDeviceSpec_Success(LinkDown + lower-cased tags),diff.TestCompute_UntaggedInterfaceDoesNotBlockApply,diff.TestCompute_UpdateNIC_LinkDownChange,apply.TestExecute_AddNIC_UntaggedInterfaceOmitsTagKey,apply.TestExecute_AddNIC_LinkDownWritesLinkDownKey/...EnabledInterfaceOmitsLinkDownKey,proxmox.TestParseNICLine_LinkDown/...NoLinkDownKeyMeansLinkUp -
Ran a local instance (dummy NetBox target, local-admin login) and confirmed the rendered HTML carries the new topbar/nav markup and htmx.config.scrollIntoViewOnBoost = falsewith no template errors -
Not verified in an actual browser against live NetBox/Proxmox data (no test environment with a disabled or untagged interface on hand) — please eyeball the mobile nav and the device-page scroll behavior for real before merging
Edited by Aleksandr Muravja