Make Power Connections 'unique' (and console and management) #408

Closed
opened 2025-12-29 16:21:44 +01:00 by adam · 5 comments
Owner

Originally created by @iamdadmin on GitHub (Sep 1, 2016).

When viewing a device, and selecting to add a new power (/console/management) connection you search for a CI or select it from a list, and then the API loads the valid ports for the device.

The API call here should instead only return all non-connected ports, or if that's not possible, it should return any current assignment in addition to the port ID; instead of just being a list of "" it would be " - " for ports with a connection.

I don't know if this requires a new API call, or just requires the page to be configured to load a different API call, which would already return this data.

Originally created by @iamdadmin on GitHub (Sep 1, 2016). When viewing a device, and selecting to add a new power (/console/management) connection you search for a CI or select it from a list, and then the API loads the valid ports for the device. The API call here should instead only return all non-connected ports, or if that's not possible, it should return any current assignment in addition to the port ID; instead of just being a list of "" it would be " - " for ports with a connection. I don't know if this requires a new API call, or just requires the page to be configured to load a different API call, which would already return this data.
adam closed this issue 2025-12-29 16:21:44 +01:00
Author
Owner

@iamdadmin commented on GitHub (Sep 2, 2016):

I noted that network connections are unique at least, the line item shows but is disabled and in a slightly darker grey. It could be that power connections are actually unique and I just did not notice the shade of grey; it is almost indistinguishable on my screen. I think making it a lighter grey, and maybe italic too would help. Or as I suggested above, either show only available ports, or show the existing B end the port is connected to in the list to make it more obvious.

@iamdadmin commented on GitHub (Sep 2, 2016): I noted that network connections are unique at least, the line item shows but is disabled and in a slightly darker grey. It could be that power connections are actually unique and I just did not notice the shade of grey; it is almost indistinguishable on my screen. I think making it a lighter grey, and maybe italic too would help. Or as I suggested above, either show only available ports, or show the existing B end the port is connected to in the list to make it more obvious.
Author
Owner

@jeremystretch commented on GitHub (Sep 12, 2016):

The API call returns all outlets for the given PDU as well as the connected power port for each (if any). The form field select widget is rendered so that connected outlets are disabled. NetBox does not enforce any custom styling on the widget; they are rendered the same as any other disabled select option in your browser.

I'd rather not extend the API call to include the name of the connected port, because it effects a significant performance hit to make the JOIN on the database, and the information isn't particularly relevant in this instance. I'm also hesitant to implement any sort of styling on options representing connected outlets, because simply setting disabled="disabled" is the standard way to disable an option within a select widget. In fact, options generally can't be styled beyond color as their rendering pertains to the user's operating system rather than the DOM (as I understand it).

@jeremystretch commented on GitHub (Sep 12, 2016): The API call returns all outlets for the given PDU as well as the connected power port for each (if any). The form field select widget is rendered so that connected outlets are disabled. NetBox does not enforce any custom styling on the widget; they are rendered the same as any other disabled select option in your browser. I'd rather not extend the API call to include the name of the connected port, because it effects a significant performance hit to make the JOIN on the database, and the information isn't particularly relevant in this instance. I'm also hesitant to implement any sort of styling on options representing connected outlets, because simply setting `disabled="disabled"` is the standard way to disable an option within a select widget. In fact, options generally can't be styled beyond color as their rendering pertains to the user's operating system rather than the DOM (as I understand it).
Author
Owner

@iamdadmin commented on GitHub (Sep 12, 2016):

Fair enough on the API, I understand avoiding the domino effect. And creating a custom call for just this is over the top.

This may be most simply resolved then by some extra css only on disabled elements under select.

Genuinely on my laptop and external monitor it is not clear which items are disabled and which are not at the moment.

If this is not getting any upvotes from anyone else I will handle that as a manual edit just on my own install. I'm not wanting to take your time away from other more valuable things if this is just me!

@iamdadmin commented on GitHub (Sep 12, 2016): Fair enough on the API, I understand avoiding the domino effect. And creating a custom call for just this is over the top. This may be most simply resolved then by some extra css only on disabled elements under select. Genuinely on my laptop and external monitor it is not clear which items are disabled and which are not at the moment. If this is not getting any upvotes from anyone else I will handle that as a manual edit just on my own install. I'm not wanting to take your time away from other more valuable things if this is just me!
Author
Owner

@jeremystretch commented on GitHub (Sep 12, 2016):

This may be most simply resolved then by some extra css only on disabled elements under select.

Like I said, other than text and background color, you can't. Browsers just don't support it. Any custom styling would require replacing the stock <select> widget with something entirely custom.

Genuinely on my laptop and external monitor it is not clear which items are disabled and which are not at the moment.

That's something to adjust in your browser/OS/monitor. NetBox doesn't do anything special to select widgets.

@jeremystretch commented on GitHub (Sep 12, 2016): > This may be most simply resolved then by some extra css only on disabled elements under select. Like I said, other than text and background color, you can't. [Browsers just don't support it.](http://stackoverflow.com/questions/7208786/how-to-style-the-option-of-a-html-select) Any custom styling would require replacing the stock `<select>` widget with something entirely custom. > Genuinely on my laptop and external monitor it is not clear which items are disabled and which are not at the moment. That's something to adjust in your browser/OS/monitor. NetBox doesn't do anything special to select widgets.
Author
Owner

@iamdadmin commented on GitHub (Sep 12, 2016):

select option:disabled { color: #ff0000;}

This works for me, although I am pretty sure that Internet Explorer ignores it.

@iamdadmin commented on GitHub (Sep 12, 2016): `select option:disabled { color: #ff0000;}` This works for me, although I am pretty sure that Internet Explorer ignores it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#408