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