mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Support extending KubernetesCluster in extensions (#4702)
* Support extending KubernetesCluster in extensions Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Simplify getItemsByEntityClass Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Make apiVersion string. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Improve entity loading for extension custom types. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Improve comment. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Fix lint. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Properly handle loading custom entity in cluster-frame Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Avoid .bind with .loadOnClusterRenderer Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Fix lint. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Revert style change. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Make loadOnClusterRenderer arrow function again, revert autoInitExtensions change as unnecessary Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Remove commented code. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Document extending KubernetesCluster in extension guides. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
74d92d09d9
commit
79c01daf6a
10 files changed
+154
-35
No files matched your search
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { action, computed, IComputedValue, IObservableArray, makeObservable, observable } from "mobx";
|
||||
import { CatalogCategoryRegistry, catalogCategoryRegistry, CatalogEntity, CatalogEntityConstructor, CatalogEntityKindData } from "../../common/catalog";
|
||||
import { CatalogCategoryRegistry, catalogCategoryRegistry, CatalogEntity, CatalogEntityConstructor } from "../../common/catalog";
|
||||
import { iter } from "../../common/utils";
|
||||
|
||||
export class CatalogEntityRegistry {
|
||||
@@ -43,8 +43,8 @@ export class CatalogEntityRegistry {
|
||||
return this.items.filter((item) => item.apiVersion === apiVersion && item.kind === kind) as T[];
|
||||
}
|
||||
|
||||
getItemsByEntityClass<T extends CatalogEntity>({ apiVersion, kind }: CatalogEntityKindData & CatalogEntityConstructor<T>): T[] {
|
||||
return this.getItemsForApiKind(apiVersion, kind);
|
||||
getItemsByEntityClass<T extends CatalogEntity>(constructor: CatalogEntityConstructor<T>): T[] {
|
||||
return this.items.filter((item) => item instanceof constructor) as T[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user