Skip to content

Commit c033875

Browse files
committed
simp
1 parent db6015b commit c033875

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/api/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,11 @@ export class AtelierAPI {
210210
/** Return the key for getting values from connection-specific Maps for this connection */
211211
private mapKey(): string {
212212
const { host, port, authorization } = this.config;
213-
const username = authorization.resolved() ? authorization.username : "";
214213
let pathPrefix = this._config.pathPrefix || "";
215214
if (pathPrefix.length && !pathPrefix.startsWith("/")) {
216215
pathPrefix = "/" + pathPrefix;
217216
}
218-
return `${username}@${host}:${port}${pathPrefix}`;
217+
return `${authorization.username}@${host}:${port}${pathPrefix}`;
219218
}
220219

221220
private setConnection(workspaceFolderName: string, namespace?: string): void {

src/commands/serverActions.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export async function serverActions(): Promise<void> {
2626
const { apiTarget, configName: workspaceFolder } = connectionTarget();
2727
const api = new AtelierAPI(apiTarget);
2828
const { active, host = "", ns = "", https, port = 0, pathPrefix, authorization, docker } = api.config;
29-
const username = authorization.username;
3029
const explorerCount = (await explorerProvider.getChildren()).length;
3130
if (!explorerCount && (!docker || host === "")) {
3231
await vscode.commands.executeCommand("ObjectScriptExplorer.focus");
@@ -153,7 +152,7 @@ export async function serverActions(): Promise<void> {
153152
.replace("${serverAuth}", "")
154153
.replace("${ns}", nsEncoded)
155154
.replace("${namespace}", ns == "%SYS" ? "sys" : nsEncoded.toLowerCase())
156-
.replace("${username}", username)
155+
.replace("${username}", authorization.username)
157156
.replace("${classname}", classname)
158157
.replace("${classnameEncoded}", classnameEncoded)
159158
.replace("${project}", project);
@@ -249,7 +248,7 @@ export async function serverActions(): Promise<void> {
249248
if (addin) {
250249
sendStudioAddinTelemetryEvent(addin.label);
251250
let params = `Namespace=${nsEncoded}`;
252-
params += `&User=${encodeURIComponent(username)}`;
251+
params += `&User=${encodeURIComponent(authorization.username)}`;
253252
if (project != "") {
254253
params += `&Project=${encodeURIComponent(project)}`;
255254
}

src/extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ export async function checkConnection(
365365
}
366366
let api = new AtelierAPI(apiTarget, false);
367367
const { active, host = "", port = 0, superserverPort = 0, ns = "", authorization } = api.config;
368-
const username = authorization.resolved() ? authorization.username : "";
369368
vscode.commands.executeCommand("setContext", "vscode-objectscript.connectActive", active);
370369
if (!panel.text) {
371370
panel.text = `${PANEL_LABEL}`;
@@ -450,9 +449,11 @@ export async function checkConnection(
450449
panel.text = api.connInfo;
451450
const { serverName, host, port, pathPrefix } = api.config;
452451
if (serverName) {
453-
panel.tooltip = new vscode.MarkdownString(`Connected to \`${host}:${port}${pathPrefix}\` as \`${username}\``);
452+
panel.tooltip = new vscode.MarkdownString(
453+
`Connected to \`${host}:${port}${pathPrefix}\` as \`${authorization.username}\``
454+
);
454455
} else {
455-
panel.tooltip = new vscode.MarkdownString(`Connected as \`${username}\``);
456+
panel.tooltip = new vscode.MarkdownString(`Connected as \`${authorization.username}\``);
456457
}
457458
inactiveServerIds.delete(api.serverId);
458459
if (!api.externalServer) await setConnectionState(configName, true);

0 commit comments

Comments
 (0)