Commit Graph

146 Commits

Author SHA1 Message Date
Neil MacDougall 8001967416
Extensions: Add hooks to support virtual clusters (#11064)
* Add hooks to support virtual clusters

* Fix lint issues

* Refinements

* Update for Vue 3 changes

* Fix import

* Minor tweaks

* Fix bug causing e2e tests to fail

* Fix lint issue

* Rename internal properties and ensure they don't break clone/save

* Ensure we generate types for the plugins package to give us access to mapDriver

* Simpler approach

* Fix lint issues and add type

* Remove unused code

* Revery unnecessary changes

* Bug fix for finding model extension

* Factor out string constant and add provider display method

* Add experimental to API

* Update typegen.sh to use SHELL_DIR var

* Move type def

* Fix lint issue

* Address PR feedback

* Update steve-class.js so we always get an array

* Fix type definition
2025-01-31 08:51:58 +00:00
Richard Cox b614082ce1
Add server-side pagination to home page cluster list (#11663)
* Server-side pagination for home page clusters list and side bar clusters

- 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 ???

* Iteration

Note - prov clusters is broken (only fetches local) due to blocking pr. breals
- notPinned list

* Fix dupe inStore
- remove from resource list, put in resource-fetch (used also by pag res table)

* Two fixes
- 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)

* remove comment, backport fix

* test fixes

* E2E: Ensure we wait for cluster entries to exist before clicking on them

* backport fix for local/api filtering

* Remove debug code

* Changes after review

* e2e fixes / debugging

* More e2e fixes

* More e2e fixes

* More e2e fixes

* Fix generic pages that filter on pagination

* Attempt to fix flaky vai test

* Fix after merge from master

* Updates following new indexed files

* Fix lint and test

* Changes given real cluster tests
- 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....

* Fix issues with diplaying rke1 data in home page
- includes https://github.com/rancher/dashboard/pull/12881

* Fix unit tests
2025-01-03 15:34:28 +00:00
Phillip Rak 9cd6679ad8 Remove `markRaw()` from `map`
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2024-12-12 12:27:38 -07:00
Francesco Torchia eac3deaa4b
Add harvester features
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
2024-11-13 15:38:36 +01:00
Richard Cox 24f3a76580
Merge pull request #12171 from richard-cox/reactivity
Update model reactivety
2024-10-18 22:02:59 +02:00
Giuseppe Leo ab2244cf8e
Clone of global admin role not a 100% carbon copy (#12235)
* Add comment about the logic behind the goToClone methods

* Remove verbs key manipulation and map verbs with methods

* Add tests to ensure verbs are not manipulated

* Fix linters
2024-10-18 17:45:31 +02:00
Richard Cox 12fa019b53 Remove unused imports, improve const name 2024-10-09 13:40:00 +01:00
Richard Cox 4d56a7f20e Update model reactivety
- `reactive` was applied to objects that made it into the store via loadAll (or loadPage)
- objects that are assigned to a component `data` object should also be reactive
- however there are scenarios where changes to existing or new properties on these object did not trigger reactivity (computed, watch, etc)
- fix is two parts
  - Ensure all model instances that make it into the store are reactive
    - where we just stick something from `classify` straight into the store... wrap it with reactive
  - Ensure new properties added to a reactive object aren't ignored
    - in `replace` re-reactive the object if there's new properties
2024-10-08 15:41:42 +01:00
Cody Jackson a531b0d77e Making our models reactive
We got rid of reactivity when we remove Vue.set() I've added it back. In this case it's specifically to make the feature flags table reactive when activating and deactivating flags.
2024-08-22 16:09:56 -07:00
Phillip Rak e39ce7899f Resolve a batch of unit test failures
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2024-08-22 16:09:54 -07:00
cnotv ff08d80e0e Lint: Manually fixed issues related to vueApp variable added by the script 2024-08-22 16:07:03 -07:00
Cody Jackson 4bfb53c751 Fixing how we access the current route in our resource-class 2024-08-22 16:05:37 -07:00
Phillip Rak e207487074 Fix "$ctx" error when clicking login button
An error occurred logging in: proxy must report the same value for the non-writable, non-configurable property '"$ctx"'

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2024-08-22 16:05:37 -07:00
Cody Jackson 9b829c55ea Ran `yarn lint --fix` 2024-08-22 16:05:36 -07:00
Cody Jackson d5ce4fff2e Run the vue3 migration script
Commands run:

➤ yarn migrate
➤ git clean -fdx
➤ nvm use 20
➤ yarn
2024-08-22 16:05:36 -07:00
Richard Cox 08f05e229a Paginated Label Select Fixes
### No Options Shown
- Ensure all ResourceLabeledSelect attributes reach LabelSelect component
- This worked at some point, but $attrs now does not contain values that are defined as component props

### Cannot `Load More` options
- `Pages` param Missing in API response
- This has been removed, work around added

### Search term isn't matching partial results
- ensure exact filter matching is off
2024-07-23 12:10:53 +01:00
Richard Cox b34a57c3e3 Ensure count shown in side nav is correct
- A new `counts` getter was created to improve performance of the side nav (specifically Type component)
- This contained the functionality from
  - SideNav (count came from typemap 48d5695359 (diff-3ad9f7560480743de6a82ac01d6f961c5c8674095bf5a27c65287d4946b88fc3L1687))
  - Jump (count came from typemap AND itself 48d5695359 (diff-38a7ef0c623e19def1d9489f91f35089ceabf49da206a3fc298327d3eccfb584L44))
- Previously in both cases if all namespaces were selected it didn't pass in a list of namespaces when calculating the total count
- This was missed, so we were passing in a restrictive set of namespaces to the count
2024-07-16 13:49:34 +01:00
Richard Cox bfaf90e555
Merge pull request #11215 from richard-cox/limit-bindings
Add conditional depagination by native api, apply to bindings
2024-06-21 15:15:50 +01:00
Giuseppe Leo c36b071e40
Remove every reference to .nuxt global option (#11265)
* Remove unused rehydratation plugin

* Remove any reference to the .nuxt folders

* Remove globalApp nuxt and any reference or use case to nuxt.error

* Replace errors handling with existing fail-whale logic
2024-06-21 11:15:05 +02:00
Richard Cox ac4abfacc7 Fix norman cases which were attempting to call fetchResourceFields, revert type caps change 2024-06-12 13:22:21 +01:00
Richard Cox 3c84d2c0d7 Add conditional depagination by native api, apply to bindings
We could just set depaginate to true, however this would break management of members both explorer and cluster management side at scale.
Hopefully in 2.10.0 there'll be a permanent fix for this (server-side pagination)


Main change
- change depaginate type setting from boolean to boolean || function
- depaginate function will conditionally be true
- currently condition only supports limited depagination by a pre-defined count

In addition / supporint changes
- fix lookup of norman types settings (case sensative)
- fix currentProduct(resource) lookups for norman cluster and project roles
2024-06-12 12:42:07 +01:00
Richard Cox a5661c575f
Remove usages of findAll for types supported by server-side pagination (#10795)
* Changes for new design
- 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

* Changes following review

* Update Node list to support server-side pagination
- 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

* Lint / test / fixes

* Improvements to configmap e2e test & Improve pagination disabled

* Beef up validation

* Fix missing name column in non-server-side paginated node list

* Fix PR automation actions
- fix syntax
- catch scenario where a pr has no fixed issue

> There's duplication between files, see https://github.com/rancher/dashboard/pull/10534

* CI bump

* Fixes post merge

* Wire in 2.9.0 settings for server-side pagination
- 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

* Integrate pagination with configmaps in cis clusterscanbenchmark edit form
Also
- improved labeled select pagination
- gate label select pagination functinality on steve cache being enabled

* - harvester machine-config
- project monitoring (and bug fixes)

* Disable workload screen if vai cache is on
- temp step until we get new overview

* TODOs and TEST

* Conditionally remove fetch of all secrets from SelectOrCreateAuthSecret

* TODOs and TEST

* Update SimpleSecretSelector
- only used in monitoring.coreos.com.alertmanagerconfig context

* View and Edit ingress - secrets

* node detail page - pods list

* Backup/Restore: Secrets (WIP)

* Backup/Restore: Secrets, and other usages of SimpleSecretSelector / SelectOrCreateAuthSecret

* Edit: Service account

* Add comments for remaining items

* Paginate Secret selection for logging providers
- Allow `None` option in Paginationed LabelSelect
- Optionally classify pagination response

* WIP

* fixes arfter merge

* Don't suggest container names, not practical
- previously all pods were fetched... and we scrapped all container names from them
- this is a scaling nightmare, user now must just enter the name/s to match

* Avoid findAll secrets in SimpleSecretSelector

* tidying up

* Move LabeledSelect/index.vue back to LabeledSelect.vue to not break extensions

* changes after self review... 1

* changes after self review... 2

* ooof

* changes after self review... 3

* fix formatting

* Link new paginated label select with pagination setting

* Work around failing kubewarden unit tests in check-plugins gate

* Fix backup.spec e2e test

* fix formatting, paginationUtils.isSteveCacheEnabled --> paginationUtils.isEnabled

* Don't fetch all secrets on cloud creds page

* Fix backup.spec e2e test

* TODO tidying / tracking

* don't getch ALL workloads for hacky way to get a link to a service's workload

* Fix bad merge

* Create a convienence wrapper called ResourceLabelSelector that hides most of the complexity

* fix unit test

* Updates following review

* changes following self review

* Fix bottom bar of edit backup, edit restore pages

* revert temp change

* changes following self review

* Workaround for kubewarden unit tests in check plugin gate

* bump

* Fix e2e
2024-06-05 09:15:43 +01:00
Richard Cox 3ab6c904d2 Tidy up logic 2024-06-03 11:23:35 +01:00
Richard Cox 1c86adf462 Fix duplicate list rows on resource create race condition
- Resources are added to our resource map & list on resource create and on socket updates
- When resources are created..
  - the http response is usually received first, and the resource is added to both resource map and list
  - any socket updates received afterwards will then update that first resource entry
- However there are scenarios where..
  - the http response is sent, but responce not yet received
  - the socket event for the created resource is then received, and resource is added to resource map and list
  - the http response is then received. the load mutator would then ADD to the list and SET in the map
  - this caused two rows for the resource to show in it's list view
2024-05-31 14:24:43 +01:00
Phillip Rak b722e409b7 Use `markRaw()` to signal non reactive data in store
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
2024-05-22 12:55:06 -07:00
Richard Cox 6ff9e318de
Merge pull request #10807 from richard-cox/fix-zero-cluster-count
Ensure blank cluster does not have a cluster namespace context
2024-05-09 10:45:55 +01:00
Richard Cox 0dfe5d5ccd Beef up validation 2024-04-30 11:04:06 +01:00
Richard Cox f0c397c001 Update Node list to support server-side pagination
- 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
2024-04-30 11:04:06 +01:00
Richard Cox 081aa0e5c9 Ensure blank cluster does not have a cluster namespace context
- when we change cluster we set things up via `loadCluster`
- `loadCluster` with call `updateNamespaces` with current cluster filters and namespaces
- this was not happening when switching to a blank cluster, so anything that cached namespaces still had the old cluster's context
- also
  - small optimisation to `count` getter (if not namespaced, don't mess around with ns cache)
  - added comments to places
2024-04-16 14:05:09 +01:00
Richard Cox e80fd7f063 Fix post merge 2024-04-02 14:22:31 +01:00
Richard Cox 0862b80433 Changes following review
- General changes following review comments
- Fix issue where in local cluster the systen classed namespace associated with a project would get muddled with selecting user resources in mathing project
  - Part of this is a big refacture, most of the code to create pag filter params is now in a helper filer
  - Added much improved typing
- Fixed issue where the dynamic namespaces (c-, p-, etc) weren't correctly hidden
- Move user to previous page if last entry on last page deleted (and there is a previous page)
- Fix confusing preference to hide dynamic namespaces (c-, p-, etc)
2024-04-02 14:22:24 +01:00
Richard Cox 487263f4e8 fix tests, getter name change haveAllPaginated --> havePaginatedPage 2024-04-02 13:34:36 +01:00
Richard Cox de131f8a26 Remove paginationEquals from store, and move steve compare to generic utils file 2024-04-02 13:34:36 +01:00
Richard Cox 1929122124 Split out findPage concept form findAll 2024-04-02 13:34:36 +01:00
Richard Cox d25ec477ae Update comments 2024-04-02 13:34:36 +01:00
Richard Cox 09614b0136 Server-side pagination
Polish and fixes from alpha
2024-04-02 13:34:36 +01:00
Richard Cox ae7eb102ad Pagination Alpha 2024-04-02 13:34:36 +01:00
Neil MacDougall f6c80b295f
Add root product to improve performance of nav change within inExplorer products (#10447)
* Fix race condition in loadCluster

* Revert new error and comments

* Improve navigation performance for products within the explorer product

* Remove unused getter

* Fix issue with not loading nwe cluster when changing clusters

* Fix bug where sidenav take a short time to update (was using queueUpdate)

* Fix lint issues

* Address PR feedback
2024-03-28 09:28:23 +00:00
Richard Cox d6122779a2
Merge pull request #10669 from richard-cox/fix-node-spam
Handle resources that cannot be watched
2024-03-27 11:03:52 +00:00
Richard Cox 89d4eab4ca
Merge pull request #10455 from richard-cox/fix-dup-mgmt-setting-requests
Remove duplicate calls to mgmt settings on fresh load
2024-03-27 11:03:21 +00:00
Richard Cox a91f0303db Revert fixes for list vs individual watch handling
- 9318936c72
- BUG 1
  - Navigating from nodes list to a node detail page unwatches nodes list but doesn't watch new resources
  - Node's list destroy has a forgetType node
    - this removes entries from store and unwatches nodes list watch
    - we clear the fact we're watching the node list once we receieve a resource.stop from socket
  - There's a race condition, the node we're going to is still in the store... but the find action for this doesn't kick off a watch for the rsource
  - This was resolved by the change in the find action
- BUG 2
  - Refreshing on the detail page results in a watch for that specific node
  - Navigating to the list starts a watch for all nodes, but doesn't stop the individual watch
  - This was resolved by the change in subscribe
- HOWEVER
  - These fixes could impact how what we watch in other cases where we might call find all and find specific in the same context
  - Safer to address later
2024-03-26 16:59:14 +00:00
Richard 7ee02dd10c Add unit tests 2024-03-26 16:00:08 +00:00
Richard f4416cc647 Fix two more watch related node watch related bugs
1. Switching from a detail page with a watch on a specific resource to the list page where we watch all resources did not unwatch on the specific one
2. Switching to a detail page of a resource that's already in the store should ensure we're watching it
2024-03-26 16:00:08 +00:00
Richard Cox 64e3e923f6
Merge pull request #10480 from richard-cox/fix-pod-cache
Ensure pods loaded by incremental loadDataPage make it to the pod by namespace cache
2024-03-26 15:32:45 +00:00
codyrancher b0d2dcbeb4
Vue 3 Nuxtism Removal (#10533)
* Removing everything related to scrollTrigger.

The latest vue router seems to behave exactly as it does with the modified scrollBehavior so it can all be removed.

* Removing unused $nuxt.{suffixes} that I found
- routeChanged  (didn't find any watches of this event)
- nbFetching (The only place reading this was a computed property which wasn't used anywhere)

* Replace the use of Vue[installKey]

* Removing some ssr rehydration code since we're not doing ssr

* Remove the remaining $nuxt.$on,$off,$emit and replace with the use of our primary store which already had related code

* Replacing usages of the .$nuxt on vue instances with globalApp references

* Removing SSR dead code

* Fixing an issue where extensions could still be referencing window.$nuxt. This now provides a deprecation warning.

* Migrating another $nuxt over to the window.$globalApp

* Removed the usage of Vue.config.$nux

* Removed the usage of Vue.util.defineReactive

- Saw that the Nuxt component wasn't needed any longer so I removed it instead of trying to work around Vue.util.defineReactive

* Re-run missing check

---------

Co-authored-by: cnotv <giuseppe.leo@suse.com>
2024-03-11 18:38:25 +01:00
Richard Cox 5ba075f891 Changes following review
- better comments
- improved tests
- handle trailing url `/`
2024-03-08 11:25:32 +00:00
Richard Cox 01683ae8f4 Ensure `too old` messages for watches in individual resources are handled correctly
- also fix issue where `find` on `resyncWatch` didn't work with namespaced resources
2024-03-07 11:18:54 +00:00
Richard Cox 1fe8f7368d Add unit tests 2024-03-04 14:30:41 +00:00
Richard Cox 08f612eab7 Ensure pods loaded by incremental loadDataPage make it to the pod by namespace cached
- Also address a possible race condition made more likely by change
2024-03-04 14:30:41 +00:00
Neil MacDougall 3faa4ad729
Fix race condition in loadCluster (#10445)
* Fix race condition in loadCluster

* Revert new error and comments
2024-03-04 12:55:48 +00:00