From 442d85c2c805d6fffd55fcbdb3fe2508b8e9ead8 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Tue, 3 Dec 2024 10:14:56 +0000 Subject: [PATCH] Fix dupe inStore - remove from resource list, put in resource-fetch (used also by pag res table) --- shell/components/ResourceList/index.vue | 1 - shell/mixins/resource-fetch-api-pagination.js | 4 ---- shell/mixins/resource-fetch.js | 11 ++++++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/shell/components/ResourceList/index.vue b/shell/components/ResourceList/index.vue index 28e399da679..7d66ac23764 100644 --- a/shell/components/ResourceList/index.vue +++ b/shell/components/ResourceList/index.vue @@ -96,7 +96,6 @@ export default { const showMasthead = getters[`type-map/optionsFor`](resource).showListMasthead; return { - inStore, schema, hasListComponent, showMasthead: showMasthead === undefined ? true : showMasthead, diff --git a/shell/mixins/resource-fetch-api-pagination.js b/shell/mixins/resource-fetch-api-pagination.js index e73e9b18640..7e548c51f57 100644 --- a/shell/mixins/resource-fetch-api-pagination.js +++ b/shell/mixins/resource-fetch-api-pagination.js @@ -213,10 +213,6 @@ export default { showDynamicRancherNamespaces() { return this.$store.getters['prefs/get'](ALL_NAMESPACES); }, - - inStore() { - return this.$store.getters['currentStore'](this.resource) || this.currentProduct?.inStore; - } }, watch: { diff --git a/shell/mixins/resource-fetch.js b/shell/mixins/resource-fetch.js index 171bb0a4fbd..44fe62718e9 100644 --- a/shell/mixins/resource-fetch.js +++ b/shell/mixins/resource-fetch.js @@ -31,11 +31,18 @@ export default { perfConfig = DEFAULT_PERF_SETTING; } + // 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 + const inStore = this.$store.getters['currentStore'](resource); + return { + inStore, perfConfig, init: false, multipleResources: [], - loadResources: [this.resource], + loadResources: [resource], // manual refresh vars hasManualRefresh: false, watch: true, @@ -72,6 +79,7 @@ export default { computed: { ...mapGetters({ refreshFlag: 'resource-fetch/refreshFlag' }), + rows() { const currResource = this.fetchedResourceType.find((item) => item.type === this.resource); @@ -92,6 +100,7 @@ export default { return []; }, + loading() { if (this.canPaginate) { return this.paginating;