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

Cluster Explorer: Restrict / Remove usages of findAll: traditional types #13025

Merged
merged 93 commits into from
Jan 24, 2025

Conversation

richard-cox
Copy link
Member

@richard-cox richard-cox commented Jan 9, 2025

Blocked on

Requires squash-merge

Summary

Fixes #13045

Does not cover others from #9965 or those related to #10417

Occurred changes and/or fixed issues

  • Converted to use ResourceLabeledSelect (LabelSelect with paging if SSP for type is enabled)
  • Replace fetchAll with fetchAll within specific namespace (more risk than full pagination, but cleaner and benefits world where SSP is disabled as well)
    • all workload types in the namespace detail page used to show workloads list
      • note that the workloads by state components (top bar and list) get their info from the counts endpoint rather than calculating from all resources
    • services and certs (secrets of type tls) in ingress detail page used to show associated resources
      • same but for ingress edit page to show possible associated resources
      • these use a common helper file
  • CronJobs now find their associated jobs individually, rather than fetching all jobs and then filtering
  • Smaller changes
  • Added comments where areas need addressing via Application of selectors locally scales badly #10417

Areas or cases that should be tested

  • Questions Resources type (see above)
  • A selection of various resource detail page's events tab
  • Cluster --> Project/Namespaces --> any namespace --> workloads list
  • Service Discovery --> Ingresses --> Create and Edit, specifically selecting certificates and rule service
  • Workloads --> CronJobs --> click on cron job --> Jobs tab --> correct Jobs are shown
  • Cluster --> Node (list) --> Displays correct secondary resource fields (including pod info)
  • Cluster --> Storage --> Persistent Volumn (list) --> Displays correct secondary resource fields (PVCs)

Areas which could experience regressions

  • as per above

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

- 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 ???
…would incorrectly fetch all resources anyway

- convert reminaing storage lists
- 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 ???
Note - prov clusters is broken (only fetches local) due to blocking pr. breals
- notPinned list
- remove from resource list, put in resource-fetch (used also by pag res table)
- remove from resource list, put in resource-fetch (used also by pag res table)
- changes namespaces kicked of side nav cluster requests (thought pinnedIds changed)
- fix generic lists re-fetching given ns filter changes (they don't have namespaced arg)
@richard-cox richard-cox added this to the v2.11.0 milestone Jan 9, 2025
@richard-cox richard-cox changed the title Remove usages of findAll for core resources in cluster explorer view - 2 Remove usages of findAll for core resources in cluster explorer view Jan 13, 2025
@richard-cox richard-cox changed the title Remove usages of findAll for core resources in cluster explorer view Cluster Explorer: Restrict / Remove usages of findAll: traditional types Jan 13, 2025
@richard-cox richard-cox marked this pull request as ready for review January 13, 2025 15:14
promises.push(this.fetchSecondaryResources({ canPaginate: this.canPaginate }));
const res = this.fetchSecondaryResources({ canPaginate: this.canPaginate });

promises.push(Array.isArray(res) ? res : [res]);
Copy link
Contributor

Choose a reason for hiding this comment

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

By any chance do you mean to deconstruct the array before pushing?

promises.push(...(Array.isArray(res) ? res : [res]));

I don't think Promise.all() accepts nested arrays of promises.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. That's a bug. There was another as well, as map of promises was the alternative

I reworked this in the end and now the response to fetchSecondaryResources will always be a single promise (the map was pointless as it would be just mapped into an array of promises). This might affect your PR

Comment on lines +129 to +130
:paginated-resource-settings="paginateResourceSetting"
:all-resources-settings="allResourceSettings"
Copy link
Contributor

@codyrancher codyrancher Jan 22, 2025

Choose a reason for hiding this comment

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

By any chance do we want to keep the interface consistent with PaginatedResourceTable? i.e. api-filter and local-filter.

Or maybe update PaginatedResourceTable to use a settings style object.

Copy link
Member Author

Choose a reason for hiding this comment

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

when i stumbled over this again i had the same thought.

i'll update cover

  • prop names
  • make a common type to fetch / filter the resources

Copy link
Member Author

Choose a reason for hiding this comment

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

went full circle.

the prop names here better describe what the control is doing (showing all in a dropdown or showing pages in a dropdown), the function calls are also different in nature.

did tidy it up though and move the types into their own file, added jsdocs, etc c19aabe

Comment on lines +217 to +219
if (!!existing) {
Object.assign(existing, required);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be nice to emit a warning or something in the console if this happens, I can imagine a case where things overwritten leading to an author having to dig to figure out why.

Copy link
Member Author

Choose a reason for hiding this comment

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

This use case covers the user hitting the refresh button and the same pagination settings come through again. It's also restricted to the events table, so the chance of a dev overriding it somewhere is low.

Copy link
Contributor

@codyrancher codyrancher left a comment

Choose a reason for hiding this comment

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

Just requesting changes based on my individual comments.

- fix and simplify FetchPageSecondaryResources
- ensure resource detail page events list doesn't add ns filters (not needed)
@richard-cox richard-cox merged commit 9985ce0 into rancher:master Jan 24, 2025
32 checks passed
@richard-cox richard-cox deleted the pagination-remove-findall-2 branch January 24, 2025 09:18
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.

Cluster Explorer: Restrict / Remove usages of findAll: traditional types
2 participants