Notebooks: fix AttachTo showed only Localhost (#4354)

The Attach To was showing only localhost for SQL, since we overrode the standard kernels from SQL with the ones from Jupyter.
Fix is to save all standard kernels.
Also, added dispose handling for some events I found during debugging and removed unused imports
This commit is contained in:
Kevin Cunnane
2019-03-08 13:27:14 -08:00
committed by GitHub
parent aa1a036f66
commit c3900f6984
4 changed files with 99 additions and 11 deletions

View File

@@ -13,9 +13,8 @@ import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
import { QueryInput } from 'sql/parts/query/common/queryInput';
import { IQueryEditorOptions } from 'sql/workbench/services/queryEditor/common/queryEditorService';
import { QueryPlanInput } from 'sql/parts/queryPlan/queryPlanInput';
import { NotebookInput, NotebookEditorModel } from 'sql/parts/notebook/notebookInput';
import { NotebookInput } from 'sql/parts/notebook/notebookInput';
import { DEFAULT_NOTEBOOK_PROVIDER, INotebookService } from 'sql/workbench/services/notebook/common/notebookService';
import { getProvidersForFileName, getStandardKernelsForProvider } from 'sql/parts/notebook/notebookUtils';
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { notebookModeId } from 'sql/common/constants';

View File

@@ -254,15 +254,15 @@ export class KernelsDropdown extends SelectBox {
updateModel(model: INotebookModel): void {
this.model = model;
model.kernelsChanged((defaultKernel) => {
this._register(model.kernelsChanged((defaultKernel) => {
this.updateKernel(defaultKernel);
});
}));
if (model.clientSession) {
model.clientSession.kernelChanged((changedArgs: azdata.nb.IKernelChangedArgs) => {
this._register(model.clientSession.kernelChanged((changedArgs: azdata.nb.IKernelChangedArgs) => {
if (changedArgs.newValue) {
this.updateKernel(changedArgs.newValue);
}
});
}));
}
}
@@ -306,12 +306,12 @@ export class AttachToDropdown extends SelectBox {
public updateModel(model: INotebookModel): void {
this.model = model;
model.contextsChanged(() => {
this._register(model.contextsChanged(() => {
let kernelDisplayName: string = this.getKernelDisplayName();
if (kernelDisplayName) {
this.loadAttachToDropdown(this.model, kernelDisplayName);
}
});
}));
}
private updateAttachToDropdown(model: INotebookModel): void {

View File

@@ -245,9 +245,10 @@ export class NotebookInput extends EditorInput {
if (providerIds && providerIds.length > 0) {
this._providerId = providerIds.filter(provider => provider !== DEFAULT_NOTEBOOK_PROVIDER)[0];
this._providers = providerIds;
this._standardKernels = [];
this._providers.forEach(provider => {
let standardKernels = getStandardKernelsForProvider(provider, this.notebookService);
this._standardKernels = standardKernels;
this._standardKernels.push(...standardKernels);
});
}
}