mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Connect query editor when producing script from object management dialogs. (#24015)
This commit is contained in:
@@ -26,7 +26,6 @@ export interface ObjectManagementDialogOptions extends ScriptableDialogOptions {
|
||||
isNewObject: boolean;
|
||||
parentUrn: string;
|
||||
objectUrn?: string;
|
||||
objectExplorerContext?: azdata.ObjectExplorerContext;
|
||||
objectName?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@ export interface ScriptableDialogOptions {
|
||||
* The width of the dialog, defaults to narrow if not set
|
||||
*/
|
||||
width?: azdata.window.DialogWidth;
|
||||
/**
|
||||
* The object explorer context in which this dialog was opened.
|
||||
*/
|
||||
objectExplorerContext?: azdata.ObjectExplorerContext;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +94,27 @@ export abstract class ScriptableDialogBase<OptionsType extends ScriptableDialogO
|
||||
const script = await this.generateScript();
|
||||
if (script) {
|
||||
message = localizedConstants.ScriptGeneratedText;
|
||||
await azdata.queryeditor.openQueryDocument({ content: script }, providerId);
|
||||
let doc = await azdata.queryeditor.openQueryDocument({ content: script }, providerId);
|
||||
if (this.options.objectExplorerContext?.connectionProfile) {
|
||||
let profile = this.options.objectExplorerContext?.connectionProfile;
|
||||
let convertedProfile: azdata.connection.ConnectionProfile = {
|
||||
providerId: profile.providerName,
|
||||
connectionId: profile.id,
|
||||
connectionName: profile.connectionName,
|
||||
serverName: profile.serverName,
|
||||
databaseName: profile.databaseName,
|
||||
userName: profile.userName,
|
||||
password: profile.password,
|
||||
authenticationType: profile.authenticationType,
|
||||
savePassword: profile.savePassword,
|
||||
groupFullName: profile.groupFullName,
|
||||
groupId: profile.groupId,
|
||||
saveProfile: profile.savePassword,
|
||||
azureTenantId: profile.azureTenantId,
|
||||
options: profile.options
|
||||
};
|
||||
await doc.connect(convertedProfile);
|
||||
}
|
||||
} else {
|
||||
message = localizedConstants.NoActionScriptedMessage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user