mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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;
|
isNewObject: boolean;
|
||||||
parentUrn: string;
|
parentUrn: string;
|
||||||
objectUrn?: string;
|
objectUrn?: string;
|
||||||
objectExplorerContext?: azdata.ObjectExplorerContext;
|
|
||||||
objectName?: string;
|
objectName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ export interface ScriptableDialogOptions {
|
|||||||
* The width of the dialog, defaults to narrow if not set
|
* The width of the dialog, defaults to narrow if not set
|
||||||
*/
|
*/
|
||||||
width?: azdata.window.DialogWidth;
|
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();
|
const script = await this.generateScript();
|
||||||
if (script) {
|
if (script) {
|
||||||
message = localizedConstants.ScriptGeneratedText;
|
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 {
|
} else {
|
||||||
message = localizedConstants.NoActionScriptedMessage;
|
message = localizedConstants.NoActionScriptedMessage;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user