mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Load k8s resources only for selected namespaces (#1918)
* loading k8s resources into stores per selected namespaces -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * loading k8s resources into stores per selected namespaces -- part 2 - fix: generating helm chart id Signed-off-by: Roman <ixrock@gmail.com> * loading k8s resources into stores per selected namespaces -- part 3 Signed-off-by: Roman <ixrock@gmail.com> * fixes Signed-off-by: Roman <ixrock@gmail.com> * fixes / responding to comments Signed-off-by: Roman <ixrock@gmail.com> * chore / small fixes Signed-off-by: Roman <ixrock@gmail.com> * fixes & refactoring Signed-off-by: Roman <ixrock@gmail.com> * make lint happy Signed-off-by: Roman <ixrock@gmail.com> * reset store on loading error Signed-off-by: Roman <ixrock@gmail.com> * added new cluster method: cluster.isAllowedResource Signed-off-by: Roman <ixrock@gmail.com> * fix: loading namespaces optimizations Signed-off-by: Roman <ixrock@gmail.com> * fixes & refactoring Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
a92ed46f0d
commit
f8c111ddd8
18 files changed
+465
-360
No files matched your search
@@ -9,7 +9,7 @@ export interface ItemObject {
|
||||
|
||||
@autobind()
|
||||
export abstract class ItemStore<T extends ItemObject = ItemObject> {
|
||||
abstract loadAll(): Promise<void>;
|
||||
abstract loadAll(...args: any[]): Promise<void>;
|
||||
|
||||
protected defaultSorting = (item: T) => item.getName();
|
||||
|
||||
@@ -40,8 +40,7 @@ export abstract class ItemStore<T extends ItemObject = ItemObject> {
|
||||
|
||||
if (item) {
|
||||
return item;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
const items = this.sortItems([...this.items, newItem]);
|
||||
|
||||
this.items.replace(items);
|
||||
@@ -83,8 +82,7 @@ export abstract class ItemStore<T extends ItemObject = ItemObject> {
|
||||
const index = this.items.findIndex(item => item === existingItem);
|
||||
|
||||
this.items.splice(index, 1, item);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
let items = [...this.items, item];
|
||||
|
||||
if (sortItems) items = this.sortItems(items);
|
||||
@@ -130,8 +128,7 @@ export abstract class ItemStore<T extends ItemObject = ItemObject> {
|
||||
toggleSelection(item: T) {
|
||||
if (this.isSelected(item)) {
|
||||
this.unselect(item);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.select(item);
|
||||
}
|
||||
}
|
||||
@@ -142,8 +139,7 @@ export abstract class ItemStore<T extends ItemObject = ItemObject> {
|
||||
|
||||
if (allSelected) {
|
||||
visibleItems.forEach(this.unselect);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
visibleItems.forEach(this.select);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user