mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
loading k8s resources into stores per selected namespaces -- part 1
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
02bc210f56
commit
47bea52160
6 files changed
+50
-63
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import difference from "lodash/difference";
|
||||
import uniqBy from "lodash/uniqBy";
|
||||
import { clusterRoleBindingApi, IRoleBindingSubject, RoleBinding, roleBindingApi } from "../../api/endpoints";
|
||||
import { KubeObjectStore } from "../../kube-object.store";
|
||||
import { KubeObjectStore, KubeObjectStoreLoadingParams } from "../../kube-object.store";
|
||||
import { autobind } from "../../utils";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@@ -26,15 +26,12 @@ export class RoleBindingsStore extends KubeObjectStore<RoleBinding> {
|
||||
return clusterRoleBindingApi.get(params);
|
||||
}
|
||||
|
||||
protected loadItems(namespaces?: string[]) {
|
||||
if (namespaces) {
|
||||
return Promise.all(
|
||||
namespaces.map(namespace => roleBindingApi.list({ namespace }))
|
||||
).then(items => items.flat());
|
||||
} else {
|
||||
return Promise.all([clusterRoleBindingApi.list(), roleBindingApi.list()])
|
||||
.then(items => items.flat());
|
||||
}
|
||||
protected async loadItems({ isAdmin, namespaces }: KubeObjectStoreLoadingParams): Promise<RoleBinding[]> {
|
||||
const items = await Promise.all([
|
||||
super.loadItems({ isAdmin, namespaces, api: clusterRoleBindingApi }),
|
||||
super.loadItems({ isAdmin, namespaces, api: roleBindingApi }),
|
||||
]);
|
||||
return items.flat();
|
||||
}
|
||||
|
||||
protected async createItem(params: { name: string; namespace?: string }, data?: Partial<RoleBinding>) {
|
||||
|
||||
Reference in new issue
Block a user