1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Allow better typings for extending type of KubernetesCluster (#4843)

This commit is contained in:
Sebastian Malton 2022-02-10 15:55:03 -05:00 committed by GitHub
parent e950d3a77e
commit 81e6dc5d8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -58,7 +58,11 @@ export type KubernetesClusterStatusPhase = "connected" | "connecting" | "disconn
export interface KubernetesClusterStatus extends CatalogEntityStatus { export interface KubernetesClusterStatus extends CatalogEntityStatus {
} }
export class KubernetesCluster extends CatalogEntity<KubernetesClusterMetadata, KubernetesClusterStatus, KubernetesClusterSpec> { export class KubernetesCluster<
Metadata extends KubernetesClusterMetadata = KubernetesClusterMetadata,
Status extends KubernetesClusterStatus = KubernetesClusterStatus,
Spec extends KubernetesClusterSpec = KubernetesClusterSpec,
> extends CatalogEntity<Metadata, Status, Spec> {
public static readonly apiVersion: string = "entity.k8slens.dev/v1alpha1"; public static readonly apiVersion: string = "entity.k8slens.dev/v1alpha1";
public static readonly kind: string = "KubernetesCluster"; public static readonly kind: string = "KubernetesCluster";

View File

@ -48,7 +48,7 @@ export class ClusterManager extends Singleton {
); );
reaction( reaction(
() => catalogEntityRegistry.getItemsByEntityClass(KubernetesCluster), () => catalogEntityRegistry.getItemsByEntityClass(KubernetesCluster) as KubernetesCluster[],
entities => this.syncClustersFromCatalog(entities), entities => this.syncClustersFromCatalog(entities),
); );