diff --git a/src/services/connectionManagerService.ts b/src/services/connectionManagerService.ts index 1df1ab20..1a509bad 100644 --- a/src/services/connectionManagerService.ts +++ b/src/services/connectionManagerService.ts @@ -32,6 +32,7 @@ import { Insights } from "../models/insights"; import { Server } from "../models/server"; import { refreshDataSourcesPanel } from "../utils/dataSource"; import { MetaInfoType } from "../models/meta"; +import { retrieveConnLabelsNames } from "../utils/connLabel"; export class ConnectionManagementService { public retrieveConnection( @@ -232,6 +233,8 @@ export class ConnectionManagementService { } public isConnectedBehaviour(connNode: KdbNode | InsightsNode): void { + ext.latestLblsChanged.length = 0; + ext.latestLblsChanged.push(...retrieveConnLabelsNames(connNode)); ext.connectedContextStrings.push(connNode.label); commands.executeCommand( "setContext", diff --git a/src/webview/components/kdbNewConnectionView.ts b/src/webview/components/kdbNewConnectionView.ts index cc1d551f..a981e80a 100644 --- a/src/webview/components/kdbNewConnectionView.ts +++ b/src/webview/components/kdbNewConnectionView.ts @@ -161,7 +161,7 @@ export class KdbNewConnectionView extends LitElement { : serverType === ServerType.KDB ? html` { this.newLblName = (event.target as HTMLInputElement).value; this.requestUpdate(); }}" diff --git a/test/suite/webview.test.ts b/test/suite/webview.test.ts index e239b6dd..4a5f9c7d 100644 --- a/test/suite/webview.test.ts +++ b/test/suite/webview.test.ts @@ -334,19 +334,19 @@ describe("KdbNewConnectionView", () => { describe("renderServerNameField", () => { it("should render server name field for bundled q", () => { const result = view.renderServerNameField(ServerType.KDB, true); - assert.strictEqual(result.strings[0].includes("Server 1"), false); + assert.strictEqual(result.strings[0].includes("Server-1"), false); }); it("should render server name field for KDB", () => { view.isBundledQ = false; const result = view.renderServerNameField(ServerType.KDB); - assert.strictEqual(result.strings[0].includes("Server 1"), true); + assert.strictEqual(result.strings[0].includes("Server-1"), true); }); it("should render server name field for Insights", () => { view.isBundledQ = false; const result = view.renderServerNameField(ServerType.INSIGHTS, false); - assert.strictEqual(result.strings[0].includes("Insights 1"), true); + assert.strictEqual(result.strings[0].includes("Insights-1"), true); }); });