mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 09:35:37 -05:00
Allow data explorer to use connect (#5564)
* wip * handle save password; get correct profile * ensure resolve is being called * fix tests * fix more tests
This commit is contained in:
@@ -183,7 +183,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
* @param params Include the uri, type of connection
|
||||
* @param model the existing connection profile to create a new one from
|
||||
*/
|
||||
public showConnectionDialog(params?: INewConnectionParams, model?: IConnectionProfile, connectionResult?: IConnectionResult): Promise<void> {
|
||||
public showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: IConnectionProfile, connectionResult?: IConnectionResult): Promise<void> {
|
||||
let self = this;
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!params) {
|
||||
@@ -192,7 +192,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
if (!model && params.input && params.input.uri) {
|
||||
model = this._connectionStatusManager.getConnectionProfile(params.input.uri);
|
||||
}
|
||||
self._connectionDialogService.showDialog(self, params, model, connectionResult).then(() => {
|
||||
self._connectionDialogService.showDialog(self, params, model, connectionResult, options).then(() => {
|
||||
resolve();
|
||||
}, dialogError => {
|
||||
this.logService.warn('failed to open the connection dialog. error: ' + dialogError);
|
||||
@@ -317,7 +317,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
runQueryOnCompletion: RunQueryOnConnectionMode.none,
|
||||
showDashboard: options.showDashboard
|
||||
};
|
||||
this.showConnectionDialog(params, connection, connectionResult).then(() => {
|
||||
this.showConnectionDialog(params, options, connection, connectionResult).then(() => {
|
||||
resolve(connectionResult);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
@@ -455,7 +455,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
this.tryAddActiveConnection(connectionMgmtInfo, connection, options.saveTheConnection);
|
||||
|
||||
if (callbacks.onConnectSuccess) {
|
||||
callbacks.onConnectSuccess(options.params);
|
||||
callbacks.onConnectSuccess(options.params, connectionResult.connectionProfile);
|
||||
}
|
||||
if (options.saveTheConnection) {
|
||||
this.saveToSettings(uri, connection).then(value => {
|
||||
@@ -466,7 +466,13 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
connection.saveProfile = false;
|
||||
this.doActionsAfterConnectionComplete(uri, options);
|
||||
}
|
||||
resolve(connectionResult);
|
||||
if (connection.savePassword) {
|
||||
this._connectionStore.savePassword(connection).then(() => {
|
||||
resolve(connectionResult);
|
||||
});
|
||||
} else {
|
||||
resolve(connectionResult);
|
||||
}
|
||||
} else if (connectionResult && connectionResult.errorMessage) {
|
||||
this.handleConnectionError(connection, uri, options, callbacks, connectionResult).then(result => {
|
||||
resolve(result);
|
||||
|
||||
Reference in New Issue
Block a user