mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix: load releases for all namespaces at once (#2139)
* Load releases for all namespaces at once Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Check for accessibleNamespaces length Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Replacing loadAll() to loadFromContextNamespaces() Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
436bb7683d
commit
2c196ec3ad
@ -33,7 +33,7 @@ export class ReleaseStore extends ItemStore<HelmRelease> {
|
||||
});
|
||||
|
||||
if (amountChanged || labelsChanged) {
|
||||
this.loadAll();
|
||||
this.loadFromContextNamespaces();
|
||||
}
|
||||
this.releaseSecrets = [...secrets];
|
||||
});
|
||||
@ -58,7 +58,7 @@ export class ReleaseStore extends ItemStore<HelmRelease> {
|
||||
}
|
||||
|
||||
@action
|
||||
async loadAll(namespaces = namespaceStore.allowedNamespaces) {
|
||||
async loadAll(namespaces: string[]) {
|
||||
this.isLoading = true;
|
||||
|
||||
try {
|
||||
@ -78,9 +78,16 @@ export class ReleaseStore extends ItemStore<HelmRelease> {
|
||||
}
|
||||
|
||||
async loadItems(namespaces: string[]) {
|
||||
return Promise
|
||||
.all(namespaces.map(namespace => helmReleasesApi.list(namespace)))
|
||||
.then(items => items.flat());
|
||||
const isLoadingAll = namespaceStore.allowedNamespaces.every(ns => namespaces.includes(ns));
|
||||
const noAccessibleNamespaces = namespaceStore.context.cluster.accessibleNamespaces.length === 0;
|
||||
|
||||
if (isLoadingAll && noAccessibleNamespaces) {
|
||||
return helmReleasesApi.list();
|
||||
} else {
|
||||
return Promise
|
||||
.all(namespaces.map(namespace => helmReleasesApi.list(namespace)))
|
||||
.then(items => items.flat());
|
||||
}
|
||||
}
|
||||
|
||||
async create(payload: IReleaseCreatePayload) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user