Skip to content
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

Allowing Dynamic Custom object filtering using fields set in the current form #11771

Closed
damo2929 opened this issue Feb 16, 2023 · 8 comments
Closed
Labels
pending closure Requires immediate attention to avoid being closed for inactivity status: under review Further discussion is needed to determine this issue's scope and/or implementation type: feature Introduction of new functionality to the application

Comments

@damo2929
Copy link

NetBox version

v3.4.3

Feature type

New functionality

Proposed functionality

when creating object custom fields on an object allow setting a dynamic filter field to be set.

example am on virtual machines with a field call build vlan I am linking to vlan. when using the field it shows all vlans and isn't filtered.
whats required is an option when creating the custom field allow me to set a filter that to be set from a field on the current object.

in this case I would like to vfilter vlans that are in the same site as current.site.

however it could be any field thats common between the source and target objects.

Use case

allows more functional use of object and multi-object custom fields by being able to reduce the selection to whats valid and in scope for it's desired use case. in the same way it happens with the native object links.

Database changes

none

External dependencies

none

@damo2929 damo2929 added the type: feature Introduction of new functionality to the application label Feb 16, 2023
@DanSheps
Copy link
Member

DanSheps commented Feb 18, 2023

I feel like this would be blocked by a issue we had opened internally recently, let me try and find it.

Edit: Would be blocked by #10054

@DanSheps DanSheps added the status: blocked Another issue or external requirement is preventing implementation label Feb 18, 2023
@kkthxbye-code
Copy link
Contributor

@DanSheps - I don't think so. If I understand correctly he just wants to apply query_parameters to the api select based on the object. #10054 seeks to address cases where one api select is filtered by another one. That is he doesn't want the user to be able to filter, he wants to specify a filter when creating the custom field, and that filter is dynamic based on the currently displayed object.

Maybe @damo2929 can clarify what the actual intention is.

@jeremystretch
Copy link
Member

I agree; this doesn't seem like it would be blocked by anything. However I'm also not sure the FR provides sufficient detail. I'd like to see a more thorough description of the proposed functionality.

@jeremystretch jeremystretch added status: revisions needed This issue requires additional information to be actionable and removed status: blocked Another issue or external requirement is preventing implementation labels Feb 27, 2023
@roadracer96
Copy link

Maybe I can help clarify because I want the same thing.

When creating a Custom Field of type "Object" or "Multiple Objects", add the ability to contextually limit the available objects for selection. The context should be definable on the Custom Field itself and be processed with a logic AND.

This functionality exists for netbox default fields. Example:

If I add a new rack. By default, if I click the "site" pulldown, ALL sites are listed. If I change the region to "Region 1", only sites nested under region 1 are listed.

This gets very difficult when we are talking about say.. interfaces.. If I have 10,000 interfaces defined and have a custom field called "mirror_interface" of type "Multiple Obect" with an Object type of DCIM->Interfaces assigned to DCIM->Interfaces, I may want to restrict the available selections to interfaces on the device I am working with. Or in the SITE the device is in or some other a combination of other filters.. Maybe Only interfaces in a Site that have a specific VLAN on them.

As it stands right now, it is just not possible to select the correct interface because there might be 200 ge-0/0/0s listed. IF we had a multi-select field in Custom Fields called "Filter By", and allowed us to select any other data point as an AND match, we could do this. I would offer that the data points selected in "Filter By" should only be applied if the context in which it is being used contains that data point.

Custom Field "Test" is applied to Racks and Devices and is of type Object with Object type Interface. "Filter By" is set to "Rack" and "Device". In the pulldown under the Rack object, all interfaces of any device in the rack are listed (Ignoring the device filter). In the pulldown under a Device object, only interfaces on that device are listed (ignoring the rack filter, unless the device is in a rack then it would use both)

"As a Netbox User, I need to be able to create custom fields that are populated from data elsewhere in netbox. I need to be able to contextually filter the available choices based upon pre-defined criteria."

@jeremystretch
Copy link
Member

NetBox v3.5 introduced a new selector widget (see #10054) that I think would address the need here pretty easily. We should be able to render custom object fields with the selector widget. However, the widget doesn't yet support the selection of multiple objects: That functionality would need to be added as well.

@jeremystretch jeremystretch added status: under review Further discussion is needed to determine this issue's scope and/or implementation and removed status: revisions needed This issue requires additional information to be actionable labels May 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

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.

@github-actions github-actions bot added the pending closure Requires immediate attention to avoid being closed for inactivity label Aug 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 2, 2023
@AleksBelytskyi
Copy link

Will this feature implemented for custom fields? I would like to have it as well.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pending closure Requires immediate attention to avoid being closed for inactivity status: under review Further discussion is needed to determine this issue's scope and/or implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

6 participants