mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 01:25:37 -05:00
fix duplicate sqlcmd var header when loading publish profile multiple times (#16007)
* fix duplicate sqlcmd var header when loading publish profile multiple times * remove variable to keep track of count
This commit is contained in:
@@ -556,6 +556,16 @@ export class PublishDatabaseDialog {
|
||||
this.targetDatabaseDropDown!.value = result.databaseName;
|
||||
}
|
||||
|
||||
if (Object.keys(result.sqlCmdVariables).length) {
|
||||
// add SQLCMD Variables table if it wasn't there before and the profile had sqlcmd variables
|
||||
if (Object.keys(this.project.sqlCmdVariables).length === 0 && Object.keys(<Record<string, string>>this.sqlCmdVars).length === 0) {
|
||||
this.formBuilder?.addFormItem(<azdataType.FormComponentGroup>this.sqlCmdVariablesFormComponentGroup);
|
||||
}
|
||||
} else if (Object.keys(this.project.sqlCmdVariables).length === 0) {
|
||||
// remove the table if there are no SQLCMD variables in the project and loaded profile
|
||||
this.formBuilder?.removeFormItem(<azdataType.FormComponentGroup>this.sqlCmdVariablesFormComponentGroup);
|
||||
}
|
||||
|
||||
for (let key in result.sqlCmdVariables) {
|
||||
(<Record<string, string>>this.sqlCmdVars)[key] = result.sqlCmdVariables[key];
|
||||
}
|
||||
@@ -567,16 +577,6 @@ export class PublishDatabaseDialog {
|
||||
dataValues: data
|
||||
});
|
||||
|
||||
if (Object.keys(result.sqlCmdVariables).length) {
|
||||
// add SQLCMD Variables table if it wasn't there before
|
||||
if (Object.keys(this.project.sqlCmdVariables).length === 0) {
|
||||
this.formBuilder?.addFormItem(<azdataType.FormComponentGroup>this.sqlCmdVariablesFormComponentGroup);
|
||||
}
|
||||
} else if (Object.keys(this.project.sqlCmdVariables).length === 0) {
|
||||
// remove the table if there are no SQLCMD variables in the project and loaded profile
|
||||
this.formBuilder?.removeFormItem(<azdataType.FormComponentGroup>this.sqlCmdVariablesFormComponentGroup);
|
||||
}
|
||||
|
||||
// show file path in text box and hover text
|
||||
this.loadProfileTextBox!.value = fileUris[0].fsPath;
|
||||
this.loadProfileTextBox!.updateProperty('title', fileUris[0].fsPath);
|
||||
|
||||
Reference in New Issue
Block a user