VLANGroup: Single VLAN IDs render as n-n after save #11675

Closed
opened 2025-12-29 21:48:22 +01:00 by adam · 3 comments
Owner

Originally created by @pheus on GitHub (Oct 2, 2025).

Originally assigned to: @pheus on GitHub.

NetBox Edition

NetBox Community

NetBox Version

v4.4.2

Python Version

3.12

Steps to Reproduce

  1. Go to IPAM → VLAN Groups → Add.
  2. Create a new VLAN group (any name/scope).
  3. In VLAN ID Ranges, enter: 1-5,10,20-30.
  4. Save, view the group (list & detail), then click Edit again.

Expected Behavior

The single VLAN ID 10 remains displayed as 10 (i.e., the value stays 1-5,10,20-30) across:

  • The VLAN groups list/table
  • The group detail view
  • The edit form field

Observed Behavior

After saving, the value is rendered as 1-5,10-10,20-30.
The single VLAN 10 is displayed as a range (10-10) in the list, detail view, and pre‑populated edit form.

Notes

  • VLAN groups support multiple VID ranges; single VLAN IDs are valid inputs. However, the UI expands singletons to n-n when displaying the saved value.
  • Proposal: When serializing VID ranges for display and when pre‑populating the edit form, collapse any range where start == end to a single integer. This keeps the canonical representation user‑friendly without changing storage semantics.
Originally created by @pheus on GitHub (Oct 2, 2025). Originally assigned to: @pheus on GitHub. ### NetBox Edition NetBox Community ### NetBox Version v4.4.2 ### Python Version 3.12 ### Steps to Reproduce 1. Go to **IPAM → VLAN Groups → Add**. 2. Create a new VLAN group (any name/scope). 3. In **VLAN ID Ranges**, enter: `1-5,10,20-30`. 4. Save, view the group (list & detail), then click **Edit** again. ### Expected Behavior The single VLAN ID `10` remains displayed as `10` (i.e., the value stays `1-5,10,20-30`) across: - The VLAN groups list/table - The group detail view - The edit form field ### Observed Behavior After saving, the value is rendered as `1-5,10-10,20-30`. The single VLAN `10` is displayed as a range (`10-10`) in the list, detail view, and pre‑populated edit form. ### Notes - VLAN groups support multiple VID ranges; single VLAN IDs are valid inputs. However, the UI expands singletons to `n-n` when displaying the saved value. - Proposal: When serializing VID ranges for display and when pre‑populating the edit form, collapse any range where `start == end` to a single integer. This keeps the canonical representation user‑friendly without changing storage semantics.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:48:22 +01:00
adam closed this issue 2025-12-29 21:48:23 +01:00
Author
Owner

@pheus commented on GitHub (Oct 2, 2025):

I’ve identified a root cause and I’m happy to open a PR if this report is accepted.

@pheus commented on GitHub (Oct 2, 2025): I’ve identified a root cause and I’m happy to open a PR if this report is accepted.
Author
Owner

@arthanson commented on GitHub (Oct 2, 2025):

I'll assign it to you @pheus, thanks!

@arthanson commented on GitHub (Oct 2, 2025): I'll assign it to you @pheus, thanks!
Author
Owner

@pheus commented on GitHub (Oct 2, 2025):

It seems a newer version of ruff is flagging unused imports in files not touched by the PR. Would you prefer I:

  1. add a separate lint: commit to clean them up, or
  2. open a small follow‑up PR just for the ruff cleanup?

Happy to do either. Please advise.

@pheus commented on GitHub (Oct 2, 2025): It seems a newer version of **ruff** is flagging unused imports in files not touched by the PR. Would you prefer I: 1) add a separate `lint:` commit to clean them up, or 2) open a small follow‑up PR just for the ruff cleanup? Happy to do either. Please advise.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11675