From abdd9af93130df71f2789d6793ed3f23700d0d45 Mon Sep 17 00:00:00 2001 From: Kim Santiago <31145923+kisantia@users.noreply.github.com> Date: Thu, 14 May 2020 14:31:47 -0700 Subject: [PATCH] update deploy dialog to not show dropdown when there aren't any data sources (#10404) --- .../sql-database-projects/src/common/constants.ts | 1 + .../src/dialogs/deployDatabaseDialog.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/extensions/sql-database-projects/src/common/constants.ts b/extensions/sql-database-projects/src/common/constants.ts index 6b85170b8493..b88b378dc855 100644 --- a/extensions/sql-database-projects/src/common/constants.ts +++ b/extensions/sql-database-projects/src/common/constants.ts @@ -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 diff --git a/extensions/sql-database-projects/src/dialogs/deployDatabaseDialog.ts b/extensions/sql-database-projects/src/dialogs/deployDatabaseDialog.ts index 6adc96093fe1..a35029dcdaa7 100644 --- a/extensions/sql-database-projects/src/dialogs/deployDatabaseDialog.ts +++ b/extensions/sql-database-projects/src/dialogs/deployDatabaseDialog.ts @@ -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(); @@ -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[] = [];