Skip to content

Commit 7187a3c

Browse files
committed
Add current cluster server into login warning
This PR fixes #1795. Signed-off-by: Denis Golovin dgolovin@redhat.com
1 parent 97e189b commit 7187a3c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/openshift/cluster.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ export class Cluster extends OpenShiftItem {
164164
private static async requestLoginConfirmation(skipConfirmation = false): Promise<string> {
165165
let response = 'Yes';
166166
if (!skipConfirmation && !await Cluster.odo.requireLogin()) {
167-
response = await window.showInformationMessage('You are already logged in the cluster. Do you want to login to a different cluster?', 'Yes', 'No');
167+
const cluster = new KubeConfigUtils().getCurrentCluster();
168+
response = await window.showInformationMessage(`You are already logged into ${cluster.server} cluster. Do you want to login to a different cluster?`, 'Yes', 'No');
168169
}
169170
return response;
170171
}
@@ -303,6 +304,6 @@ export class Cluster extends OpenShiftItem {
303304
await commands.executeCommand('setContext', 'isLoggedIn', true);
304305
return `Successfully logged in to '${clusterURL}'`;
305306
}
306-
throw new VsCommandError(result.stderr, 'Failed to login to cluster with output in stderror');
307+
throw new VsCommandError(result.stderr, 'Failed to login to cluster with output in stderr');
307308
}
308309
}

src/util/kubeUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ export class KubeConfigUtils extends KubeConfig {
4747
public findCluster(clusterServer: string): Cluster {
4848
return this.getClusters().find((cluster: Cluster) => cluster.server === clusterServer);
4949
}
50+
5051
}

0 commit comments

Comments
 (0)