mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 17:22:55 -05:00
Fix Spark kernel connections and switch from Kusto to Spark kernels (#12436)
* Fix connection dialog for Spark and issue when switching from Kusto to Spark * Address comments
This commit is contained in:
@@ -457,8 +457,15 @@ export class AttachToDropdown extends SelectBox {
|
||||
try {
|
||||
// Get all providers to show all available connections in connection dialog
|
||||
let providers = this.model.getApplicableConnectionProviderIds(this.model.clientSession.kernel.name);
|
||||
for (let alias of this.model.kernelAliases) {
|
||||
providers = providers.concat(this.model.getApplicableConnectionProviderIds(alias));
|
||||
// Spark kernels are unable to get providers from above, therefore ensure that we get the
|
||||
// correct providers for the selected kernel and load the proper connections for the connection dialog
|
||||
// Example Scenario: Spark Kernels should only have MSSQL connections in connection dialog
|
||||
if (!this.model.kernelAliases.includes(this.model.selectedKernelDisplayName) && this.model.clientSession.kernel.name !== 'SQL') {
|
||||
providers = providers.concat(this.model.getApplicableConnectionProviderIds(this.model.selectedKernelDisplayName));
|
||||
} else {
|
||||
for (let alias of this.model.kernelAliases) {
|
||||
providers = providers.concat(this.model.getApplicableConnectionProviderIds(alias));
|
||||
}
|
||||
}
|
||||
let connection = await this._connectionDialogService.openDialogAndWait(this._connectionManagementService,
|
||||
{
|
||||
|
||||
@@ -658,8 +658,11 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
let providerFeatures = this._capabilitiesService.getCapabilities(profile.providerName);
|
||||
if (connectionProviderIds?.length) {
|
||||
this._currentKernelAlias = providerFeatures?.connection.notebookKernelAlias;
|
||||
// Adds Kernel Alias and Connection Provider to Map if new Notebook connection contains notebookKernelAlias
|
||||
if (this._currentKernelAlias) {
|
||||
// Switching from Kusto to another kernel should set the currentKernelAlias to undefined
|
||||
if (this._selectedKernelDisplayName !== this._currentKernelAlias && this._selectedKernelDisplayName) {
|
||||
this._currentKernelAlias = undefined;
|
||||
} else {
|
||||
// Adds Kernel Alias and Connection Provider to Map if new Notebook connection contains notebookKernelAlias
|
||||
this._kernelDisplayNameToConnectionProviderIds.set(this._currentKernelAlias, [profile.providerName]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user