Ports already "connected" needs to be greyed out, ie; not selectable. #5099

Closed
opened 2025-12-29 19:24:13 +01:00 by adam · 2 comments
Owner

Originally created by @drikusb on GitHub (Jul 26, 2021).

NetBox version

v3.0-beta1

Feature type

Change to existing functionality

Proposed functionality

In NetBox v2.11.x, you are unable to select ports that are already connected to other ports.
v3.0-beta1 allows the selection of already connected ports, though doesn't allow the "connection" of ports to continue...an error occurs as should.

Feature request is to grey out ports that are not considered available.
eg;

  1. Create a device DEVICEA in any RU position with X number of rear ports
  2. Create a device DEVICEB anywhere, another rack, same rack with X number of rear ports
  3. Link DEVICEA rear-port 1 with DEVICEB rear-port1
  4. When trying to link DEVICEA rear-port2 with DEVICEB rear-port2, rear-port1 should be greyed out which isn't.

Use case

Saves time not having the ability to give n error because of the wrongly selected ports at transaction completion time.

Database changes

No response

External dependencies

No response

Originally created by @drikusb on GitHub (Jul 26, 2021). ### NetBox version v3.0-beta1 ### Feature type Change to existing functionality ### Proposed functionality In NetBox v2.11.x, you are unable to select ports that are already connected to other ports. v3.0-beta1 allows the selection of already connected ports, though doesn't allow the "connection" of ports to continue...an error occurs as should. Feature request is to grey out ports that are not considered available. eg; 1. Create a device DEVICEA in any RU position with X number of rear ports 2. Create a device DEVICEB anywhere, another rack, same rack with X number of rear ports 3. Link DEVICEA rear-port 1 with DEVICEB rear-port1 4. When trying to link DEVICEA rear-port2 with DEVICEB rear-port2, rear-port1 should be greyed out which isn't. ### Use case Saves time not having the ability to give n error because of the wrongly selected ports at transaction completion time. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: bugbeta labels 2025-12-29 19:24:13 +01:00
adam closed this issue 2025-12-29 19:24:13 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2021):

In NetBox v2.11.x, you are unable to select ports that are already connected to other ports.

Marking this as a bug, since the behavior in v2.11 is desired.

@jeremystretch commented on GitHub (Jul 29, 2021): > In NetBox v2.11.x, you are unable to select ports that are already connected to other ports. Marking this as a bug, since the behavior in v2.11 is desired.
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2021):

@thatmattlove Seems like the issue is here: 52c4d54481/netbox/project-static/src/select/api.ts (L38)

DynamicModelChoiceField sets an attribute named disabled-indicator on its widget specifying the name of the API field (if any) that indicates whether the object should be disabled from selection. For example, in the cable connection form, we see:

    termination_b_id = DynamicModelChoiceField(
        queryset=Interface.objects.all(),
        label='Name',
        disabled_indicator='_occupied',
        query_params={
            'device_id': '$termination_b_device',
            'kind': 'physical',
        }
    )

This manifests on the form field widget as:

<select name="termination_b_id" ... disabled-indicator="_occupied">

If we can tweak the API TypeScript to infer DISABLED_ATTRIBUTES from the value of this attribute, it should fix this and any other such issues in other forms.

@jeremystretch commented on GitHub (Jul 29, 2021): @thatmattlove Seems like the issue is here: https://github.com/netbox-community/netbox/blob/52c4d54481d7fd9138474cffdc9a6f8024718d69/netbox/project-static/src/select/api.ts#L38 DynamicModelChoiceField sets an attribute named `disabled-indicator` on its widget specifying the name of the API field (if any) that indicates whether the object should be disabled from selection. For example, in the cable connection form, we see: ```python termination_b_id = DynamicModelChoiceField( queryset=Interface.objects.all(), label='Name', disabled_indicator='_occupied', query_params={ 'device_id': '$termination_b_device', 'kind': 'physical', } ) ``` This manifests on the form field widget as: ```html <select name="termination_b_id" ... disabled-indicator="_occupied"> ``` If we can tweak the API TypeScript to infer `DISABLED_ATTRIBUTES` from the value of this attribute, it should fix this and any other such issues in other forms.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5099