Skip to content

Fix four reported bugs: no-VLAN blocking, link_down, scroll jump, mobile nav

Aiho Tehisaru requested to merge fix/vlan-linkdown-scroll-mobile-nav into trunk

Summary

  • #1 (closed) An interface with no VLAN in NetBox took the whole device page down (502). resolveVLANTag now resolves to VLANTag=0 — a legitimate untagged Proxmox NIC, not a blocker. nicLine/diff's Before-After formatters now omit tag= entirely for an untagged interface (via a shared vlanTagSuffix) instead of writing the out-of-range tag=0, which Proxmox's API rejects.
  • #2 (closed) Rax never read NetBox's enabled field on an interface. Added InterfaceSpec.LinkDown/NICState.LinkDown, wired through apply.nicLine (link_down=1) and diff.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-workspace after its htmx swap — htmx's scrollIntoViewOnBoost default does this independently of the existing hx-target/hx-select scoping. Disabled globally in base.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 propose set_tags on 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 = false with 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

🤖 Generated with Claude Code

https://claude.ai/code/session_01WH1iZyhPTu6AsnfwLEjQcR

Edited by Aleksandr Muravja

Merge request reports

Loading