mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Finish up CatalogEntity.getId() replacements
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
609861091c
commit
682d3211ce
8 files changed
+20
-20
No files matched your search
@@ -67,22 +67,22 @@ export class KubernetesCluster extends CatalogEntity<KubernetesClusterMetadata,
|
||||
|
||||
async connect(): Promise<void> {
|
||||
if (app) {
|
||||
await ClusterStore.getInstance().getById(this.metadata.uid)?.activate();
|
||||
await ClusterStore.getInstance().getById(this.getId())?.activate();
|
||||
} else {
|
||||
await requestMain(clusterActivateHandler, this.metadata.uid, false);
|
||||
await requestMain(clusterActivateHandler, this.getId(), false);
|
||||
}
|
||||
}
|
||||
|
||||
async disconnect(): Promise<void> {
|
||||
if (app) {
|
||||
ClusterStore.getInstance().getById(this.metadata.uid)?.disconnect();
|
||||
ClusterStore.getInstance().getById(this.getId())?.disconnect();
|
||||
} else {
|
||||
await requestMain(clusterDisconnectHandler, this.metadata.uid, false);
|
||||
await requestMain(clusterDisconnectHandler, this.getId(), false);
|
||||
}
|
||||
}
|
||||
|
||||
async onRun(context: CatalogEntityActionContext) {
|
||||
context.navigate(`/cluster/${this.metadata.uid}`);
|
||||
context.navigate(`/cluster/${this.getId()}`);
|
||||
}
|
||||
|
||||
onDetailsOpen(): void {
|
||||
@@ -100,7 +100,7 @@ export class KubernetesCluster extends CatalogEntity<KubernetesClusterMetadata,
|
||||
icon: "settings",
|
||||
onClick: () => broadcastMessage(
|
||||
IpcRendererNavigationEvents.NAVIGATE_IN_APP,
|
||||
`/entity/${this.metadata.uid}/settings`,
|
||||
`/entity/${this.getId()}/settings`,
|
||||
),
|
||||
});
|
||||
}
|
||||
@@ -111,14 +111,14 @@ export class KubernetesCluster extends CatalogEntity<KubernetesClusterMetadata,
|
||||
context.menuItems.push({
|
||||
title: "Disconnect",
|
||||
icon: "link_off",
|
||||
onClick: () => requestMain(clusterDisconnectHandler, this.metadata.uid),
|
||||
onClick: () => requestMain(clusterDisconnectHandler, this.getId()),
|
||||
});
|
||||
break;
|
||||
case LensKubernetesClusterStatus.DISCONNECTED:
|
||||
context.menuItems.push({
|
||||
title: "Connect",
|
||||
icon: "link",
|
||||
onClick: () => context.navigate(`/cluster/${this.metadata.uid}`),
|
||||
onClick: () => context.navigate(`/cluster/${this.getId()}`),
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export class ResourceStack {
|
||||
}
|
||||
|
||||
protected async applyResources(resources: string[], extraArgs?: string[]): Promise<string> {
|
||||
const clusterModel = ClusterStore.getInstance().getById(this.cluster.metadata.uid);
|
||||
const clusterModel = ClusterStore.getInstance().getById(this.cluster.getId());
|
||||
|
||||
if (!clusterModel) {
|
||||
throw new Error(`cluster not found`);
|
||||
@@ -54,7 +54,7 @@ export class ResourceStack {
|
||||
if (app) {
|
||||
return await new ResourceApplier(clusterModel).kubectlApplyAll(resources, kubectlArgs);
|
||||
} else {
|
||||
const response = await requestMain(clusterKubectlApplyAllHandler, this.cluster.metadata.uid, resources, kubectlArgs);
|
||||
const response = await requestMain(clusterKubectlApplyAllHandler, this.cluster.getId(), resources, kubectlArgs);
|
||||
|
||||
if (response.stderr) {
|
||||
throw new Error(response.stderr);
|
||||
@@ -65,7 +65,7 @@ export class ResourceStack {
|
||||
}
|
||||
|
||||
protected async deleteResources(resources: string[], extraArgs?: string[]): Promise<string> {
|
||||
const clusterModel = ClusterStore.getInstance().getById(this.cluster.metadata.uid);
|
||||
const clusterModel = ClusterStore.getInstance().getById(this.cluster.getId());
|
||||
|
||||
if (!clusterModel) {
|
||||
throw new Error(`cluster not found`);
|
||||
@@ -78,7 +78,7 @@ export class ResourceStack {
|
||||
if (app) {
|
||||
return await new ResourceApplier(clusterModel).kubectlDeleteAll(resources, kubectlArgs);
|
||||
} else {
|
||||
const response = await requestMain(clusterKubectlDeleteAllHandler, this.cluster.metadata.uid, resources, kubectlArgs);
|
||||
const response = await requestMain(clusterKubectlDeleteAllHandler, this.cluster.getId(), resources, kubectlArgs);
|
||||
|
||||
if (response.stderr) {
|
||||
throw new Error(response.stderr);
|
||||
|
||||
Reference in new issue
Block a user