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

Wire in pagination to LabeledSelect and use for pods, secrets and configmaps #10786

Merged
merged 31 commits into from
May 30, 2024

Conversation

richard-cox
Copy link
Member

@richard-cox richard-cox commented Apr 11, 2024

Blocked on #10781

Supersedes #10068

Summary

Contributes to #9964

Occurred changes and/or fixed issues

  • LabelSelect now provides a way to optionally handle large number of resources by making paginated api requests
    • New LabelSelect mixin (this was already written pre composite change) handles pagination functionality
    • Mixin provides the hooks to LabelSelect to control and display pagination features
  • Components that use LabelSelect and want to use pagination have two options
    • Easy Mode (Use new helper component ResourceLabelSelect)
      • ResourceLabelSelect is a wrapper around LabelSelect and takes the same base properties
      • It handles the harder things listed below
      • If the specific use cases needs to do more than just 'fetch all of a resource' then props can be supplied to override/interject it's pipelines
        • Some examples
          • the component wants the resources in the label select
          • The resources in the label select should be filtered in special ways (either for all resources or paginated resources)
          • different LabelSelect options should be used if the list is paginated
    • Harder Mode (Use LabelSelect directly)
      • gate on paginationUtils.isEnabled being ON (steve cache ff flag on, ui pagination on)
      • supply a function to LabelSelect which will, on demand from LabelSelect, fetch a page
        • This only handles the http request and nothing else
        • There is a helper function to make this easy to use
      • Components should still continue to support the existing functionality should
        • gate on paginationUtils.isEnabled being OFF (steve cache ff flag or ui pagination off)
        • supply an options collection to LabelSelect
  • Places that have been updated to remove usages of findAll pod, secret and configmap
    • shell/chart/rancher-backup/S3.vue
      • Paginated Label Select - Used when selecting a secret when installing the backup chart
    • shell/components/form/SecretSelector.vue
      • Paginated Label Select - Used by logging product's providers to select a secret
    • shell/components/form/SimpleSecretSelector.vue
      • Paginated Label Select - Used by alert manager - config (in monitoring) to select a secret
    • shell/edit/cis.cattle.io.clusterscanbenchmark.vue
      • Paginated Label Select - Used by CIS Benmark - Editing benchmark to select a configmap
    • shell/edit/logging-flow/Match.vue
      • Logging - Editing a Flow - Matches - removed options for limiting to a specific container. Previously this involved fetching all pods and showing all their containers. There's no neat way to do this with pagination and decided the neatest path is just to remove the options

UX changes (after design review)

  • The 'group' visuals have been improved and can now show an icon
  • Note - Colours have not been changed as per design. These all work with generic colours that apply to the whole dashboard. Changing them specifically for this component would introduce tech debt. We should consider the component colour when making changes to all colours.

Technical notes summary

  • There's two temp bools in shell/utils/pagination-utils.ts, TEMP_VAI_CACHE_MERGED and TEMP_PERF_ENABLED. These will be removed pre 2.9.0 when the steve cache is merged and we can just run on the FF and perf setting to enable/disable the features

Areas or cases that should be tested

With both performance pagination setting and feature flag off

  • General use
    • LabelSelect should show values, allow the user to search for them with text and select one (or more if applicable)
  • Specific cases to test
    • local cluster --> Cluster Tools --> Rancher Backup Install --> Next --> Use an S3-compatible object store --> Credential Secret (this is the affected component)
    • any cluster --> install CIS benchmark helm chart --> CIS Benchmark menu item --> Benchmark Versions --> Create --> Custom Benchmark ConfigMap (this is the affected component
    • any cluster --> install Logging helm chart --> Logging menu item --> Flows --> Create --> Matches tab --> Limit to specific container names should be empty, and accept any number of free text entries
    • any cluster --> install Logging helm chart --> Logging menu item --> Outputs --> Create --> <any type of Output --> Access --> Credentials from Secret should show secrets
    • any cluster --> install Monitoring and Alert Manager helm charts --> Monitoring menu item --> AlertmanagerConfigs --> Create one --> Edit it --> Add Receiver --> Slack --> Add Slack --> Secret with Slack Webhook urk should show secrets
  • Selecting multiple options - Logging Product --> Flows --> Create --> Matches tab --> Limit to specific nodes
  • Complex use case - Deployments --> create --> namespace drop down should continue to function as before

The above should be repeated with the performance pagination setting and feature flag on

Areas which could experience regressions

  • Anywhere we show drop downs

Screenshot/Video

image

image

- New visuals
- Pagination controls --> load more
- finished testing of label select with pagination off

# Conflicts:
#	shell/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts
- Setup pagination headers for the node type
- Define a pattern for fetching custom list secondary resources
- Major improvements to the way pagination settings are defined and created
- Lots of docs improvements
- Handle calling fetch again once fetch is in progress (nuxt caches running request)
- Validate filter fields (not all are supported by the vai cache
- General pagination fixes
- fix syntax
- catch scenario where a pr has no fixed issue

> There's duplication between files, see rancher#10534
- Everything is gated on `on-disk-steve-cache` feature flag
  - There's a backend in progress item to resolve a `revision` issue, until then disable watching a resource given it
- Global Settings - Performance
  - Added new setting to enable server side pagination
  - this is incompatible with two other performance settings
… form

Also
- improved labeled select pagination
- gate label select pagination functinality on steve cache being enabled
- Allow `None` option in Paginationed LabelSelect
- Optionally classify pagination response
@richard-cox richard-cox changed the title Wire in pagination to LabeledSelect, use when installing Rancher Backup chart, creating Benchmark Versions Wire in pagination to LabeledSelect and use for pods, secrets and configmaps May 16, 2024
@richard-cox richard-cox force-pushed the pagination-findall-configmaps branch from a701841 to 9afb8db Compare May 21, 2024 16:44
@richard-cox richard-cox marked this pull request as ready for review May 21, 2024 18:51
codyrancher
codyrancher previously approved these changes May 23, 2024
@richard-cox
Copy link
Member Author

@codyrancher I updated given a recommendation from Neil to wrap some of the repeated / tricky code in a new component. Description's been updated, would you be able to take another look?

@richard-cox richard-cox merged commit 542ebd4 into rancher:master May 30, 2024
28 checks passed
@richard-cox richard-cox mentioned this pull request Jul 23, 2024
7 tasks
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.

None yet

3 participants