mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix node infinitely loading when a firewall dialog is cancelled (#7970)
* add back icons for azure actions * fix firewall infinite loop * formatting * change message to firewall canceled * fix tests
This commit is contained in:
@@ -246,6 +246,9 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
if (!connectionResult.connected && !connectionResult.errorHandled) {
|
if (!connectionResult.connected && !connectionResult.errorHandled) {
|
||||||
// If connection fails show the dialog
|
// If connection fails show the dialog
|
||||||
return this.showConnectionDialogOnError(connection, owner, connectionResult, options);
|
return this.showConnectionDialogOnError(connection, owner, connectionResult, options);
|
||||||
|
} else if (!connectionResult.connected && connectionResult.errorHandled) {
|
||||||
|
// Cancelled firewall dialog
|
||||||
|
return undefined;
|
||||||
} else {
|
} else {
|
||||||
//Resolve with the connection result
|
//Resolve with the connection result
|
||||||
return connectionResult;
|
return connectionResult;
|
||||||
|
|||||||
@@ -593,8 +593,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
connect(uri, options, false, connectionProfile, error, errorCode, errorCallStack).then(result => {
|
connect(uri, options, false, connectionProfile, error, errorCode, errorCallStack).then(result => {
|
||||||
assert.equal(result.connected, expectedConnection);
|
assert.equal(result, undefined);
|
||||||
assert.equal(result.errorMessage, connectionResult.errorMessage);
|
|
||||||
verifyShowFirewallRuleDialog(connectionProfile, true);
|
verifyShowFirewallRuleDialog(connectionProfile, true);
|
||||||
verifyShowConnectionDialog(connectionProfile, ConnectionType.default, uri, true, connectionResult, false);
|
verifyShowConnectionDialog(connectionProfile, ConnectionType.default, uri, true, connectionResult, false);
|
||||||
done();
|
done();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export class OEShimService extends Disposable implements IOEShimService {
|
|||||||
|
|
||||||
private async connectOrPrompt(connProfile: ConnectionProfile): Promise<ConnectionProfile> {
|
private async connectOrPrompt(connProfile: ConnectionProfile): Promise<ConnectionProfile> {
|
||||||
connProfile = await new Promise(async (resolve, reject) => {
|
connProfile = await new Promise(async (resolve, reject) => {
|
||||||
await this.cm.connect(connProfile, undefined, { showConnectionDialogOnError: true, showFirewallRuleOnError: true, saveTheConnection: false, showDashboard: false, params: undefined }, {
|
let result = await this.cm.connect(connProfile, undefined, { showConnectionDialogOnError: true, showFirewallRuleOnError: true, saveTheConnection: false, showDashboard: false, params: undefined }, {
|
||||||
onConnectSuccess: async (e, profile) => {
|
onConnectSuccess: async (e, profile) => {
|
||||||
let existingConnection = this.cm.findExistingConnection(profile);
|
let existingConnection = this.cm.findExistingConnection(profile);
|
||||||
connProfile = new ConnectionProfile(this.capabilities, existingConnection);
|
connProfile = new ConnectionProfile(this.capabilities, existingConnection);
|
||||||
@@ -97,6 +97,10 @@ export class OEShimService extends Disposable implements IOEShimService {
|
|||||||
onConnectStart: undefined,
|
onConnectStart: undefined,
|
||||||
onDisconnect: undefined
|
onDisconnect: undefined
|
||||||
});
|
});
|
||||||
|
// connection cancelled from firewall dialog
|
||||||
|
if (!result) {
|
||||||
|
reject(new UserCancelledConnectionError(localize('firewallCanceled', "Firewall dialog canceled")));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return connProfile;
|
return connProfile;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user