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:
Anthony Dresser
2019-05-23 11:44:18 -07:00
committed by GitHub
parent 5e8a52bcc0
commit aae1480e4f
15 changed files with 87 additions and 50 deletions

View File

@@ -158,7 +158,7 @@ export class AddServerAction extends Action {
saveProfile: true,
id: element.id
};
this._connectionManagementService.showConnectionDialog(undefined, connection);
this._connectionManagementService.showConnectionDialog(undefined, undefined, connection);
return Promise.resolve(true);
}
}

View File

@@ -48,12 +48,23 @@ export class OEShimService extends Disposable implements IOEShimService {
let connProfile = new ConnectionProfile(this.capabilities, node.payload);
connProfile.saveProfile = false;
if (this.cm.providerRegistered(providerId)) {
let userProfile = await this.cd.openDialogAndWait(this.cm, { connectionType: ConnectionType.default, showDashboard: false }, connProfile, undefined, false);
if (userProfile) {
connProfile = new ConnectionProfile(this.capabilities, userProfile);
} else {
return Promise.reject('User canceled');
}
await new Promise(async (resolve, reject) => {
await this.cm.connect(connProfile, undefined,
{ showConnectionDialogOnError: true, showFirewallRuleOnError: true, saveTheConnection: false, showDashboard: false, params: undefined },
{
onConnectSuccess: async (e, profile) => {
let existingConnection = this.cm.findExistingConnection(profile);
connProfile = new ConnectionProfile(this.capabilities, await this.cm.addSavedPassword(existingConnection));
resolve();
},
onConnectCanceled: () => {
reject('User canceled');
},
onConnectReject: undefined,
onConnectStart: undefined,
onDisconnect: undefined
});
});
}
let sessionResp = await this.oe.createNewSession(providerId, connProfile);
let disp = this.oe.onUpdateObjectExplorerNodes(e => {