Skip to content

Use select2 for custom script ObjectVar fields #3516

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

Closed
tkupari opened this issue Sep 19, 2019 · 5 comments
Closed

Use select2 for custom script ObjectVar fields #3516

tkupari opened this issue Sep 19, 2019 · 5 comments
Labels
status: duplicate This issue has already been raised

Comments

@tkupari
Copy link

tkupari commented Sep 19, 2019

Environment

  • Python version: 3.7.4
  • NetBox version: 2.6.3

Proposed Functionality

Use select2 to enable filtering in custom script ObjectVar dropdown.

Use Case

Selecting a rack from a list of 300 racks

Database Changes

no

External Dependencies

no

@DanSheps
Copy link
Member

DanSheps commented Sep 19, 2019

I think one thing to look at, would also be to make all vars Select. However, for the select2 for objects, you would need "widget=APISelect", because you can filter a rack with select2, but unless you add in the widget to perform the query, the list is going to be static.

@Grokzen
Copy link
Contributor

Grokzen commented Oct 8, 2019

@DanSheps I tried to use ObjectVar with our IPAddress model that had 27k+ objects in it. The page almost crashed on my laptop. The APISelect solution must be there to work the same way as it does on the filter panels on the list views. Yes the current select box works for very small data sets, but bigger ones, no wai.

@jeremystretch jeremystretch added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Oct 17, 2019
@tyler-8
Copy link
Contributor

tyler-8 commented Oct 29, 2019

This would be extremely useful. There are workflows that, even when using filtered QuerySets, could provide several thousand or more object choices. That would be a browser killer as @Grokzen noted.

@hSaria
Copy link
Contributor

hSaria commented Jan 13, 2020

I'm all for implementing this, but we'd need to address the issue with manually specifying the api_url of the APISelect-based widgets; someone is bound to put the wrong URL. Maybe we create an API URL attribute for every model to be used in the data-url attribute of the select field.

@hSaria
Copy link
Contributor

hSaria commented Jan 25, 2020

Could this be closed as it is a duplicate of #3766 (has more relevant information, I'd say)

@DanSheps DanSheps added status: duplicate This issue has already been raised and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Feb 11, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: duplicate This issue has already been raised
Projects
None yet
Development

No branches or pull requests

6 participants