diff --git a/extensions/mssql/src/objectManagement/interfaces.ts b/extensions/mssql/src/objectManagement/interfaces.ts index 971c2555d748..daabecbba80a 100644 --- a/extensions/mssql/src/objectManagement/interfaces.ts +++ b/extensions/mssql/src/objectManagement/interfaces.ts @@ -476,7 +476,7 @@ export interface DatabaseViewInfo extends ObjectManagement.ObjectViewInfo localize('objectManagement.databaseProperties.purgeQueryStoreDataMessage', "Are you sure you want to purge the Query Store data from '{0}'?", databaseName); // Util functions diff --git a/extensions/mssql/src/objectManagement/objectManagementService.ts b/extensions/mssql/src/objectManagement/objectManagementService.ts index aa1ea7706751..3b37aeb0d673 100644 --- a/extensions/mssql/src/objectManagement/objectManagementService.ts +++ b/extensions/mssql/src/objectManagement/objectManagementService.ts @@ -512,7 +512,7 @@ export class TestObjectManagementService implements IObjectManagementService { pageVerifyOptions: ['CHECKSUM', 'NONE', 'TORN_PAGE_DETECTION'], dscElevateOptions: ['OFF', 'WHEN_SUPPORTED', 'FAIL_UNSUPPORTED'], dscEnableDisableOptions: ['ENABLED', 'DISABLED'], - dscOnOffOptions: ['ON', 'OFF'], + propertiesOnOffOptions: ['ON', 'OFF'], rowDataFileGroupsOptions: ['PRIMARY', 'RowDataGroup1', 'RowDataGroup2'], fileStreamFileGroupsOptions: ['PRIMARY', 'FileStreamGroup1', 'FileStreamGroup2'], fileTypesOptions: ['ROWS', 'LOG', 'FILESTREAM'], diff --git a/extensions/mssql/src/objectManagement/ui/databaseDialog.ts b/extensions/mssql/src/objectManagement/ui/databaseDialog.ts index 85decf74a3b9..bab11838c7a8 100644 --- a/extensions/mssql/src/objectManagement/ui/databaseDialog.ts +++ b/extensions/mssql/src/objectManagement/ui/databaseDialog.ts @@ -12,7 +12,6 @@ import { CreateDatabaseDocUrl, DatabaseGeneralPropertiesDocUrl, DatabaseFilesPro import { Database, DatabaseFile, DatabaseScopedConfigurationsInfo, DatabaseViewInfo, FileGrowthType, FileGroup, FileGroupType } from '../interfaces'; import { convertNumToTwoDecimalStringInMB } from '../utils'; import { isUndefinedOrNull } from '../../types'; -import { deepClone } from '../../util/objects'; import { DatabaseFileDialog } from './databaseFileDialog'; import * as vscode from 'vscode'; @@ -82,7 +81,6 @@ export class DatabaseDialog extends ObjectManagementDialogBase { - this.dscOriginalData = deepClone(this.objectInfo.databaseScopedConfigurations); + // Configurations that doesn't support secondary replica + let secondaryUnsupportedConfigsSet = new Set([11, 12, 25, 6, 21]); const dscNameColumn: azdata.TableColumn = { type: azdata.ColumnType.text, value: localizedConstants.DatabaseScopedOptionsColumnHeader, @@ -1317,9 +1316,9 @@ export class DatabaseDialog extends ObjectManagementDialogBase { - return [metaData.name, + return [metaData.name.toLocaleUpperCase(), metaData.valueForPrimary, - metaData.valueForSecondary] + secondaryUnsupportedConfigsSet.has(metaData.id) ? localizedConstants.NotAvailableText : metaData.valueForSecondary] }), height: getTableHeight(this.objectInfo.databaseScopedConfigurations.length, 1, DscTableRowLength), width: DefaultTableWidth @@ -1387,18 +1386,18 @@ export class DatabaseDialog extends ObjectManagementDialogBase { await this.dscSecondaryValueInputGroup.updateCssStyles({ 'visibility': checked ? 'hidden' : 'visible' }); - this.currentRowObjectInfo.valueForSecondary = checked ? this.currentRowObjectInfo.valueForPrimary : this.dscOriginalData[this.currentRowId].valueForSecondary; + this.currentRowObjectInfo.valueForSecondary = this.currentRowObjectInfo.valueForPrimary; await this.valueForSecondaryInput.updateProperties({ value: this.currentRowObjectInfo.valueForSecondary }); if (this.dscTable.data[this.currentRowId][2] !== this.currentRowObjectInfo.valueForSecondary) { this.dscTable.data[this.currentRowId][2] = this.currentRowObjectInfo.valueForSecondary; @@ -1550,7 +1549,7 @@ export class DatabaseDialog extends ObjectManagementDialogBase { await this.dscSecondaryValueDropdownGroup.updateCssStyles({ 'visibility': checked ? 'hidden' : 'visible' }); - this.currentRowObjectInfo.valueForSecondary = checked ? this.currentRowObjectInfo.valueForPrimary : this.dscOriginalData[this.currentRowId].valueForSecondary; + this.currentRowObjectInfo.valueForSecondary = this.currentRowObjectInfo.valueForPrimary; await this.valueForSecondaryDropdown.updateProperties({ value: this.currentRowObjectInfo.valueForSecondary }); }, true); this.dscSecondaryCheckboxForDropdownGroup = this.createGroup('', [this.setSecondaryCheckboxForDropdowns], false, true); @@ -1727,10 +1726,10 @@ export class DatabaseDialog extends ObjectManagementDialogBase { - this.objectInfo.queryStoreOptions.waitStatisticsCaptureMode = checked; - }, this.objectInfo.queryStoreOptions.waitStatisticsCaptureMode, this.areQueryStoreOptionsEnabled); - containers.push(this.waitStatisticsCaptureMode); + this.waitStatisticsCaptureMode = this.createDropdown(localizedConstants.WaitStatisticsCaptureModeText, async (newValue) => { + this.objectInfo.queryStoreOptions.waitStatisticsCaptureMode = newValue as string; + }, this.viewInfo.propertiesOnOffOptions, this.objectInfo.queryStoreOptions.waitStatisticsCaptureMode.toUpperCase(), this.areQueryStoreOptionsEnabled, DefaultInputWidth); + containers.push(this.createLabelInputContainer(localizedConstants.WaitStatisticsCaptureModeText, this.waitStatisticsCaptureMode)); } const retentionSection = this.createGroup(localizedConstants.WaitStatisticsCaptureModeText, containers, true); this.queryStoreTabSectionsContainer.push(retentionSection); @@ -1848,7 +1847,8 @@ export class DatabaseDialog extends ObjectManagementDialogBase { diff --git a/extensions/mssql/src/objectManagement/ui/databaseFileDialog.ts b/extensions/mssql/src/objectManagement/ui/databaseFileDialog.ts index e27ae84905e2..a13fccd7962b 100644 --- a/extensions/mssql/src/objectManagement/ui/databaseFileDialog.ts +++ b/extensions/mssql/src/objectManagement/ui/databaseFileDialog.ts @@ -92,7 +92,10 @@ export class DatabaseFileDialog extends DialogBase { errors.push(localizedConstants.FileNameExistsError(this.result.name.trim())); } // If new file, verify if the file name with extension already exists - if (this.options.isNewFile && !!this.options.files.find(file => { return (path.join(file.path, file.fileNameWithExtension) === path.join(this.result.path, this.result.fileNameWithExtension)) })) { + if (this.options.isNewFile && !!this.options.files.find(file => { + return (this.result.name === file.name && + path.join(file.path, file.fileNameWithExtension) === path.join(this.result.path, this.result.fileNameWithExtension)) + })) { errors.push(localizedConstants.FileAlreadyExistsError(path.join(this.result.path, this.result.fileNameWithExtension))); } } @@ -157,7 +160,8 @@ export class DatabaseFileDialog extends DialogBase { ariaLabel: localizedConstants.SizeInMbText, inputType: 'number', enabled: this.options.databaseFile.type !== localizedConstants.FilestreamFileType, - value: String(this.options.databaseFile.sizeInMb) + value: String(this.options.databaseFile.sizeInMb), + min: 1 }); const fileSizeContainer = this.createLabelInputContainer(localizedConstants.SizeInMbText, this.fileSizeInput); containers.push(fileSizeContainer); @@ -332,7 +336,7 @@ export class DatabaseFileDialog extends DialogBase { } // File Stream else if (selectedOption === localizedConstants.FilestreamFileType) { - fileGroupDdOptions = this.options.filestreamFilegroups; + fileGroupDdOptions = this.options.filestreamFilegroups.length > 0 ? this.options.filestreamFilegroups : [localizedConstants.FileGroupForFilestreamTypeText]; fileGroupDdValue = this.result.fileGroup; visibility = 'hidden'; maxSizeGroupMarginTop = '-130px';