Skip to content

Commit

Permalink
fix issue to close datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip-Carneiro-KX committed Aug 31, 2023
1 parent ae61caf commit 9737d06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/commands/serverCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { queryConstants } from "../models/queryResult";
import { ScratchpadResult } from "../models/scratchpadResult";
import { Server } from "../models/server";
import { ServerObject } from "../models/serverObject";
import { DataSourcesPanel } from "../panels/datasource";
import {
getCurrentToken,
IToken,
Expand Down Expand Up @@ -674,6 +675,7 @@ export async function connect(viewItem: KdbNode): Promise<void> {
if (ext.connection !== undefined) {
ext.connection.disconnect();
ext.connection = undefined;
DataSourcesPanel.close();
}
}

Expand Down Expand Up @@ -761,6 +763,7 @@ export async function disconnect(): Promise<void> {
ext.connectionNode = undefined;
const queryConsole = ExecutionConsole.start();
queryConsole.dispose();
DataSourcesPanel.close();
ext.serverProvider.reload();
}

Expand Down
6 changes: 6 additions & 0 deletions src/panels/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ export class DataSourcesPanel {
);
}

public static close() {
if (DataSourcesPanel.currentPanel) {
DataSourcesPanel.currentPanel.dispose();
}
}

public refresh() {
DataSourcesPanel.render(this.uri, DataSourcesPanel.dataSourceFile);
}
Expand Down

0 comments on commit 9737d06

Please sign in to comment.