From c69c303a2bdea26b290c436e67fb749d8dda1434 Mon Sep 17 00:00:00 2001 From: Kim Santiago <31145923+kisantia@users.noreply.github.com> Date: Thu, 8 Jul 2021 14:37:07 -0700 Subject: [PATCH] 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 --- .../src/dialogs/publishDatabaseDialog.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/extensions/sql-database-projects/src/dialogs/publishDatabaseDialog.ts b/extensions/sql-database-projects/src/dialogs/publishDatabaseDialog.ts index 8d371a77b3..b81f884587 100644 --- a/extensions/sql-database-projects/src/dialogs/publishDatabaseDialog.ts +++ b/extensions/sql-database-projects/src/dialogs/publishDatabaseDialog.ts @@ -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(>this.sqlCmdVars).length === 0) { + this.formBuilder?.addFormItem(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(this.sqlCmdVariablesFormComponentGroup); + } + for (let key in result.sqlCmdVariables) { (>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(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(this.sqlCmdVariablesFormComponentGroup); - } - // show file path in text box and hover text this.loadProfileTextBox!.value = fileUris[0].fsPath; this.loadProfileTextBox!.updateProperty('title', fileUris[0].fsPath);