fix sql proj sqlcmd table showing after loading profile when it shouldn't (#11479)

This commit is contained in:
Kim Santiago
2020-07-22 17:59:26 -07:00
committed by GitHub
parent 154b75a0de
commit efc8182954

View File

@@ -29,6 +29,7 @@ export class PublishDatabaseDialog {
private dataSourcesRadioButton: azdata.RadioButtonComponent | undefined;
private loadProfileButton: azdata.ButtonComponent | undefined;
private sqlCmdVariablesTable: azdata.TableComponent | undefined;
private sqlCmdVariablesFormComponent: azdata.FormComponent | undefined;
private formBuilder: azdata.FormBuilder | undefined;
private connectionId: string | undefined;
@@ -106,6 +107,11 @@ export class PublishDatabaseDialog {
height: 400
}).component();
this.sqlCmdVariablesFormComponent = {
title: constants.sqlCmdTableLabel,
component: <azdata.TableComponent>this.sqlCmdVariablesTable
};
this.formBuilder = <azdata.FormBuilder>view.modelBuilder.formContainer()
.withFormItems([
{
@@ -418,13 +424,14 @@ export class PublishDatabaseDialog {
data: data
});
// add SQLCMD Variables table if it wasn't there before
if (Object.keys(this.project.sqlCmdVariables).length === 0) {
this.formBuilder?.insertFormItem({
title: constants.sqlCmdTableLabel,
component: <azdata.TableComponent>this.sqlCmdVariablesTable
},
6);
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?.insertFormItem(<azdata.FormComponent>this.sqlCmdVariablesFormComponent, 6);
}
} 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(<azdata.FormComponent>this.sqlCmdVariablesFormComponent);
}
}
});