Merge pull request #14674 from richard-cox/fix-stale-ns-filter

Ensure ns filter selection is updated when stale entries are removed
This commit is contained in:
Richard Cox 2025-07-04 09:47:04 +01:00 committed by GitHub
commit 28c58ad5a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 2 deletions

View File

@ -63,6 +63,9 @@ export default {
return this.$store.getters[`${ this.currentProduct.inStore }/paginationEnabled`](this.$route.params?.resource) ? paginationUtils.validNsProjectFilters : null;
},
/**
* Create visible options (filtered version of `options`)
*/
filtered() {
let out = this.options;
@ -142,6 +145,9 @@ export default {
return createNamespaceFilterKey(this.$store.getters['clusterId'], this.currentProduct);
},
/**
* Create options (see `filtered` for visible collection)
*/
options() {
const t = this.$store.getters['i18n/t'];
let out = [];
@ -341,6 +347,11 @@ export default {
})
.filter((x) => !!x);
if (filters.length !== values.length) {
// filter has changed, ensure we persist these to store
this.value = filters;
}
return filters;
},
@ -401,7 +412,7 @@ export default {
*
* This is caused by churn of the filtered and options computed properties causing multiple renders for each action.
*
* To break this multiple-render per cycle behaviour detatch `filtered` from the value used in `v-for`.
* To break this multiple-render per cycle behaviour detach `filtered` from the value used in `v-for`.
*
*/
filtered(neu) {

View File

@ -413,6 +413,7 @@ export default {
async findPage(ctx, { type, opt }) {
const { getters, commit, dispatch } = ctx;
// of type @ActionFindPageArgs
opt = opt || {};
if (!opt.pagination) {
@ -444,7 +445,7 @@ export default {
return findAllGetter(getters, type, opt);
}
console.log(`Find Page: [${ ctx.state.config.namespace }] ${ type }. Page: ${ opt.pagination.page }. Size: ${ opt.pagination.pageSize }`); // eslint-disable-line no-console
console.log(`Find Page: [${ ctx.state.config.namespace }] ${ type }. Page: ${ opt.pagination.page }. Size: ${ opt.pagination.pageSize }. Sort: ${ opt.pagination.sort.map((s) => s.field).join(', ') }`); // eslint-disable-line no-console
opt = opt || {};
opt.url = getters.urlFor(type, null, opt);

View File

@ -755,6 +755,7 @@ const defaultActions = {
if (mode === STEVE_WATCH_MODE.RESOURCE_CHANGES) {
// Other findX use options (id/ns/selector) from the messages received over socket.
// However paginated requests have more complex params so grab them from store from the store.
// of type @StorePagination
const storePagination = getters['havePage'](resourceType);
if (!!storePagination) {