mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Restrict extension version of ClusterStore to properly shadow internval ClusterStore
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
4f74b9aabe
commit
60863d2e99
@ -212,8 +212,12 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
||||
}
|
||||
|
||||
@action
|
||||
setActive(id: ClusterId) {
|
||||
const clusterId = this.clusters.has(id) ? id : null;
|
||||
setActive(clusterId: ClusterId) {
|
||||
const cluster = this.clusters.get(clusterId);
|
||||
|
||||
if (!cluster?.enabled) {
|
||||
clusterId = null;
|
||||
}
|
||||
|
||||
this.activeCluster = clusterId;
|
||||
workspaceStore.setLastActiveClusterId(clusterId);
|
||||
@ -239,8 +243,8 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
||||
return this.clusters.size > 0;
|
||||
}
|
||||
|
||||
getById(id: ClusterId): Cluster {
|
||||
return this.clusters.get(id);
|
||||
getById(id: ClusterId): Cluster | null {
|
||||
return this.clusters.get(id) ?? null;
|
||||
}
|
||||
|
||||
getByWorkspaceId(workspaceId: string): Cluster[] {
|
||||
|
||||
@ -25,7 +25,7 @@ export class ClusterStore extends Singleton {
|
||||
* Set active cluster id
|
||||
*/
|
||||
set activeClusterId(id : ClusterId) {
|
||||
internalClusterStore.activeCluster = id;
|
||||
internalClusterStore.setActive(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,12 +38,8 @@ export class ClusterStore extends Singleton {
|
||||
/**
|
||||
* Get active cluster (a cluster which is currently visible)
|
||||
*/
|
||||
get activeCluster(): Cluster {
|
||||
if (!this.activeClusterId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.getById(this.activeClusterId);
|
||||
get activeCluster(): Cluster | null {
|
||||
return internalClusterStore.active;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,7 +100,7 @@ export class ClusterStore extends Singleton {
|
||||
* @param model cluster
|
||||
*/
|
||||
async removeCluster(model: ClusterModel) {
|
||||
return this.removeById(model.id);
|
||||
return internalClusterStore.removeById(model.id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user