Ensure that CatalogEntity.getName() and CatalogEntity.getId() are always used (#4763)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-01-27 14:42:19 -05:00
1 parent 1cac3ca74c
commit 8d8491a035
17 files changed
+98 -166

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ export class CatalogEntityRegistry {
}
getById<T extends CatalogEntity>(id: string): T | undefined {
return this.items.find((entity) => entity.metadata.uid === id) as T | undefined;
return this.items.find(entity => entity.getId() === id) as T | undefined;
}
getItemsForApiKind<T extends CatalogEntity>(apiVersion: string, kind: string): T[] {
+3 -3
View File
@@ -85,7 +85,7 @@ export class ClusterManager extends Singleton {
}
protected updateEntityFromCluster(cluster: Cluster) {
const index = catalogEntityRegistry.items.findIndex((entity) => entity.metadata.uid === cluster.id);
const index = catalogEntityRegistry.items.findIndex((entity) => entity.getId() === cluster.id);
if (index === -1) {
return;
@@ -169,11 +169,11 @@ export class ClusterManager extends Singleton {
@action
protected syncClustersFromCatalog(entities: KubernetesCluster[]) {
for (const entity of entities) {
const cluster = this.store.getById(entity.metadata.uid);
const cluster = this.store.getById(entity.getId());
if (!cluster) {
const model = {
id: entity.metadata.uid,
id: entity.getId(),
kubeConfigPath: entity.spec.kubeconfigPath,
contextName: entity.spec.kubeconfigContext,
accessibleNamespaces: entity.spec.accessibleNamespaces ?? [],