-
Notifications
You must be signed in to change notification settings - Fork 266
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
Add server-side pagination to home page cluster list #11663
Conversation
bbefeb1
to
634996e
Compare
- Functional Changes - SSP now works after vue3 bump - Home Page Clusters list now uses server-side pagination - Side Bar clusters list now uses server-side pagination - Wire in now supported sorting / filtering by id and name used for table columns - Allow pagination to be enabled given a specific context - Call findPage without persisting to store - New Pagination Tools - PaginatedResourceTable - Convenience Component, wraps ResourceTable with pagination specific props - PaginationWrapper - Convenience class to handle requests for resources and updates to them (avoiding store) - Regressions - Side Nav menu ready state was `mgmtCluster.isReady && !pCluster?.hasError`, now ???
42b3845
to
6d14429
Compare
6d14429
to
f1858b6
Compare
- remove from resource list, put in resource-fetch (used also by pag res table)
96b6b9a
to
442d85c
Compare
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 don't think any of my comments warrant blocking this from merging. After the gates pass I say go for it.
it should be fine to improve these issues after this is merged.
await this.$fetch(); | ||
if (this.canPaginate && this.fetchPageSecondaryResources) { | ||
this.fetchPageSecondaryResources(true); | ||
this.fetchPageSecondaryResources({ |
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.
This is another place where we may want to initiate the requests in parallel.
By any chance do we also want to await the secondary resource here?
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.
Unfortunately we can't on this one. $fetch
will make the http request to get the page which is then used by fetchPageSecondaryResources
to get resources dependent on it's response.
I think fetchSecondaryResources
, fetchPageSecondaryResources
and the content of this function might be tweaked in future depending on how we react to the new resources.changed event.
- root resource type changes - We would need to refetch the current page (basically do exactly the same as this function - fetch page, fetch resources dependent on page).
- secondary resource type changes - (fetched via fetchSecondaryResources, are general resources not page dependent). We would need to refetch whole secondry resource set
- resource dependent on page - We would need to call fetchPageSecondaryResources
id: CAPI.RANCHER_CLUSTER, | ||
context: 'side-bar', | ||
}); | ||
const helper = canPagination ? new TopLevelMenuHelperPagination({ $store: this.$store }) : new TopLevelMenuHelperLegacy({ $store: this.$store }); |
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.
Not for this PR but I have a feeling we're going to want to make these helpers more generic and perhaps add the updating/debouncing to the thelpers
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.
That's my plan for the PaginationWrappers (very open to renaming, maybe PaginationHandler?). Those should be able to receive some pagination settings, return the page and also notify when that page has changed. It's a new util though so not wired in everywhere
management: { | ||
resources: { | ||
enableAll: false, | ||
enableSome: { | ||
enabled: [ | ||
{ resource: CAPI.RANCHER_CLUSTER, context: ['home', 'side-bar'] }, | ||
{ resource: MANAGEMENT.CLUSTER, context: ['side-bar'] }, | ||
], | ||
generic: false, | ||
} | ||
} |
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.
Are we splitting SSP up into different user settings?
To me it seems like we should really just make SSP an all or nothing setting.
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.
This was important for the gradual conversion to SSP, possibly still so given enabling in a global way might start breaking things (including e2e).
It's all store based. lists (and any SSP request) will be enabled either by
- all
- some
- specific resources
- generic (lists without any list component or custom headers)
At the end of 2.11 dev cycle in theory we'll just be left with all
for cluster
and management
stores but not if there's some weird lists in crevices that we didn't reach
// Normally owner components supply `resource` and `inStore` as part of their data, however these are needed here before parent data runs | ||
// So set up both here | ||
const params = { ...this.$route.params }; | ||
const resource = params.resource || this.schema?.id; // Resource can either be on a page showing single list, or a page of a resource showing a list of another resource |
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.
Is this for instances like being on a Node detail page and we're listing pods? If so, can we just make a pods list component and just use this on the components that are going to list paginated resources and not have to differentiate between list/detail page in a mixin like this?
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.
This is for showing the clusters in the home page (no resource in route) and resolves a frustrating issue were child mixins and components data
resolve before parent data
.
The pods list in node detail view is a vanilla ResourceTable working on a node model property which applies a filter to all Pods in store, however the node detail page populates pods in store with only those associated with the node.
in the future we should switch the pods list in node detail to use the new PaginatedResourceTable (which would be supplied with a special filter to get only those from a node). Noticed we'd hit a bug then where the pod list would look at the node from params instead, will need to re-think this approach at that point
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.
This is the only real concern I have in this PR. The amount of changes we had to do here makes me a little concerned about the abstractions/interfaces that we're relying on. I guess it's mostly a problem with pinning and searching though.
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 pushed a lot of the 'fetch x' style functionality into the legacy top level helper and made the interface layer such that the require data could also be returned via SSP requests.
The component is generally hard to understand as there's so much weirdness. pinned (split's cluster list into two pinned / not pinned), search (pinned list is not shown, not pinned list becomes search result which may show pinned clusters), local cluster (always appears at top of either pinned or not-pinned/filtered clusters). There's definitely a opportunity to improve this once we're sure the old way is no longer needed and the helpers ssp helper can be folded into the component and legacy helper dropped
6858b5b
to
1b5aa97
Compare
1b5aa97
to
7b89a85
Compare
@codyrancher comments addressed and e2e tests are now passing. just waiting on rancher/rancher#48349 to merge before resolving the remaining TODOs Update:
|
- general fixes - correct issue were sorting prov clusters on mgmt cluster props (issue in master as well...) - bit the bullet, we now don't fetch all mgmt clusters on dashboard visit. - there could be knock on affects, but we'd need to remove it sometime in 2.11....
d786a76
to
9b5d420
Compare
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'm happy to have it merged once the tests pass as you've already mentioned.
All TODOs resoled. There are some outstanding parts split out to new issues (see descriptions linked in issue). Only really remaining blocker is the disabled vai tests (not caused by PR, but PR brings in vai related changes). |
Blocked on
Is Impacted by
services
cache fails to be created, blocking other resources rancher#48384 (resolved)Summary
Fixes #10283
Occurred changes and/or fixed issues
Server-side pagination for home page clusters list and side bar clusters
mgmtCluster.isReady && !pCluster?.hasError
, will be status.conditions[0].status (blocked on SQLite backed cache: Support sorting mgmt clusters on value in a specific condition rancher#48092)Areas or cases that should be tested
Areas which could experience regressions
hide-local-cluster
setting
Checklist