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

Fetch all filter values with AJAX in list views #2735

Closed
aruhier opened this issue Dec 28, 2018 · 6 comments
Closed

Fetch all filter values with AJAX in list views #2735

aruhier opened this issue Dec 28, 2018 · 6 comments
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@aruhier
Copy link
Contributor

aruhier commented Dec 28, 2018

Environment

  • Python version: 3.7
  • NetBox version: 2.5.2

Proposed Functionality

In views like /dcim/devices/ or /dcim/racks/, that include a search bar with filters, values inside each filters could be fetched asynchronously with AJAX, instead of waiting for the server to fill them before rendering the page.

Use Case

If in one of these filters, there is a lot of objects (multiple thousands), currently the page takes time to render, as it is single threaded and heavy on CPU (in the python code, not necessarily in database if you disable the natural ordering sort).

The most important when listing some objects in a view is the table of objects, there is no really need to wait for the filters to be rendered. These filters could be fetched in AJAX, and marked as disabled as long as the query is not over.

The page would be a lot quicker to render. For me, with 150K devices and 4K racks, by doing that for the devices view, django-debug-toolbar indicates a reduction from 3s CPU time to 800ms.
Also, it would allow to multithread each filter, and would work even better if the user has a cluster of Netbox servers.

Database Changes

None

External Dependencies

None

@aruhier aruhier changed the title Fetch all filter fields in list views in AJAX Fetch all filter values with AJAX in list views Dec 28, 2018
@DanSheps
Copy link
Member

I imagine this will come when there is front-end rewrite done, like v3 or something.

@aruhier
Copy link
Contributor Author

aruhier commented Dec 30, 2018

I already started to work on this, if someone is interested.

@lampwins
Copy link
Contributor

If this were to be done, it would be rolled into the select2 UI changes which are under active development in the select2-ui branch.

@lampwins lampwins added status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application labels Jan 9, 2019
@lampwins
Copy link
Contributor

lampwins commented Jan 9, 2019

This has been wrapped into #2753 and is currently implemented for the DCIM app in the select2-ui branch.

@lampwins
Copy link
Contributor

Implemented in develop

@aruhier
Copy link
Contributor Author

aruhier commented Jan 16, 2019

Great, thanks a lot!

Sorry, I finally didn't have time to deal with that.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

3 participants