-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[dashboard] add pagination to admin search #13161
Conversation
started the job as gitpod-build-sefftinge-populate-admin-dashboard-8983.1 because the annotations in the pull request description changed |
/werft run 👍 started the job as gitpod-build-sefftinge-populate-admin-dashboard-8983.2 |
55365a0
to
746638b
Compare
/werft run with-preview 👍 started the job as gitpod-build-sefftinge-populate-admin-dashboard-8983.5 |
e31d0b8
to
f247773
Compare
orderBy: "creationDate", | ||
offset: 0, | ||
offset: (currentPage - 1) * pageLength, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentPage
starts at value of 0, wouldn't this cause the offset to be negative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentPage should start at 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it does, but before it was definitely initialized to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes on 3 out of 4 occasions 😬 (the four search pages are a bit copy and paste and of course I only tested on one of them, which also explains why the limit was set to 2
only on one of them)
// Disables empty search on the workspace search page | ||
if (!props.user && queryTerm.length === 0) { | ||
return; | ||
} | ||
// if (!props.user && queryTerm.length === 0) { | ||
// return; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was the cause of an incident when we originally added the WS search - it would cause too many queries (but may be okay now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, was this maybe before we introduced limits? cc @geropl Do you remember?
It's for sure a SaaS hack that makes the view less useful in smaller self-hosted installations. If we need to protect us we better do that on the server based on a saas-specific configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR the problem was we executed an unlimited query with an empty query term, multiple times on page load.
If we do proper limits (and maybe just once on page load) this should be fine (did not check the code).
@@ -43,6 +44,11 @@ export function WorkspaceSearch(props: Props) { | |||
const [queryTerm, setQueryTerm] = useState(""); | |||
const [searching, setSearching] = useState(false); | |||
const [currentWorkspace, setCurrentWorkspaceState] = useState<WorkspaceAndInstance | undefined>(undefined); | |||
const pageLength = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why so low? Originally this was set to 100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For testing. But I have updated it 50 again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why is it needed to commit test code? I'm asking because I'm trying to understand the problem and because this is something worth digging into to eliminate. Committing it risks we actually land it (and we have done so in past and caused incidents).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, it was just an overlook by myself.
It could have been a conscious decision to allow others testing the changes more easily. In that case I would have added a 'hold' and a comment.
f247773
to
e6df4f6
Compare
Description
This change adds pagination support for the various admin dashboard list views.
Related Issue(s)
Fixes #8983
How to test
Release Notes
Documentation
Werft options:
Valid options are
all
,workspace
,webapp
,ide