Fix dupe inStore

- remove from resource list, put in resource-fetch (used also by pag res table)
This commit is contained in:
Richard Cox 2024-12-03 10:14:56 +00:00
parent f1858b6f02
commit 96b6b9abd7
3 changed files with 10 additions and 7 deletions

View File

@ -96,11 +96,9 @@ export default {
const showMasthead = getters[`type-map/optionsFor`](resource).showListMasthead; const showMasthead = getters[`type-map/optionsFor`](resource).showListMasthead;
return { return {
inStore,
schema, schema,
hasListComponent, hasListComponent,
showMasthead: showMasthead === undefined ? true : showMasthead, showMasthead: showMasthead === undefined ? true : showMasthead,
resource,
extensionType: ExtensionPoint.PANEL, extensionType: ExtensionPoint.PANEL,
extensionLocation: PanelLocation.RESOURCE_LIST, extensionLocation: PanelLocation.RESOURCE_LIST,
loadResources: [resource], // List of resources that will be loaded, this could be many (`Workloads`) loadResources: [resource], // List of resources that will be loaded, this could be many (`Workloads`)

View File

@ -213,10 +213,6 @@ export default {
showDynamicRancherNamespaces() { showDynamicRancherNamespaces() {
return this.$store.getters['prefs/get'](ALL_NAMESPACES); return this.$store.getters['prefs/get'](ALL_NAMESPACES);
}, },
inStore() {
return this.$store.getters['currentStore'](this.resource) || this.currentProduct?.inStore;
}
}, },
watch: { watch: {

View File

@ -31,11 +31,18 @@ export default {
perfConfig = DEFAULT_PERF_SETTING; 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 { return {
inStore,
perfConfig, perfConfig,
init: false, init: false,
multipleResources: [], multipleResources: [],
loadResources: [this.resource], loadResources: [resource],
// manual refresh vars // manual refresh vars
hasManualRefresh: false, hasManualRefresh: false,
watch: true, watch: true,
@ -72,6 +79,7 @@ export default {
computed: { computed: {
...mapGetters({ refreshFlag: 'resource-fetch/refreshFlag' }), ...mapGetters({ refreshFlag: 'resource-fetch/refreshFlag' }),
rows() { rows() {
const currResource = this.fetchedResourceType.find((item) => item.type === this.resource); const currResource = this.fetchedResourceType.find((item) => item.type === this.resource);
@ -92,6 +100,7 @@ export default {
return []; return [];
}, },
loading() { loading() {
if (this.canPaginate) { if (this.canPaginate) {
return this.paginating; return this.paginating;