[PR #12799] [CLOSED] Leverage HTMX to simplify rendering of VLAN Form #14049

Closed
opened 2025-12-29 23:22:13 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/12799
Author: @dhenschen
Created: 6/2/2023
Status: Closed

Base: developHead: 11891-leverage-htmx-for-vlan-edit


📝 Commits (4)

  • 5c4e2fe Leverage HTMX to simplify rendering of VLAN Form
  • 563c105 11891: Implicitly Set Assignment Type during VLAN Import
  • b21e45a Move save logic to model to reduce redundancy of both import and edit fields
  • 742d89a Add help text to VLAN model for Assignment Type

📊 Changes

8 files changed (+104 additions, -74 deletions)

View changed files

📝 netbox/ipam/choices.py (+10 -0)
📝 netbox/ipam/forms/model_forms.py (+34 -3)
netbox/ipam/migrations/0067_vlan_assignment_type.py (+37 -0)
📝 netbox/ipam/models/vlans.py (+20 -1)
📝 netbox/ipam/tables/vlans.py (+2 -2)
📝 netbox/ipam/tests/test_views.py (+1 -0)
📝 netbox/ipam/views.py (+0 -1)
netbox/templates/ipam/vlan_edit.html (+0 -67)

📄 Description

Draft: Summary

Associated with issue https://github.com/netbox-community/netbox/issues/11891

This Pull Request adds a new dropdown selection that allows users to specify the assignment type of a VLAN

Screenshots

image

TODO:

  • Fix tests
  • Add field to individual VLAN view
  • bulk import
  • bulk edit

Import Tests

Import VLAN with both Site and VLAN Group

  1. Load v3.5 Netbox Demo Data
  2. Import the following VLAN from with the YAML format under IPAM > VLANS > VLANs > Import
vid: 1000
name: management
status: active
site: DM-Akron
group: JBB-Global
  1. Verify an error toast pops up stating

Record 1 group: VLAN is assigned to group JBB-Global (scope: None); cannot also assign to site DM-Akron.

Import VLAN with only Site assigned

  1. Load v3.5 Netbox Demo Data
  2. Import the following VLAN from with the YAML format under IPAM > VLANS > VLANs > Import
vid: 1000
name: management
status: active
site: DM-Akron
  1. Verify the created VLAN has an Assignment Type of Site.
    • To do this select Configure Table in the VLANs listing that opens after clicking Submit on the VLAN Bulk Import page
    • Add Assignment Type to the Selected Columns
    • Save the Table Configuration
    • Ensure the Assignment Type column lists a type of Site.

Import VLAN with only VLAN Group assigned

  1. Load v3.5 Netbox Demo Data
  2. Import the following VLAN from with the YAML format under IPAM > VLANS > VLANs > Import
vid: 1000
name: management
status: active
group: JBB-Global
  1. Verify the created VLAN has an Assignment Type of VLAN Group.
    • To do this select Configure Table in the VLANs listing that opens after clicking Submit on the VLAN Bulk Import page
    • Add Assignment Type to the Selected Columns
    • Save the Table Configuration
    • Ensure the Assignment Type column lists a type of VLAN Group.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/12799 **Author:** [@dhenschen](https://github.com/dhenschen) **Created:** 6/2/2023 **Status:** ❌ Closed **Base:** `develop` ← **Head:** `11891-leverage-htmx-for-vlan-edit` --- ### 📝 Commits (4) - [`5c4e2fe`](https://github.com/netbox-community/netbox/commit/5c4e2fe04c3915e30d7b0b0a29a9e46042faf6d6) Leverage HTMX to simplify rendering of VLAN Form - [`563c105`](https://github.com/netbox-community/netbox/commit/563c10501a528d4787c4b8e1c058a9f3a775f6fa) 11891: Implicitly Set Assignment Type during VLAN Import - [`b21e45a`](https://github.com/netbox-community/netbox/commit/b21e45a1b522e756edd46a622aed529d130cef3a) Move save logic to model to reduce redundancy of both import and edit fields - [`742d89a`](https://github.com/netbox-community/netbox/commit/742d89a1971d88d3bfbf7729da4ff7fbf2e1aaa6) Add help text to VLAN model for Assignment Type ### 📊 Changes **8 files changed** (+104 additions, -74 deletions) <details> <summary>View changed files</summary> 📝 `netbox/ipam/choices.py` (+10 -0) 📝 `netbox/ipam/forms/model_forms.py` (+34 -3) ➕ `netbox/ipam/migrations/0067_vlan_assignment_type.py` (+37 -0) 📝 `netbox/ipam/models/vlans.py` (+20 -1) 📝 `netbox/ipam/tables/vlans.py` (+2 -2) 📝 `netbox/ipam/tests/test_views.py` (+1 -0) 📝 `netbox/ipam/views.py` (+0 -1) ➖ `netbox/templates/ipam/vlan_edit.html` (+0 -67) </details> ### 📄 Description ## Draft: Summary Associated with issue https://github.com/netbox-community/netbox/issues/11891 This Pull Request adds a new dropdown selection that allows users to specify the assignment type of a VLAN ## Screenshots ![image](https://github.com/netbox-community/netbox/assets/11417982/77c174cd-7154-47f2-9a8e-f81333128f06) ## TODO: - [ ] Fix tests - [ ] Add field to individual VLAN view - [x] bulk import - [x] bulk edit # Import Tests ### Import VLAN with both Site and VLAN Group 1. Load v3.5 Netbox Demo Data 2. Import the following VLAN from with the YAML format under IPAM > VLANS > VLANs > Import ```yaml vid: 1000 name: management status: active site: DM-Akron group: JBB-Global ``` 3. Verify an error toast pops up stating > Record 1 group: VLAN is assigned to group JBB-Global (scope: None); cannot also assign to site DM-Akron. ### Import VLAN with only Site assigned 1. Load v3.5 Netbox Demo Data 2. Import the following VLAN from with the YAML format under IPAM > VLANS > VLANs > Import ```yaml vid: 1000 name: management status: active site: DM-Akron ``` 3. Verify the created VLAN has an Assignment Type of `Site`. - To do this select `Configure Table` in the VLANs listing that opens after clicking `Submit` on the VLAN Bulk Import page - Add Assignment Type to the Selected Columns - Save the Table Configuration - Ensure the Assignment Type column lists a type of `Site`. ### Import VLAN with only VLAN Group assigned 1. Load v3.5 Netbox Demo Data 2. Import the following VLAN from with the YAML format under IPAM > VLANS > VLANs > Import ```yaml vid: 1000 name: management status: active group: JBB-Global ``` 3. Verify the created VLAN has an Assignment Type of `VLAN Group`. - To do this select `Configure Table` in the VLANs listing that opens after clicking `Submit` on the VLAN Bulk Import page - Add Assignment Type to the Selected Columns - Save the Table Configuration - Ensure the Assignment Type column lists a type of `VLAN Group`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:22:13 +01:00
adam closed this issue 2025-12-29 23:22:13 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14049