mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 01:25:38 -05:00
Fix connection when changing kernel from Kusto to SQL (#12881)
* Fix Kusto to SQL kernel connection change * Updated Fix - removes kernel alias mapping while ensuring multi kusto notebooks work properly * Fix tests
This commit is contained in:
@@ -845,6 +845,15 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
if (newConnection) {
|
||||
if (newConnection.serverCapabilities?.notebookKernelAlias) {
|
||||
this._currentKernelAlias = newConnection.serverCapabilities.notebookKernelAlias;
|
||||
// Removes SQL kernel to Kernel Alias Connection Provider map
|
||||
let sqlConnectionProvider = this._kernelDisplayNameToConnectionProviderIds.get('SQL');
|
||||
if (sqlConnectionProvider) {
|
||||
let index = sqlConnectionProvider.indexOf(newConnection.serverCapabilities.notebookKernelAlias.toUpperCase());
|
||||
if (index > -1) {
|
||||
sqlConnectionProvider.splice(index, 1);
|
||||
}
|
||||
this._kernelDisplayNameToConnectionProviderIds.set('SQL', sqlConnectionProvider);
|
||||
}
|
||||
this._kernelDisplayNameToConnectionProviderIds.set(newConnection.serverCapabilities.notebookKernelAlias, [newConnection.providerName]);
|
||||
}
|
||||
this._activeConnection = newConnection;
|
||||
@@ -971,6 +980,9 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
private async loadActiveContexts(kernelChangedArgs: nb.IKernelChangedArgs): Promise<void> {
|
||||
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name) {
|
||||
let kernelDisplayName = this.getDisplayNameFromSpecName(kernelChangedArgs.newValue);
|
||||
if (this.context?.serverCapabilities?.notebookKernelAlias && this.selectedKernelDisplayName === this.context?.serverCapabilities?.notebookKernelAlias) {
|
||||
kernelDisplayName = this.context.serverCapabilities?.notebookKernelAlias;
|
||||
}
|
||||
let context;
|
||||
if (this._activeConnection) {
|
||||
context = NotebookContexts.getContextForKernel(this._activeConnection, this.getApplicableConnectionProviderIds(kernelDisplayName));
|
||||
|
||||
Reference in New Issue
Block a user