mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Ensure that CatalogEntity.getName() and CatalogEntity.getId() are always used (#4763)
This commit is contained in:
1 parent
1cac3ca74c
commit
8d8491a035
17 files changed
+98
-166
No files matched your search
@@ -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[] {
|
||||
|
||||
@@ -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 ?? [],
|
||||
|
||||
Reference in new issue
Block a user