diff --git a/src/commands/serverCommand.ts b/src/commands/serverCommand.ts index af138241..d8d7cea7 100644 --- a/src/commands/serverCommand.ts +++ b/src/commands/serverCommand.ts @@ -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, @@ -674,6 +675,7 @@ export async function connect(viewItem: KdbNode): Promise { if (ext.connection !== undefined) { ext.connection.disconnect(); ext.connection = undefined; + DataSourcesPanel.close(); } } @@ -761,6 +763,7 @@ export async function disconnect(): Promise { ext.connectionNode = undefined; const queryConsole = ExecutionConsole.start(); queryConsole.dispose(); + DataSourcesPanel.close(); ext.serverProvider.reload(); } diff --git a/src/panels/datasource.ts b/src/panels/datasource.ts index 58273a9b..861dc5dc 100644 --- a/src/panels/datasource.ts +++ b/src/panels/datasource.ts @@ -86,6 +86,12 @@ export class DataSourcesPanel { ); } + public static close() { + if (DataSourcesPanel.currentPanel) { + DataSourcesPanel.currentPanel.dispose(); + } + } + public refresh() { DataSourcesPanel.render(this.uri, DataSourcesPanel.dataSourceFile); }