mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 13:59:40 +02:00
fix(ui): namespace cache refresh on reload EE-5155 (#8644)
This commit is contained in:
parent
44582732bb
commit
6ee5cc6a56
9 changed files with 28 additions and 15 deletions
|
@ -81,18 +81,19 @@ class KubernetesNamespaceService {
|
|||
}
|
||||
}
|
||||
|
||||
async get(name) {
|
||||
async get(name, refreshCache = false) {
|
||||
if (name) {
|
||||
return this.$async(this.getAsync, name);
|
||||
}
|
||||
const cachedAllowedNamespaces = this.LocalStorage.getAllowedNamespaces();
|
||||
if (cachedAllowedNamespaces) {
|
||||
updateNamespaces(cachedAllowedNamespaces);
|
||||
return cachedAllowedNamespaces;
|
||||
} else {
|
||||
if (!cachedAllowedNamespaces || refreshCache) {
|
||||
const allowedNamespaces = await this.getAllAsync();
|
||||
this.LocalStorage.storeAllowedNamespaces(allowedNamespaces);
|
||||
updateNamespaces(allowedNamespaces);
|
||||
return allowedNamespaces;
|
||||
} else {
|
||||
updateNamespaces(cachedAllowedNamespaces);
|
||||
return cachedAllowedNamespaces;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue