mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-19 03:21:36 -04:00
Notebooks: Improvements to Connection Profile Passing (#8105)
* Fix relative images on notebook markdown pc * PR feedback around replace ordering * update databaseName when it's set to master * usinng query as example
This commit is contained in:
committed by
Karl Burtram
parent
3ffef2fb02
commit
eee799aeef
@@ -25,6 +25,8 @@ import { CellType } from 'sql/workbench/parts/notebook/common/models/contracts';
|
||||
import { NotebookComponent } from 'sql/workbench/parts/notebook/browser/notebook.component';
|
||||
import { getErrorMessage } from 'vs/base/common/errors';
|
||||
import { INotebookModel } from 'sql/workbench/parts/notebook/browser/models/modelInterfaces';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
||||
import { TreeUpdateUtils } from 'sql/workbench/parts/objectExplorer/browser/treeUpdateUtils';
|
||||
|
||||
const msgLoading = localize('loading', "Loading kernels...");
|
||||
const msgChanging = localize('changing', "Changing kernel...");
|
||||
@@ -591,14 +593,22 @@ export class NewNotebookAction extends Action {
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@ICommandService private commandService: ICommandService
|
||||
@ICommandService private commandService: ICommandService,
|
||||
@IObjectExplorerService private objectExplorerService: IObjectExplorerService
|
||||
) {
|
||||
super(id, label);
|
||||
this.class = 'notebook-action new-notebook';
|
||||
}
|
||||
|
||||
run(context?: azdata.ConnectedContext): Promise<void> {
|
||||
return this.commandService.executeCommand(NewNotebookAction.INTERNAL_NEW_NOTEBOOK_CMD_ID, context);
|
||||
async run(context?: azdata.ObjectExplorerContext): Promise<void> {
|
||||
let connProfile: azdata.IConnectionProfile;
|
||||
if (context && context.nodeInfo) {
|
||||
let node = await this.objectExplorerService.getTreeNode(context.connectionProfile.id, context.nodeInfo.nodePath);
|
||||
connProfile = TreeUpdateUtils.getConnectionProfile(node).toIConnectionProfile();
|
||||
} else if (context && context.connectionProfile) {
|
||||
connProfile = context.connectionProfile;
|
||||
}
|
||||
return this.commandService.executeCommand(NewNotebookAction.INTERNAL_NEW_NOTEBOOK_CMD_ID, { connectionProfile: connProfile });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user