Kusto Kernel New Notebook Changes (#12085)

* Kusto New Notebook Action Changes

* Kusto Cluster properly switches context when kernel changes

* SQL Connections kernel change to Kusto works properly

* Multiple New Kusto Notebooks open properly and change kernels properly

* Fix SQL Notebook - Change to Kusto Kernel

* Fix unit tests

* Address comments

* Add test, and finalize changes
This commit is contained in:
Vasu Bhog
2020-09-09 09:19:36 -05:00
committed by GitHub
parent a840057cd8
commit 3a0be70783
5 changed files with 119 additions and 13 deletions

View File

@@ -409,7 +409,12 @@ export class AttachToDropdown extends SelectBox {
let currentKernelName = this.model.clientSession.kernel.name.toLowerCase();
let currentKernelSpec = find(this.model.specs.kernels, kernel => kernel.name && kernel.name.toLowerCase() === currentKernelName);
if (currentKernelSpec) {
kernelDisplayName = currentKernelSpec.display_name;
//KernelDisplayName should be Kusto when connecting to Kusto connection
if ((this.model.context?.serverCapabilities.notebookKernelAlias && this.model.currentKernelAlias === this.model.context?.serverCapabilities.notebookKernelAlias) || (this.model.kernelAliases.includes(this.model.selectedKernelDisplayName) && this.model.selectedKernelDisplayName)) {
kernelDisplayName = this.model.context?.serverCapabilities.notebookKernelAlias || this.model.selectedKernelDisplayName;
} else {
kernelDisplayName = currentKernelSpec.display_name;
}
}
}
return kernelDisplayName;
@@ -420,14 +425,17 @@ export class AttachToDropdown extends SelectBox {
let connProviderIds = this.model.getApplicableConnectionProviderIds(currentKernel);
if ((connProviderIds && connProviderIds.length === 0) || currentKernel === noKernel) {
this.setOptions([msgLocalHost]);
}
else {
let connections: string[] = model.context && model.context.title ? [model.context.title] : [msgSelectConnection];
} else {
let connections: string[] = model.context && model.context.title && (connProviderIds.includes(this.model.context.providerName)) ? [model.context.title] : [msgSelectConnection];
if (!find(connections, x => x === msgChangeConnection)) {
connections.push(msgChangeConnection);
}
this.setOptions(connections, 0);
this.enable();
if (this.model.kernelAliases.includes(currentKernel) && this.model.selectedKernelDisplayName !== currentKernel) {
this.model.changeKernel(currentKernel);
}
}
}