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

Issue 48715: Limit Data Region "Show all" to a maximum number of rows #5058

Closed
wants to merge 5 commits into from

Conversation

labkey-nicka
Copy link
Contributor

@labkey-nicka labkey-nicka commented Dec 16, 2023

Rationale

This addresses Issue 48715 by switching "Show all" functionality in Data Regions to set a maxRows=1000 parameter instead of setting showRows=all. The intention is to a) avoid unwieldy large requests generated by our UI that can consume significant server resources and b) avoid crashing the user's browser attempting to render too many results. This is a client-side change only (so showRows=all is still supported but just not generated by our UI).

Related Pull Requests

Changes

  • Switch selecting "Show all" or calling DataRegion.showAllRows() to setting the URL parameter maxRows=1000 instead of showRows=all
  • Display a message to the user iff the "Show all" max rows boundary is selected and has been reached.

_getShowAllSelector(this).click(this.showAllRows.bind(this));

if (this.maxRows === ALL_ROWS_MAX && this.totalRows > this.maxRows) {
this.addMessage('<span><b>Show all:</b> Displaying the first ' + ALL_ROWS_MAX.toLocaleString() + ' rows. Use paging to see more results.</span>');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly open to other messaging here. The main thing is I think we should display a message, otherwise, it just seems silly (borderline lying) when someone clicks "Show all" and they only see 1,000 rows.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Having a message like this will be helpful to the user to know what's going on.

@@ -3531,7 +3539,7 @@ if (!LABKEY.DataRegions) {

msg += "&nbsp;" + "<span class='labkey-button select-none'>Select None</span>";
var showOpts = [];
if (region.showRows !== 'all')
if (region.showRows !== 'all' && region.maxRows !== ALL_ROWS_MAX)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing this logic makes it apparent that are other ways to easily overburden the server/browser with results. The "Show Selected" and "Show Unselected" options should likely be limited in the same way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point. I'm curious how often those are used with large sets of rows though.

Copy link
Contributor

@labkey-jeckels labkey-jeckels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me.

The only question in my mind is what limit to apply for "all". Anything in the 1,000-10,000 range seems fine.

@labkey-nicka
Copy link
Contributor Author

labkey-nicka commented Dec 18, 2023

The only question in my mind is what limit to apply for "all". Anything in the 1,000-10,000 range seems fine.

I played around with different values and it seems like anything over 5,000 is getting into sluggish page territory. Obviously, this is also influenced by the number of columns in the table but for the sake of this setting I'd just assume at least a few columns.

Edit: I have increased the limit to 5,000 (Note: This PR is currently hung "Processing Updates" on GitHub...).

_getShowAllSelector(this).click(this.showAllRows.bind(this));

if (this.maxRows === ALL_ROWS_MAX && this.totalRows > this.maxRows) {
this.addMessage('<span><b>Show all:</b> Displaying the first ' + ALL_ROWS_MAX.toLocaleString() + ' rows. Use paging to see more results.</span>');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Having a message like this will be helpful to the user to know what's going on.

@@ -3531,7 +3539,7 @@ if (!LABKEY.DataRegions) {

msg += "&nbsp;" + "<span class='labkey-button select-none'>Select None</span>";
var showOpts = [];
if (region.showRows !== 'all')
if (region.showRows !== 'all' && region.maxRows !== ALL_ROWS_MAX)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point. I'm curious how often those are used with large sets of rows though.

@labkey-nicka
Copy link
Contributor Author

Screwed up merge. Closing in favor of #5067.

@labkey-nicka labkey-nicka deleted the fb_data_region_48715 branch December 19, 2023 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants