From 389ffb6b41f7c82d2d72e05104b226667d892b1e Mon Sep 17 00:00:00 2001 From: Philip Carneiro Date: Thu, 16 May 2024 09:26:47 +0100 Subject: [PATCH 1/2] smallfix for insights active connection --- src/services/connectionManagerService.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/services/connectionManagerService.ts b/src/services/connectionManagerService.ts index 496abf5b..c7f7acc6 100644 --- a/src/services/connectionManagerService.ts +++ b/src/services/connectionManagerService.ts @@ -253,6 +253,9 @@ export class ConnectionManagementService { ext.activeConnection = undefined; ext.connectionNode = undefined; commands.executeCommand("setContext", "kdb.connected.active", false); + if (connType === "Insights") { + commands.executeCommand("setContext", "kdb.insightsConnected", false); + } } Telemetry.sendEvent("Connection.Disconnected." + connType); ext.outputChannel.appendLine( From e90fea8e7dd63902a03567d5fa093afadc0e6781 Mon Sep 17 00:00:00 2001 From: Philip Carneiro Date: Thu, 16 May 2024 09:39:36 +0100 Subject: [PATCH 2/2] add tests --- test/suite/services.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/suite/services.test.ts b/test/suite/services.test.ts index 595eb94f..d5bbe87a 100644 --- a/test/suite/services.test.ts +++ b/test/suite/services.test.ts @@ -991,6 +991,24 @@ describe("connectionManagerService", () => { assert.equal(ext.activeConnection, undefined); assert.equal(ext.connectionNode, undefined); }); + + it("disconnectBehaviour with IOnsights connection", () => { + ext.connectedConnectionList.push(insightsConn); + ext.activeConnection = insightsConn; + + connectionManagerService.disconnectBehaviour(insightsConn); + assert.equal(ext.connectedConnectionList.length, 0); + assert.equal(ext.activeConnection, undefined); + assert.equal(ext.connectionNode, undefined); + }); + + it("disconnectBehaviour with no active connection", () => { + ext.connectedConnectionList.push(insightsConn); + + connectionManagerService.disconnectBehaviour(insightsConn); + assert.equal(ext.connectedConnectionList.length, 0); + assert.equal(ext.activeConnection, undefined); + }); }); describe("resetScratchpad", () => {