[PR #19261] [MERGED] Fixes #19230: Allow label reuse when creating multiple components from a pattern #15583

Closed
opened 2025-12-30 00:22:51 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/19261
Author: @jeremystretch
Created: 4/22/2025
Status: Merged
Merged: 4/22/2025
Merged by: @arthanson

Base: mainHead: 19230-label-replication


📝 Commits (1)

  • b48101d Fixes #19230: Allow label reuse when creating multiple components from a pattern

📊 Changes

1 file changed (+12 additions, -8 deletions)

View changed files

📝 netbox/dcim/forms/object_create.py (+12 -8)

📄 Description

Fixes: #19230

If a pattern-supporting field returns only a single value because no pattern was specified, replicate it to provide a match the number of expected values. This allows us to do e.g.

  • name: Port[1-4]
  • label: Foo

to reuse the same label for all components. However, an otherwise mismatched number of labels (as below) will still fail:

  • name: Port[1-4]
  • label: Foo[1-2]

🔄 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/19261 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 4/22/2025 **Status:** ✅ Merged **Merged:** 4/22/2025 **Merged by:** [@arthanson](https://github.com/arthanson) **Base:** `main` ← **Head:** `19230-label-replication` --- ### 📝 Commits (1) - [`b48101d`](https://github.com/netbox-community/netbox/commit/b48101dee394556c989e4f0fc645ec71949f503b) Fixes #19230: Allow label reuse when creating multiple components from a pattern ### 📊 Changes **1 file changed** (+12 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/forms/object_create.py` (+12 -8) </details> ### 📄 Description ### Fixes: #19230 If a pattern-supporting field returns only a single value because no pattern was specified, replicate it to provide a match the number of expected values. This allows us to do e.g. * name: `Port[1-4]` * label: `Foo` to reuse the same label for all components. However, an otherwise mismatched number of labels (as below) will still fail: * name: `Port[1-4]` * label: `Foo[1-2]` --- <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-30 00:22:51 +01:00
adam closed this issue 2025-12-30 00:22:51 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15583