Skip to content

Commit

Permalink
Merge pull request #302 from KxSystems/insights-conn-active
Browse files Browse the repository at this point in the history
smallfix for insights active connection
  • Loading branch information
Philip-Carneiro-KX authored May 16, 2024
2 parents d091609 + e90fea8 commit 991d797
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/services/connectionManagerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 18 additions & 0 deletions test/suite/services.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down

0 comments on commit 991d797

Please sign in to comment.