Skip to content

Commit

Permalink
Two fixes
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
richard-cox committed Dec 4, 2024
1 parent 442d85c commit cb18993
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
9 changes: 7 additions & 2 deletions shell/components/nav/TopLevelMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Pinned from '@shell/components/nav/Pinned';
import { getGlobalBannerFontSizes } from '@shell/utils/banners';
import { TopLevelMenuHelperPagination, TopLevelMenuHelperLegacy } from 'components/nav/TopLevelMenu.helper';
import { debounce } from 'lodash';
import { sameContents } from '@shell/utils/array';
// TODO: RC (home page/side bar) test search properly
Expand Down Expand Up @@ -265,8 +266,12 @@ export default {
pinnedIds: {
immediate: true,
handler(ids) {
this.updateClusters(ids);
handler(neu, old) {
if (sameContents(neu, old)) {
return;
}
this.updateClusters(neu);
}
},
Expand Down
17 changes: 15 additions & 2 deletions shell/mixins/resource-fetch-api-pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
},

namespaceFilterChanged(neu) {
if (!this.canPaginate || !this.schema?.attributes?.namespaced || !this.namespaced) {
if (!this.canPaginate || !this.isNamespaced) {
return;
}

Expand Down Expand Up @@ -176,6 +176,10 @@ export default {
return;
}

if (!this.resource) {
return false;
}

const args = {
id: this.resource.id || this.resource,
context: this.context,
Expand Down Expand Up @@ -213,6 +217,15 @@ export default {
showDynamicRancherNamespaces() {
return this.$store.getters['prefs/get'](ALL_NAMESPACES);
},

isNamespaced() {
if (typeof this.namespaced !== 'undefined') {
// This is an override, but only if it's set
return !!this.namespaced;
}

return this.schema?.attributes?.namespaced;
}
},

watch: {
Expand All @@ -236,7 +249,7 @@ export default {
namespaceFilters: {
immediate: true,
async handler(neu, old) {
if (!this.canPaginate || !this.schema?.attributes?.namespaced) {
if (!this.canPaginate || !this.isNamespaced) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion shell/mixins/resource-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default {
// 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 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 {
Expand Down

0 comments on commit cb18993

Please sign in to comment.