Use connection Id from result for fetching database list (#24017)

This commit is contained in:
Cheena Malhotra
2023-07-31 10:23:22 -07:00
committed by GitHub
parent 5b70fd1afe
commit 77ac63741f
4 changed files with 45 additions and 7 deletions

View File

@@ -64,7 +64,12 @@ export class CreateProjectFromDatabaseDialog {
if (!result.connected) { if (!result.connected) {
// if can't connect automatically, open connection dialog with the info from the profile // if can't connect automatically, open connection dialog with the info from the profile
const connection = await getAzdataApi()!.connection.openConnectionDialog(undefined, this.profile); const connection = await getAzdataApi()!.connection.openConnectionDialog(undefined, this.profile, {
saveConnection: false,
showDashboard: false,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
connected = !!connection; connected = !!connection;
// update these fields if connection was successful, to ensure they match the connection made // update these fields if connection was successful, to ensure they match the connection made
@@ -74,6 +79,9 @@ export class CreateProjectFromDatabaseDialog {
this.profile.serverName = connection.options['server']; this.profile.serverName = connection.options['server'];
this.profile.userName = connection.options['user']; this.profile.userName = connection.options['user'];
} }
} else {
// Successfully connectted, update connection Id as received.
this.profile.id = result.connectionId!;
} }
} }
} }
@@ -248,7 +256,12 @@ export class CreateProjectFromDatabaseDialog {
}).component(); }).component();
this.selectConnectionButton.onDidClick(async () => { this.selectConnectionButton.onDidClick(async () => {
let connection = await getAzdataApi()!.connection.openConnectionDialog(); let connection = await getAzdataApi()!.connection.openConnectionDialog(undefined, undefined, {
saveConnection: false,
showDashboard: false,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
this.connectionId = connection.connectionId; this.connectionId = connection.connectionId;
let connectionTextboxValue: string; let connectionTextboxValue: string;

View File

@@ -214,7 +214,12 @@ export class PublishDatabaseDialog {
connId = connResult.connectionId!; connId = connResult.connectionId!;
} }
else { else {
connId = (await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, connProfile)).connectionId; connId = (await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, connProfile, {
saveConnection: false,
showDashboard: false,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
})).connectionId;
} }
} }
else { else {
@@ -742,7 +747,12 @@ export class PublishDatabaseDialog {
}).component(); }).component();
this.selectConnectionButton.onDidClick(async () => { this.selectConnectionButton.onDidClick(async () => {
let connection = await utils.getAzdataApi()!.connection.openConnectionDialog(); let connection = await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, undefined, {
saveConnection: false,
showDashboard: false,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
this.connectionId = connection.connectionId; this.connectionId = connection.connectionId;
this.serverName = connection.options['server']; this.serverName = connection.options['server'];

View File

@@ -365,7 +365,12 @@ export class UpdateProjectFromDatabaseDialog {
} }
private async connectionButtonClick() { private async connectionButtonClick() {
let connection = await getAzdataApi()!.connection.openConnectionDialog(); let connection = await getAzdataApi()!.connection.openConnectionDialog(undefined, undefined, {
saveConnection: false,
showDashboard: false,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
if (connection) { if (connection) {
this.connectionId = connection.connectionId; this.connectionId = connection.connectionId;
await this.populateServerDropdown(); await this.populateServerDropdown();

View File

@@ -94,7 +94,12 @@ async function readConnectionString(xmlDoc: any): Promise<{ connectionId: string
if (azdataApi) { if (azdataApi) {
const connectionResult = await utils.getAzdataApi()!.connection.connect(connectionProfile, false, false); const connectionResult = await utils.getAzdataApi()!.connection.connect(connectionProfile, false, false);
if (!connectionResult.connected) { if (!connectionResult.connected) {
const connection = await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, connectionProfile); const connection = await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, connectionProfile, {
saveConnection: false,
showDashboard: false,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
connId = connection.connectionId; connId = connection.connectionId;
} else { } else {
connId = connectionResult.connectionId!; connId = connectionResult.connectionId!;
@@ -107,7 +112,12 @@ async function readConnectionString(xmlDoc: any): Promise<{ connectionId: string
} }
else { else {
if (azdataApi) { if (azdataApi) {
const connection = await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, connectionProfile); const connection = await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, connectionProfile, {
saveConnection: false,
showDashboard: false,
showConnectionDialogOnError: true,
showFirewallRuleOnError: true
});
connId = connection.connectionId; connId = connection.connectionId;
server = connection.options['server']; server = connection.options['server'];
username = connection.options['user']; username = connection.options['user'];