mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
Alanren/integration test (#3657)
* add an extension for integration tests * setup ads before running test * test setup * test cases * bash script * shorter temp folder name * code cleanup * add commented out original code * fix test error * test result path * rename results file * change file path * report smoke test results * test stablize * test stablization and configurable test servers * fix smoke test error * connection provider * simplify the integration test script * add comment * fix tslint error * address PR comments * add temp log to check whether the environment variable is already set * remove temp log * move api definition to testapi typing file * exclude integration tests extension * address comments
This commit is contained in:
@@ -15,13 +15,14 @@ import { ConnectionProviderProperties, IConnectionProviderRegistry, Extensions a
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { warn } from 'sql/base/common/log';
|
||||
|
||||
export class CommandLineService implements ICommandLineProcessing {
|
||||
private _connectionProfile: ConnectionProfile;
|
||||
private _showConnectionDialog: boolean;
|
||||
private _commandName:string;
|
||||
private _commandName: string;
|
||||
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@@ -30,7 +31,8 @@ export class CommandLineService implements ICommandLineProcessing {
|
||||
@IQueryEditorService private _queryEditorService: IQueryEditorService,
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@ICommandService private _commandService: ICommandService
|
||||
@ICommandService private _commandService: ICommandService,
|
||||
@IWorkspaceConfigurationService private _configurationService: IWorkspaceConfigurationService
|
||||
) {
|
||||
let profile = null;
|
||||
if (this._environmentService) {
|
||||
@@ -57,11 +59,11 @@ export class CommandLineService implements ICommandLineProcessing {
|
||||
let sqlProvider = registry.getProperties(Constants.mssqlProviderName);
|
||||
// We can't connect to object explorer until the MSSQL connection provider is registered
|
||||
if (sqlProvider) {
|
||||
this.processCommandLine().catch(reason=>{warn('processCommandLine failed: ' + reason);});
|
||||
this.processCommandLine().catch(reason => { warn('processCommandLine failed: ' + reason); });
|
||||
} else {
|
||||
registry.onNewProvider(e => {
|
||||
if (e.id === Constants.mssqlProviderName) {
|
||||
this.processCommandLine().catch(reason=>{warn('processCommandLine failed: ' + reason);});
|
||||
this.processCommandLine().catch(reason => { warn('processCommandLine failed: ' + reason); });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -76,13 +78,13 @@ export class CommandLineService implements ICommandLineProcessing {
|
||||
|
||||
let self = this;
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
|
||||
if (!self._commandName && !self._connectionProfile && !self._connectionManagementService.hasRegisteredServers()) {
|
||||
let showConnectDialogOnStartup: boolean = this._configurationService.getValue('workbench.showConnectDialogOnStartup');
|
||||
if (showConnectDialogOnStartup && !self._commandName && !self._connectionProfile && !self._connectionManagementService.hasRegisteredServers()) {
|
||||
// prompt the user for a new connection on startup if no profiles are registered
|
||||
self._connectionManagementService.showConnectionDialog()
|
||||
.then(() => {
|
||||
resolve();
|
||||
},
|
||||
resolve();
|
||||
},
|
||||
error => {
|
||||
reject(error);
|
||||
});
|
||||
@@ -91,31 +93,31 @@ export class CommandLineService implements ICommandLineProcessing {
|
||||
self._connectionManagementService.connectIfNotConnected(self._connectionProfile, 'connection', true)
|
||||
.then(() => {
|
||||
TaskUtilities.newQuery(self._connectionProfile,
|
||||
self._connectionManagementService,
|
||||
self._queryEditorService,
|
||||
self._objectExplorerService,
|
||||
self._editorService)
|
||||
.then( () => {
|
||||
resolve();
|
||||
}, error => {
|
||||
// ignore query editor failing to open.
|
||||
// the tests don't mock this out
|
||||
warn('unable to open query editor ' + error);
|
||||
resolve();
|
||||
});
|
||||
self._connectionManagementService,
|
||||
self._queryEditorService,
|
||||
self._objectExplorerService,
|
||||
self._editorService)
|
||||
.then(() => {
|
||||
resolve();
|
||||
}, error => {
|
||||
// ignore query editor failing to open.
|
||||
// the tests don't mock this out
|
||||
warn('unable to open query editor ' + error);
|
||||
resolve();
|
||||
});
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
self._connectionManagementService.connectIfNotConnected(self._connectionProfile, 'connection', true)
|
||||
.then(() => {
|
||||
self._commandService.executeCommand(self._commandName, self._connectionProfile).then(() => resolve(), error => reject(error));
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
.then(() => {
|
||||
self._commandService.executeCommand(self._commandName, self._connectionProfile).then(() => resolve(), error => reject(error));
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
}
|
||||
} else if (self._commandName) {
|
||||
self._commandService.executeCommand(self._commandName).then(() => resolve(), error => reject(error));
|
||||
self._commandService.executeCommand(self._commandName).then(() => resolve(), error => reject(error));
|
||||
}
|
||||
else {
|
||||
resolve();
|
||||
|
||||
@@ -77,6 +77,11 @@ export interface IObjectExplorerService {
|
||||
getTreeNode(connectionId: string, nodePath: string): Thenable<TreeNode>;
|
||||
|
||||
refreshNodeInView(connectionId: string, nodePath: string): Thenable<TreeNode>;
|
||||
|
||||
/**
|
||||
* For Testing purpose only. Get the context menu actions for an object explorer node.
|
||||
*/
|
||||
getNodeActions(connectionId: string, nodePath: string): Thenable<string[]>;
|
||||
}
|
||||
|
||||
interface SessionStatus {
|
||||
@@ -522,6 +527,17 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
return Object.values(this._activeObjectExplorerNodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* For Testing purpose only. Get the context menu actions for an object explorer node
|
||||
*/
|
||||
public getNodeActions(connectionId: string, nodePath: string): Thenable<string[]> {
|
||||
return this.getTreeNode(connectionId, nodePath).then(node => {
|
||||
return this._serverTreeView.treeActionProvider.getActions(this._serverTreeView.tree, this.getTreeItem(node)).then((actions) => {
|
||||
return actions.filter(action => action.label).map(action => action.label);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public async refreshNodeInView(connectionId: string, nodePath: string): Promise<TreeNode> {
|
||||
// Get the tree node and call refresh from the provider
|
||||
let treeNode = await this.getTreeNode(connectionId, nodePath);
|
||||
|
||||
@@ -31,6 +31,7 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { TreeNode, TreeItemCollapsibleState } from 'sql/parts/objectExplorer/common/treeNode';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { SERVER_GROUP_CONFIG, SERVER_GROUP_AUTOEXPAND_CONFIG } from 'sql/parts/objectExplorer/serverGroupDialog/serverGroup.contribution';
|
||||
import { ServerTreeActionProvider } from 'sql/parts/objectExplorer/viewlet/serverTreeActionProvider';
|
||||
|
||||
const $ = builder.$;
|
||||
|
||||
@@ -46,7 +47,7 @@ export class ServerTreeView {
|
||||
private _tree: ITree;
|
||||
private _toDispose: IDisposable[] = [];
|
||||
private _onSelectionOrFocusChange: Emitter<void>;
|
||||
|
||||
private _actionProvider: ServerTreeActionProvider;
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@@ -63,6 +64,7 @@ export class ServerTreeView {
|
||||
this);
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
this._onSelectionOrFocusChange = new Emitter();
|
||||
this._actionProvider = this._instantiationService.createInstance(ServerTreeActionProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,6 +81,14 @@ export class ServerTreeView {
|
||||
return this._onSelectionOrFocusChange.event;
|
||||
}
|
||||
|
||||
public get treeActionProvider(): ServerTreeActionProvider {
|
||||
return this._actionProvider;
|
||||
}
|
||||
|
||||
public get tree(): ITree {
|
||||
return this._tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the view body
|
||||
*/
|
||||
@@ -98,7 +108,6 @@ export class ServerTreeView {
|
||||
this._connectionManagementService.showConnectionDialog();
|
||||
}));
|
||||
}
|
||||
|
||||
this._tree = TreeCreationUtils.createRegisteredServersTree(container, this._instantiationService);
|
||||
//this._tree.setInput(undefined);
|
||||
this._toDispose.push(this._tree.onDidChangeSelection((event) => this.onSelected(event)));
|
||||
|
||||
18
src/sql/sqlops.proposed.d.ts
vendored
18
src/sql/sqlops.proposed.d.ts
vendored
@@ -133,7 +133,7 @@ declare module 'sqlops' {
|
||||
* @param index index to insert the component to
|
||||
* @param itemLayout Item Layout
|
||||
*/
|
||||
insertFormItem(formComponent: FormComponent | FormComponentGroup, index?: number, itemLayout?: FormItemLayout);
|
||||
insertFormItem(formComponent: FormComponent | FormComponentGroup, index?: number, itemLayout?: FormItemLayout): void;
|
||||
|
||||
/**
|
||||
* Removes a from item from the from
|
||||
@@ -1209,7 +1209,7 @@ declare module 'sqlops' {
|
||||
* Registers a save handler for this editor. This will be called if [supportsSave](#ModelViewEditorOptions.supportsSave)
|
||||
* is set to true and the editor is marked as dirty
|
||||
*/
|
||||
registerSaveHandler(handler: () => Thenable<boolean>);
|
||||
registerSaveHandler(handler: () => Thenable<boolean>): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1349,6 +1349,13 @@ declare module 'sqlops' {
|
||||
|
||||
}
|
||||
|
||||
export interface ConnectionResult {
|
||||
connected: boolean;
|
||||
connectionId: string;
|
||||
errorMessage: string;
|
||||
errorCode: number;
|
||||
}
|
||||
|
||||
export namespace connection {
|
||||
/**
|
||||
* List the databases that can be accessed from the given connection
|
||||
@@ -1371,6 +1378,12 @@ declare module 'sqlops' {
|
||||
* @param callback
|
||||
*/
|
||||
export function openConnectionDialog(providers?: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: IConnectionCompletionOptions): Thenable<connection.Connection>;
|
||||
|
||||
/**
|
||||
* Opens the connection and add it to object explorer and opens the dashboard and returns the ConnectionResult
|
||||
* @param connectionProfile connection profile
|
||||
*/
|
||||
export function connect(connectionProfile: IConnectionProfile): Thenable<ConnectionResult>;
|
||||
}
|
||||
|
||||
export namespace nb {
|
||||
@@ -2319,5 +2332,4 @@ declare module 'sqlops' {
|
||||
//#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
23
src/sql/sqlops.test.d.ts
vendored
Normal file
23
src/sql/sqlops.test.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// This is the place for APIs used for testing
|
||||
|
||||
import * as core from 'sqlops';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
declare module 'sqlops' {
|
||||
|
||||
export namespace extensions {
|
||||
export function install(vsixPath: string): Thenable<string>;
|
||||
}
|
||||
|
||||
export namespace objectexplorer {
|
||||
/**
|
||||
* get object explorer node context menu actions
|
||||
*/
|
||||
export function getNodeActions(connectionId: string, nodePath: string): Thenable<string[]>;
|
||||
}
|
||||
}
|
||||
@@ -47,4 +47,8 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
|
||||
public $getUriForConnection(connectionId: string): Thenable<string> {
|
||||
return this._proxy.$getUriForConnection(connectionId);
|
||||
}
|
||||
|
||||
public $connect(connectionProfile: sqlops.IConnectionProfile): Thenable<sqlops.ConnectionResult> {
|
||||
return this._proxy.$connect(connectionProfile);
|
||||
}
|
||||
}
|
||||
|
||||
23
src/sql/workbench/api/node/extHostExtensionManagement.ts
Normal file
23
src/sql/workbench/api/node/extHostExtensionManagement.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
|
||||
import { ExtHostExtensionManagementShape, MainThreadExtensionManagementShape, SqlMainContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
|
||||
|
||||
|
||||
export class ExtHostExtensionManagement implements ExtHostExtensionManagementShape {
|
||||
|
||||
private readonly _proxy: MainThreadExtensionManagementShape;
|
||||
|
||||
constructor(_mainContext: IMainContext) {
|
||||
this._proxy = _mainContext.getProxy(SqlMainContext.MainThreadExtensionManagement);
|
||||
}
|
||||
|
||||
$install(vsixPath: string): Thenable<string> {
|
||||
return this._proxy.$install(vsixPath);
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class ModelViewEditorImpl extends ModelViewPanelImpl implements sqlops.workspace
|
||||
this._proxy.$setDirty(this.handle, value);
|
||||
}
|
||||
|
||||
registerSaveHandler(handler: () => Thenable<boolean>) {
|
||||
registerSaveHandler(handler: () => Thenable<boolean>): void {
|
||||
this._saveHandler = handler;
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
let handle = this.getHandle(dialog);
|
||||
this.updateDialogContent(dialog);
|
||||
dialog.dialogName ? this._proxy.$openDialog(handle, dialog.dialogName) :
|
||||
this._proxy.$openDialog(handle);
|
||||
this._proxy.$openDialog(handle);
|
||||
}
|
||||
|
||||
public closeDialog(dialog: sqlops.window.modelviewdialog.Dialog): void {
|
||||
|
||||
@@ -30,6 +30,10 @@ export class ExtHostObjectExplorer implements ExtHostObjectExplorerShape {
|
||||
public $findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<sqlops.objectexplorer.ObjectExplorerNode[]> {
|
||||
return this._proxy.$findNodes(connectionId, type, schema, name, database, parentObjectNames).then(results => results.map(result => new ExtHostObjectExplorerNode(result, connectionId, this._proxy)));
|
||||
}
|
||||
|
||||
public $getNodeActions(connectionId: string, nodePath: string): Thenable<string[]> {
|
||||
return this._proxy.$getNodeActions(connectionId, nodePath);
|
||||
}
|
||||
}
|
||||
|
||||
class ExtHostObjectExplorerNode implements sqlops.objectexplorer.ObjectExplorerNode {
|
||||
|
||||
@@ -15,6 +15,9 @@ import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
|
||||
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadConnectionManagement)
|
||||
export class MainThreadConnectionManagement implements MainThreadConnectionManagementShape {
|
||||
@@ -28,6 +31,7 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
||||
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
|
||||
@IEditorService private _workbenchEditorService: IEditorService,
|
||||
@IConnectionDialogService private _connectionDialogService: IConnectionDialogService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService
|
||||
) {
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostConnectionManagement);
|
||||
@@ -54,7 +58,7 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
||||
|
||||
public async $openConnectionDialog(providers: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: sqlops.IConnectionCompletionOptions): Promise<sqlops.connection.Connection> {
|
||||
let connectionProfile = await this._connectionDialogService.openDialogAndWait(this._connectionManagementService, { connectionType: 1, providers: providers }, initialConnectionProfile);
|
||||
const connection = connectionProfile ? {
|
||||
const connection = connectionProfile ? {
|
||||
connectionId: connectionProfile.id,
|
||||
options: connectionProfile.options,
|
||||
providerName: connectionProfile.providerName
|
||||
@@ -101,4 +105,23 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
|
||||
};
|
||||
return connection;
|
||||
}
|
||||
|
||||
public $connect(connectionProfile: IConnectionProfile): Thenable<sqlops.ConnectionResult> {
|
||||
let profile = new ConnectionProfile(this._capabilitiesService, connectionProfile);
|
||||
profile.id = generateUuid();
|
||||
return this._connectionManagementService.connectAndSaveProfile(profile, undefined, {
|
||||
saveTheConnection: true,
|
||||
showDashboard: true,
|
||||
params: undefined,
|
||||
showConnectionDialogOnError: true,
|
||||
showFirewallRuleOnError: true
|
||||
}).then((result) => {
|
||||
return <sqlops.ConnectionResult>{
|
||||
connected: result.connected,
|
||||
connectionId: result.connected ? profile.id : undefined,
|
||||
errorCode: result.errorCode,
|
||||
errorMessage: result.errorMessage
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
32
src/sql/workbench/api/node/mainThreadExtensionManagement.ts
Normal file
32
src/sql/workbench/api/node/mainThreadExtensionManagement.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { SqlMainContext, MainThreadExtensionManagementShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
|
||||
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement)
|
||||
export class MainThreadExtensionManagement implements MainThreadExtensionManagementShape {
|
||||
|
||||
private _toDispose: IDisposable[];
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IExtensionManagementService private _extensionService: IExtensionManagementService
|
||||
) {
|
||||
this._toDispose = [];
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._toDispose = dispose(this._toDispose);
|
||||
}
|
||||
|
||||
public $install(vsixPath: string): Thenable<string> {
|
||||
return this._extensionService.install(vsixPath).then((value: void) => { return undefined; }, (reason: any) => { return reason ? reason.toString() : undefined; });
|
||||
}
|
||||
}
|
||||
@@ -78,4 +78,8 @@ export class MainThreadObjectExplorer implements MainThreadObjectExplorerShape {
|
||||
public $refresh(connectionId: string, nodePath: string): Thenable<sqlops.NodeInfo> {
|
||||
return this._objectExplorerService.refreshNodeInView(connectionId, nodePath).then(node => node.toNodeInfo());
|
||||
}
|
||||
|
||||
public $getNodeActions(connectionId: string, nodePath: string): Thenable<string[]> {
|
||||
return this._objectExplorerService.getNodeActions(connectionId, nodePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import { ExtHostQueryEditor } from 'sql/workbench/api/node/extHostQueryEditor';
|
||||
import { ExtHostBackgroundTaskManagement } from './extHostBackgroundTaskManagement';
|
||||
import { ExtHostNotebook } from 'sql/workbench/api/node/extHostNotebook';
|
||||
import { ExtHostNotebookDocumentsAndEditors } from 'sql/workbench/api/node/extHostNotebookDocumentsAndEditors';
|
||||
import { ExtHostExtensionManagement } from 'sql/workbench/api/node/extHostExtensionManagement';
|
||||
|
||||
export interface ISqlExtensionApiFactory {
|
||||
vsCodeFactory(extension: IExtensionDescription): typeof vscode;
|
||||
@@ -77,6 +78,7 @@ export function createApiFactory(
|
||||
const extHostQueryEditor = rpcProtocol.set(SqlExtHostContext.ExtHostQueryEditor, new ExtHostQueryEditor(rpcProtocol));
|
||||
const extHostNotebook = rpcProtocol.set(SqlExtHostContext.ExtHostNotebook, new ExtHostNotebook(rpcProtocol));
|
||||
const extHostNotebookDocumentsAndEditors = rpcProtocol.set(SqlExtHostContext.ExtHostNotebookDocumentsAndEditors, new ExtHostNotebookDocumentsAndEditors(rpcProtocol));
|
||||
const extHostExtensionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostExtensionManagement, new ExtHostExtensionManagement(rpcProtocol));
|
||||
|
||||
|
||||
return {
|
||||
@@ -129,6 +131,9 @@ export function createApiFactory(
|
||||
},
|
||||
getUriForConnection(connectionId: string): Thenable<string> {
|
||||
return extHostConnectionManagement.$getUriForConnection(connectionId);
|
||||
},
|
||||
connect(connectionProfile: sqlops.IConnectionProfile): Thenable<sqlops.ConnectionResult> {
|
||||
return extHostConnectionManagement.$connect(connectionProfile);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -152,6 +157,9 @@ export function createApiFactory(
|
||||
},
|
||||
findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<sqlops.objectexplorer.ObjectExplorerNode[]> {
|
||||
return extHostObjectExplorer.$findNodes(connectionId, type, schema, name, database, parentObjectNames);
|
||||
},
|
||||
getNodeActions(connectionId: string, nodePath: string): Thenable<string[]> {
|
||||
return extHostObjectExplorer.$getNodeActions(connectionId, nodePath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -421,6 +429,12 @@ export function createApiFactory(
|
||||
}
|
||||
};
|
||||
|
||||
const extensions: typeof sqlops.extensions = {
|
||||
install(vsixPath: string): Thenable<string> {
|
||||
return extHostExtensionManagement.$install(vsixPath);
|
||||
}
|
||||
};
|
||||
|
||||
const nb = {
|
||||
get notebookDocuments() {
|
||||
return extHostNotebookDocumentsAndEditors.getAllDocuments().map(doc => doc.document);
|
||||
@@ -483,7 +497,8 @@ export function createApiFactory(
|
||||
SqlThemeIcon: sqlExtHostTypes.SqlThemeIcon,
|
||||
TreeComponentItem: sqlExtHostTypes.TreeComponentItem,
|
||||
nb: nb,
|
||||
AzureResource: sqlExtHostTypes.AzureResource
|
||||
AzureResource: sqlExtHostTypes.AzureResource,
|
||||
extensions: extensions,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'sql/workbench/api/node/mainThreadModelViewDialog';
|
||||
import 'sql/workbench/api/node/mainThreadNotebook';
|
||||
import 'sql/workbench/api/node/mainThreadNotebookDocumentsAndEditors';
|
||||
import 'sql/workbench/api/node/mainThreadAccountManagement';
|
||||
import 'sql/workbench/api/node/mainThreadExtensionManagement';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
export class SqlExtHostContribution implements IWorkbenchContribution {
|
||||
|
||||
@@ -546,6 +546,7 @@ export interface MainThreadConnectionManagementShape extends IDisposable {
|
||||
$listDatabases(connectionId: string): Thenable<string[]>;
|
||||
$getConnectionString(connectionId: string, includePassword: boolean): Thenable<string>;
|
||||
$getUriForConnection(connectionId: string): Thenable<string>;
|
||||
$connect(connectionProfile: sqlops.IConnectionProfile): Thenable<sqlops.ConnectionResult>;
|
||||
}
|
||||
|
||||
export interface MainThreadCredentialManagementShape extends IDisposable {
|
||||
@@ -580,8 +581,8 @@ export const SqlMainContext = {
|
||||
MainThreadModelViewDialog: createMainId<MainThreadModelViewDialogShape>('MainThreadModelViewDialog'),
|
||||
MainThreadQueryEditor: createMainId<MainThreadQueryEditorShape>('MainThreadQueryEditor'),
|
||||
MainThreadNotebook: createMainId<MainThreadNotebookShape>('MainThreadNotebook'),
|
||||
MainThreadNotebookDocumentsAndEditors: createMainId<MainThreadNotebookDocumentsAndEditorsShape>('MainThreadNotebookDocumentsAndEditors')
|
||||
|
||||
MainThreadNotebookDocumentsAndEditors: createMainId<MainThreadNotebookDocumentsAndEditorsShape>('MainThreadNotebookDocumentsAndEditors'),
|
||||
MainThreadExtensionManagement: createMainId<MainThreadExtensionManagementShape>('MainThreadExtensionManagement')
|
||||
};
|
||||
|
||||
export const SqlExtHostContext = {
|
||||
@@ -602,7 +603,8 @@ export const SqlExtHostContext = {
|
||||
ExtHostModelViewDialog: createExtId<ExtHostModelViewDialogShape>('ExtHostModelViewDialog'),
|
||||
ExtHostQueryEditor: createExtId<ExtHostQueryEditorShape>('ExtHostQueryEditor'),
|
||||
ExtHostNotebook: createExtId<ExtHostNotebookShape>('ExtHostNotebook'),
|
||||
ExtHostNotebookDocumentsAndEditors: createExtId<ExtHostNotebookDocumentsAndEditorsShape>('ExtHostNotebookDocumentsAndEditors')
|
||||
ExtHostNotebookDocumentsAndEditors: createExtId<ExtHostNotebookDocumentsAndEditorsShape>('ExtHostNotebookDocumentsAndEditors'),
|
||||
ExtHostExtensionManagement: createExtId<ExtHostExtensionManagementShape>('ExtHostExtensionManagement')
|
||||
};
|
||||
|
||||
export interface MainThreadDashboardShape extends IDisposable {
|
||||
@@ -708,6 +710,7 @@ export interface MainThreadObjectExplorerShape extends IDisposable {
|
||||
$isExpanded(connectionId: string, nodePath: string): Thenable<boolean>;
|
||||
$findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<sqlops.NodeInfo[]>;
|
||||
$refresh(connectionId: string, nodePath: string): Thenable<sqlops.NodeInfo>;
|
||||
$getNodeActions(connectionId: string, nodePath: string): Thenable<string[]>;
|
||||
}
|
||||
|
||||
export interface ExtHostModelViewDialogShape {
|
||||
@@ -837,4 +840,12 @@ export interface MainThreadNotebookDocumentsAndEditorsShape extends IDisposable
|
||||
$trySaveDocument(uri: UriComponents): Thenable<boolean>;
|
||||
$tryShowNotebookDocument(resource: UriComponents, options: INotebookShowOptions): TPromise<string>;
|
||||
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleNotebookEditOperation[], opts: IUndoStopOptions): TPromise<boolean>;
|
||||
}
|
||||
|
||||
export interface ExtHostExtensionManagementShape {
|
||||
$install(vsixPath: string): Thenable<string>;
|
||||
}
|
||||
|
||||
export interface MainThreadExtensionManagementShape extends IDisposable {
|
||||
$install(vsixPath: string): Thenable<string>;
|
||||
}
|
||||
@@ -37,3 +37,16 @@ Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration).registerConf
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration).registerConfiguration({
|
||||
'id': 'showConnectDialogOnStartup',
|
||||
'title': nls.localize('showConnectDialogOnStartup', 'Show connect dialog on startup'),
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'workbench.showConnectDialogOnStartup': {
|
||||
'type': 'boolean',
|
||||
'default': true,
|
||||
'description': nls.localize('showConnectDialogOnStartup', 'Show connect dialog on startup')
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user