mirror of https://github.com/rancher/dashboard.git
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:
commit
28c58ad5a1
|
|
@ -63,6 +63,9 @@ export default {
|
||||||
return this.$store.getters[`${ this.currentProduct.inStore }/paginationEnabled`](this.$route.params?.resource) ? paginationUtils.validNsProjectFilters : null;
|
return this.$store.getters[`${ this.currentProduct.inStore }/paginationEnabled`](this.$route.params?.resource) ? paginationUtils.validNsProjectFilters : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create visible options (filtered version of `options`)
|
||||||
|
*/
|
||||||
filtered() {
|
filtered() {
|
||||||
let out = this.options;
|
let out = this.options;
|
||||||
|
|
||||||
|
|
@ -142,6 +145,9 @@ export default {
|
||||||
return createNamespaceFilterKey(this.$store.getters['clusterId'], this.currentProduct);
|
return createNamespaceFilterKey(this.$store.getters['clusterId'], this.currentProduct);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create options (see `filtered` for visible collection)
|
||||||
|
*/
|
||||||
options() {
|
options() {
|
||||||
const t = this.$store.getters['i18n/t'];
|
const t = this.$store.getters['i18n/t'];
|
||||||
let out = [];
|
let out = [];
|
||||||
|
|
@ -341,6 +347,11 @@ export default {
|
||||||
})
|
})
|
||||||
.filter((x) => !!x);
|
.filter((x) => !!x);
|
||||||
|
|
||||||
|
if (filters.length !== values.length) {
|
||||||
|
// filter has changed, ensure we persist these to store
|
||||||
|
this.value = filters;
|
||||||
|
}
|
||||||
|
|
||||||
return 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.
|
* 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) {
|
filtered(neu) {
|
||||||
|
|
|
||||||
|
|
@ -413,6 +413,7 @@ export default {
|
||||||
async findPage(ctx, { type, opt }) {
|
async findPage(ctx, { type, opt }) {
|
||||||
const { getters, commit, dispatch } = ctx;
|
const { getters, commit, dispatch } = ctx;
|
||||||
|
|
||||||
|
// of type @ActionFindPageArgs
|
||||||
opt = opt || {};
|
opt = opt || {};
|
||||||
|
|
||||||
if (!opt.pagination) {
|
if (!opt.pagination) {
|
||||||
|
|
@ -444,7 +445,7 @@ export default {
|
||||||
return findAllGetter(getters, type, opt);
|
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 = opt || {};
|
||||||
opt.url = getters.urlFor(type, null, opt);
|
opt.url = getters.urlFor(type, null, opt);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -755,6 +755,7 @@ const defaultActions = {
|
||||||
if (mode === STEVE_WATCH_MODE.RESOURCE_CHANGES) {
|
if (mode === STEVE_WATCH_MODE.RESOURCE_CHANGES) {
|
||||||
// Other findX use options (id/ns/selector) from the messages received over socket.
|
// 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.
|
// However paginated requests have more complex params so grab them from store from the store.
|
||||||
|
// of type @StorePagination
|
||||||
const storePagination = getters['havePage'](resourceType);
|
const storePagination = getters['havePage'](resourceType);
|
||||||
|
|
||||||
if (!!storePagination) {
|
if (!!storePagination) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue