mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
connection contribution point (#880)
* init * finished compile erros * fixed all merge conflicts * fix dialog problems * formatting * fix opening dialog on first open * fix various problems with connectiondialog * formatting * fix tests * added connection contrib * formatting * formatting and adding capabilities to shutdown * fix connection buffering * formatting * fix tests
This commit is contained in:
@@ -16,6 +16,7 @@ import * as sqlops from 'sqlops';
|
||||
import * as Utils from 'sql/parts/connection/common/utils';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ConnectionOptionSpecialType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ConnectionProviderProperties } from 'sql/workbench/parts/connection/common/connectionProviderExtension';
|
||||
|
||||
export class ConnectionController implements IConnectionComponentController {
|
||||
private _container: HTMLElement;
|
||||
@@ -31,14 +32,14 @@ export class ConnectionController implements IConnectionComponentController {
|
||||
|
||||
constructor(container: HTMLElement,
|
||||
connectionManagementService: IConnectionManagementService,
|
||||
sqlCapabilities: sqlops.DataProtocolServerCapabilities,
|
||||
connectionProperties: ConnectionProviderProperties,
|
||||
callback: IConnectionComponentCallbacks,
|
||||
providerName: string,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService ) {
|
||||
@IInstantiationService private _instantiationService: IInstantiationService) {
|
||||
this._container = container;
|
||||
this._connectionManagementService = connectionManagementService;
|
||||
this._callback = callback;
|
||||
this._providerOptions = sqlCapabilities.connectionProvider.options;
|
||||
this._providerOptions = connectionProperties.connectionOptions;
|
||||
var specialOptions = this._providerOptions.filter(
|
||||
(property) => (property.specialValueType !== null && property.specialValueType !== undefined));
|
||||
this._connectionWidget = this._instantiationService.createInstance(ConnectionWidget, specialOptions, {
|
||||
@@ -48,8 +49,8 @@ export class ConnectionController implements IConnectionComponentController {
|
||||
onSetAzureTimeOut: () => this.handleonSetAzureTimeOut(),
|
||||
onFetchDatabases: (serverName: string, authenticationType: string, userName?: string, password?: string) => this.onFetchDatabases(
|
||||
serverName, authenticationType, userName, password).then(result => {
|
||||
return result;
|
||||
})
|
||||
return result;
|
||||
})
|
||||
}, providerName);
|
||||
this._providerName = providerName;
|
||||
}
|
||||
@@ -65,7 +66,7 @@ export class ConnectionController implements IConnectionComponentController {
|
||||
let uri = this._connectionManagementService.getConnectionId(tempProfile);
|
||||
return new Promise<string[]>((resolve, reject) => {
|
||||
if (this._databaseCache.has(uri)) {
|
||||
let cachedDatabases : string[] = this._databaseCache.get(uri);
|
||||
let cachedDatabases: string[] = this._databaseCache.get(uri);
|
||||
if (cachedDatabases !== null) {
|
||||
resolve(cachedDatabases);
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,7 @@ import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { entries } from 'sql/base/common/objects';
|
||||
|
||||
export interface IConnectionValidateResult {
|
||||
isValid: boolean;
|
||||
@@ -190,7 +191,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
// Set the model name, initialize the controller if needed, and return the controller
|
||||
this._model.providerName = providerName;
|
||||
if (!this._connectionControllerMap[providerName]) {
|
||||
this._connectionControllerMap[providerName] = this._instantiationService.createInstance(ConnectionController, this._container, this._connectionManagementService, this._capabilitiesService.getCapabilities(providerName), {
|
||||
this._connectionControllerMap[providerName] = this._instantiationService.createInstance(ConnectionController, this._container, this._connectionManagementService, this._capabilitiesService.getCapabilities(providerName).connection, {
|
||||
onSetConnectButton: (enable: boolean) => this.handleSetConnectButtonEnable(enable)
|
||||
}, providerName);
|
||||
}
|
||||
@@ -274,12 +275,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
// only create the provider maps first time the dialog gets called
|
||||
let capabilitiesPromise: Promise<void> = Promise.resolve();
|
||||
if (this._providerTypes.length === 0) {
|
||||
capabilitiesPromise = this._capabilitiesService.onCapabilitiesReady().then(() => {
|
||||
this._capabilitiesService.providers.map(p => {
|
||||
let capabilities = this._capabilitiesService.getCapabilities(p);
|
||||
this._providerTypes.push(capabilities.providerDisplayName);
|
||||
this._providerNameToDisplayNameMap[capabilities.providerName] = capabilities.providerDisplayName;
|
||||
});
|
||||
entries(this._capabilitiesService.providers).forEach(p => {
|
||||
this._providerTypes.push(p[1].connection.displayName);
|
||||
this._providerNameToDisplayNameMap[p[0]] = p[1].connection.displayName;
|
||||
});
|
||||
}
|
||||
capabilitiesPromise.then(s => {
|
||||
|
||||
Reference in New Issue
Block a user