Fix #4356 New Notebook from connection doesn't connect (#4364)

* Fix #4356 New Notebook from connection doesn't connect
Fix new notebook error by passing profile instead of ID.
- I could've just sent the ID over, but this fix sets the stage for disconnected connections to work (since we have enough info to properly connect).
- There's a bug in NotebookModel blocking the disconnected connection part working, but Yurong's in progress fixes will unblock this. Hence checking in as-is and working to properly unblock once that's in.

* Support connection profile in commandline service
- Added new context API for things that want to work on commandline and object explorer
- Refactored commandlineservice slightly to be async & have a simpler execution flow (far fewer if/else statements)

* Fix unit tests
- Fixed 2 issues raised by tests (sholdn't do new query if no profile passed, shouldn't error on new query failing)
- Updated unit tests to pass as expected given changes to the APIs.
This commit is contained in:
Kevin Cunnane
2019-03-12 12:14:08 -07:00
committed by GitHub
parent 77a3be6fd7
commit 7226f25c67
16 changed files with 166 additions and 143 deletions

View File

@@ -3667,19 +3667,30 @@ declare module 'azdata' {
export function getProvidersByType<T extends DataProvider>(providerType: DataProviderType): T[];
}
/**
* Context object passed as an argument to command callbacks.
* Defines the key properties required to identify a node in the object
* explorer tree and take action against it.
* Defines properties that can be sent for any connected context,
* whether that is the Object Explorer context menu or a command line
* startup argument.
*/
export interface ObjectExplorerContext {
export interface ConnectedContext {
/**
* The connection information for the selected object.
* Note that the connection is not guaranteed to be in a connected
* state on click.
*/
connectionProfile: IConnectionProfile;
}
/**
* Context object passed as an argument to command callbacks.
* Defines the key properties required to identify a node in the object
* explorer tree and take action against it.
*/
export interface ObjectExplorerContext extends ConnectedContext {
/**
* Defines whether this is a Connection-level object.
* If not, the object is expected to be a child object underneath
@@ -4016,9 +4027,9 @@ declare module 'azdata' {
providerId?: string;
/**
* Optional ID indicating the initial connection to use for this editor
* Optional profile indicating the initial connection to use for this editor
*/
connectionId?: string;
connectionProfile?: IConnectionProfile;
/**
* Default kernel for notebook