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

Converting the management cluster list and detail pages to be paginated #13170

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

codyrancher
Copy link
Contributor

@codyrancher codyrancher commented Jan 21, 2025

Summary

Fixes #9548

Occurred changes and/or fixed issues

Reduces the number of findAll calls and rely on the PaginatedResourceTable to do the paginated calls.

Areas or cases that should be tested

The management cluster list and detail pages

Areas which could experience regressions

The management cluster list and detail pages

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

@codyrancher codyrancher changed the title Management cluster Converting the management cluster list and detail pages to be paginated Jan 21, 2025
@rancher-ui-project-bot rancher-ui-project-bot bot added this to the v2.11.0 milestone Jan 21, 2025
@@ -283,97 +178,8 @@ export default {
return info;
},

fakeMachines() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't seen the behavior described in the comment. It appears were able to scale up and down and the machines/machine pools sync properly without all of these extra hoops.

@@ -243,15 +138,15 @@ export default {
};
},

watch: {
showNodes(neu) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we'll need this anymore especially with the new socket code.

if ( this.$store.getters['management/canList'](MANAGEMENT.NODE_TEMPLATE) ) {
fetchTwo.nodeTemplates = this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE_TEMPLATE });
}
this.clusterToken = await this.value.getOrCreateToken();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can prolly await on both this and the hasLocalCluster to speed things up slightly.

* This class allows us to fake a machine deployment - when created, we set additional properties (_cluster etc)
* and use these in the getters.
**/
class EmptyCapiMachineDeployment extends CapiMachineDeployment {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer used without the machinepool finagling.

@@ -691,26 +543,6 @@ export default {
return day(time).format(this.dateTimeFormatStr);
}
},

machineSortGenerationFn() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This appears to only be necessary if we have the fake machines and nodes but neither appear to be necessary.

@@ -745,33 +577,22 @@ export default {
@update:value="$emit('input', $event)"
>
<Tab
v-if="showMachines"
v-if="showMachines || true"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be removed. Accidentally left this in.

return filterHiddenLocalCluster(this.rows, this.$store);
// We no longer make the request for rows the paginated table does. We still need to access these rows for things like harvester.
filteredRows() {
return this.$refs.paginatedTable?.filteredRows || [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any thoughts on a better way to do this? I don't quite thing getters get us there unless we want to duplicate the filtering.

Comment on lines 98 to 100
if (setting.resource === enabledFor.resource?.id) {
if (!!setting.context) {
return enabledFor.resource?.context ? setting.context.includes(enabledFor.resource.context) : false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not obvious to me why this is necessary? It seems to cause problems if you want to use the PaginatedResourceTable on non-list pages.

Copy link
Member

Choose a reason for hiding this comment

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

This whole block needs to stay.

if (setting.resource === enabledFor.resource?.id) { - used to ensure the correct entry is found
if (!!setting.context) { - the context was used to explictely block pagination outside of supported areas. For instance the prov cluster was only allowed in the side nav and home page and not the cluster management list

Comment on lines 109 to 111
r.serverPagination.stores.cluster.resources.enableSome.enabled.push('provisioning.cattle.io.cluster');
r.serverPagination.stores.cluster.resources.enableSome.enabled.push('cluster');
r.serverPagination.stores.cluster.resources.enableSome.enabled.push('rke.cattle.io.etcdsnapshot');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Temporary to allow paginated requests

Copy link
Member

Choose a reason for hiding this comment

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

in theory the three above shouldn't change anything as they're in the cluster store rather than management.

to get these without code changes, and fix the prov and mgmt cluster contexts (which are now not needed) shell/config/settings.ts serverPagination can be updated and then the new button Populate with latest pagination defaults can be used (and then applied). That process will soon be greatly updated (i have a PR, but it's in flux)

@codyrancher codyrancher force-pushed the management-cluster branch 3 times, most recently from 25db9c0 to 827d555 Compare January 23, 2025 16:00
Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

It doesn't look like the list currently makes SSP requests. I fixed this by comment in shell/utils/settings.ts file.

Once enabled there were failed http calls to secondary resources given the filter wasn't supported by certain type (this is expected, added inline comment). i commented those filters out and the list shows however as there's no configured pagination the columns come from the schema attribute columns rather than matching what was there before. there's a fair few examples on how the pagination headers can be setup in the explorer product

Comment on lines 98 to 100
if (setting.resource === enabledFor.resource?.id) {
if (!!setting.context) {
return enabledFor.resource?.context ? setting.context.includes(enabledFor.resource.context) : false;
Copy link
Member

Choose a reason for hiding this comment

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

This whole block needs to stay.

if (setting.resource === enabledFor.resource?.id) { - used to ensure the correct entry is found
if (!!setting.context) { - the context was used to explictely block pagination outside of supported areas. For instance the prov cluster was only allowed in the side nav and home page and not the cluster management list

Comment on lines 109 to 111
r.serverPagination.stores.cluster.resources.enableSome.enabled.push('provisioning.cattle.io.cluster');
r.serverPagination.stores.cluster.resources.enableSome.enabled.push('cluster');
r.serverPagination.stores.cluster.resources.enableSome.enabled.push('rke.cattle.io.etcdsnapshot');
Copy link
Member

Choose a reason for hiding this comment

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

in theory the three above shouldn't change anything as they're in the cluster store rather than management.

to get these without code changes, and fix the prov and mgmt cluster contexts (which are now not needed) shell/config/settings.ts serverPagination can be updated and then the new button Populate with latest pagination defaults can be used (and then applied). That process will soon be greatly updated (i have a PR, but it's in flux)


if (this.$store.getters[`management/paginationEnabled`]?.(args)) {
const templateOpt = PaginationParamFilter.createMultipleFields([{
field: 'spec.clusterName',
Copy link
Member

Choose a reason for hiding this comment

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

this reference, and snapshot and machine deployments need adding to StevePaginationUtils.VALID_FIELDS and then also to rancher/rancher#48603

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.

Performance: Server-side pagination - Cluster management lists & detail pages
2 participants