mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
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:
@@ -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';
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user