-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In menus, qualify device names with site and/or tenant #13093
Comments
Tangentially related: #11478 This same problem pops up in the context of interfaces. |
Why don't you include site and/or tenant column in a table view? |
Additional point 1: it occurs to me that these menus need to be searchable efficiently using AJAX. This suggests that there should be a "display label" field which is cached in the database model - much in the same way as interfaces have a (This could also have a unique constraint, which would guarantee that you can never accidentally have two indistinguishable items in a menu) Additional point 2: another tangential issue. In custom scripts, I would like to do this:
However, this displays only the Site "Name" attribute. I need also to show (and be able to search on) a site code, which is held separately in My workaround (which is OK for now because the list of sites isn't too large) is to generate a materialized ChoiceVar instead:
But in the long term, if Site also had a display |
It is related in that all of this (this issue and the one I referenced) relates to the serializer's |
That seem like the same problem OpenStreetMap-Contributors are facing, names are names, not descriptions etc. If the device is distinguishable from others by type and role and it has no actual assigned name just leave the name empty… |
I think the example was made overly generic, but take for example: "CORE-SW-01", you might have one in Site A and Site B. If you search just "CORE-SW-01" it will bring in all. However if there is a |
Yes that's it exactly. |
|
I personally thing the end-user-friendliest approach would be to allow comma to be used as "search character", eg you search for "sw-core-1, samplecity" it then searches for "sw-core-1" first and in the results for that it searches for "samplecity" in all the other linked attributes (racks, locations, sites, regions). |
There are also limitations in the frontend library that netbox uses as it currently only allows to find/select results which have the string typed in the select box. Just more things to consider when thinking about "searching" from additional fields/relationships. |
I am not against this approach, but I think if we are doing this it makes more sense to override in get_display() instead. That said, one option that this got me thinking about more, is to perhaps have the widget allow you to define a list of fields to include in the display name and it combines them itself (this would only work for fields available via the nested serializer). Something like: display_field: '$name ($device.display)' This way, you could override it on the form itself without changing the underlying get_display function. The ApiSelect function would need to handle tokenizing the fields and replacing them but it is less "disruptive" to the underlying API. |
How would this work with filter-as-you-type, when there are a large set of objects in the database? Does it currently use an indexed column (Name)? |
I believe the filter-as-you-type (might be mistaken mind you) uses a async request to Take this with a grain of salt as I am not a typescript expert. |
Yes you're right, for example it calls The problem though will be that
and the user types 'bar', they would expect the list to contract to
but I think it will just go to empty (testing seems to confirm this; if I type part of a site name, I don't see any devices) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide. |
This would be addressed by #13283 |
NetBox version
v3.5.4
Feature type
Change to existing functionality
Proposed functionality
Currently when you get a drop-down selection list of devices (e.g. when creating a cable), the list shows only the device name.
However, device names are only unique within a given site/tenant.
Therefore if you have 100 sites, each with a device named "PDU", you will see a drop-down menu with 100 entries all called "PDU" - it's impossible to distinguish one from another.
Proposal: the menu label for a device should show "device name - site - tenant". If the device has no name, then "device model - id - site - tenant".
Use case
In some contexts it is possible to filter this list down further - e.g. by opening the filter sub-window and filtering on site.
But in general, I think presenting a menu of identical-looking choices (when in fact they are significantly different, and choosing the wrong one could be a serious error) is a poor user experience.
Database changes
None
External dependencies
None
The text was updated successfully, but these errors were encountered: