Skip to content

Commit

Permalink
update deploy dialog to not show dropdown when there aren't any data …
Browse files Browse the repository at this point in the history
…sources (#10404)
  • Loading branch information
kisantia authored May 14, 2020
1 parent e95650d commit abdd9af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions extensions/sql-database-projects/src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const dataSourceRadioButtonLabel = localize('dataSourceRadioButtonLabel',
export const connectionRadioButtonLabel = localize('connectionRadioButtonLabel', "Connections");
export const selectConnectionRadioButtonsTitle = localize('selectconnectionRadioButtonsTitle', "Specify connection from:");
export const dataSourceDropdownTitle = localize('dataSourceDropdownTitle', "Data source");
export const noDataSourcesText = localize('noDataSourcesText', "No data sources in this project");

// Error messages

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class DeployDatabaseDialog {
ariaLabel: constants.databaseNameLabel
}).component();

this.dataSourcesFormComponent = this.createDataSourcesDropdown(view);
this.dataSourcesFormComponent = this.createDataSourcesFormComponent(view);

this.targetDatabaseTextBox.onTextChanged(() => {
this.tryEnableGenerateScriptAndOkButtons();
Expand Down Expand Up @@ -178,6 +178,18 @@ export class DeployDatabaseDialog {
};
}

private createDataSourcesFormComponent(view: azdata.ModelView): azdata.FormComponent {
if (this.project.dataSources.length > 0) {
return this.createDataSourcesDropdown(view);
} else {
const noDataSourcesText = view.modelBuilder.text().withProperties({ value: constants.noDataSourcesText }).component();
return {
title: constants.dataSourceDropdownTitle,
component: noDataSourcesText
};
}
}

private createDataSourcesDropdown(view: azdata.ModelView): azdata.FormComponent {
let dataSourcesValues: DataSourceDropdownValue[] = [];

Expand Down

0 comments on commit abdd9af

Please sign in to comment.