mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Enabling options tab for database properties (#23448)
* Initial commit for adding a basic general tab for the database properties * Refactoring for dialog inputs * removed properties nodeType and using database node and additional cleanup, diabling the functionality. * Changes according to STS data fetch * Reuse database Dialog * Undo contract file change * more refactoring * fetched scrollbar fix into this PR * Tabbed panel is being used for horizontal tabs * stying fix for general tab button * final commit for today :) * Updates according to STS changes * missed updates * Refactored updates * moved options as discussed and added collapsible sections... need to fix scroll bar * Fixing the horizontal scroll bar of tabbedpanel * initial updates * need to fix the error! * rror fixed and options are loading with sample values * need to load real values for all felds and map values to dropdown options * Dd loading correctly, need to add validation to recovery field and save options back * refactor * removing nullable property * All changes done except recoveryTime validation * Refactoring * all values are saving as expected, isDirty flag is fixed. Todo: recovery validation and tests * added general section for the options tab * modifying pageVerify and userAccess to string array * updates to general section of options tb * disabling couple of general properties for MI * Adding server edition conditions and toggling the UI options * adding numeric validation to the recovey time * Removing serveInfo logic and using the unsupported options approach from STS * addressing comments and little code refactor * changes with nullOrUndefined helper method * replacing dropdowns with checkboxes * adding unit test for helper method * removed commented sample code and added comments
This commit is contained in:
committed by
GitHub
parent
1bc22d896b
commit
acfa93fbb8
@@ -443,6 +443,17 @@ export interface Database extends ObjectManagement.SqlObject {
|
|||||||
azureServiceLevelObjective?: string;
|
azureServiceLevelObjective?: string;
|
||||||
azureEdition?: string;
|
azureEdition?: string;
|
||||||
azureMaxSize?: string;
|
azureMaxSize?: string;
|
||||||
|
autoCreateIncrementalStatistics: boolean;
|
||||||
|
autoCreateStatistics: boolean;
|
||||||
|
autoShrink: boolean;
|
||||||
|
autoUpdateStatistics: boolean;
|
||||||
|
autoUpdateStatisticsAsynchronously: boolean;
|
||||||
|
isLedgerDatabase?: boolean;
|
||||||
|
pageVerify?: string;
|
||||||
|
targetRecoveryTimeInSec?: number;
|
||||||
|
databaseReadOnly?: boolean;
|
||||||
|
encryptionEnabled: boolean;
|
||||||
|
restrictAccess?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DatabaseViewInfo extends ObjectManagement.ObjectViewInfo<Database> {
|
export interface DatabaseViewInfo extends ObjectManagement.ObjectViewInfo<Database> {
|
||||||
@@ -452,12 +463,13 @@ export interface DatabaseViewInfo extends ObjectManagement.ObjectViewInfo<Databa
|
|||||||
containmentTypes: string[];
|
containmentTypes: string[];
|
||||||
recoveryModels: string[];
|
recoveryModels: string[];
|
||||||
files: DatabaseFile[];
|
files: DatabaseFile[];
|
||||||
|
|
||||||
isAzureDB: boolean;
|
isAzureDB: boolean;
|
||||||
azureBackupRedundancyLevels: string[];
|
azureBackupRedundancyLevels: string[];
|
||||||
azureServiceLevelObjectives: AzureEditionDetails[];
|
azureServiceLevelObjectives: AzureEditionDetails[];
|
||||||
azureEditions: string[];
|
azureEditions: string[];
|
||||||
azureMaxSizes: AzureEditionDetails[];
|
azureMaxSizes: AzureEditionDetails[];
|
||||||
|
pageVerifyOptions: string[];
|
||||||
|
restrictAccessOptions: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AzureEditionDetails {
|
export interface AzureEditionDetails {
|
||||||
|
|||||||
@@ -258,14 +258,17 @@ export const ServerCollationText = localize('objectManagement.serverCollation',
|
|||||||
export const ServiceTierText = localize('objectManagement.serviceTier', "Service Tier");
|
export const ServiceTierText = localize('objectManagement.serviceTier', "Service Tier");
|
||||||
export const StorageSpaceUsageInMBText = localize('objectManagement.storageSpaceUsageInMB', "Storage Space Usage (MB)");
|
export const StorageSpaceUsageInMBText = localize('objectManagement.storageSpaceUsageInMB', "Storage Space Usage (MB)");
|
||||||
export const VersionText = localize('objectManagement.versionText', "Version");
|
export const VersionText = localize('objectManagement.versionText', "Version");
|
||||||
|
|
||||||
|
|
||||||
export const minServerMemoryText = localize('objectManagement.minServerMemoryText', "Minimum Server Memory (MB)");
|
export const minServerMemoryText = localize('objectManagement.minServerMemoryText', "Minimum Server Memory (MB)");
|
||||||
export const maxServerMemoryText = localize('objectManagement.maxServerMemoryText', "Maximum Server Memory (MB)");
|
export const maxServerMemoryText = localize('objectManagement.maxServerMemoryText', "Maximum Server Memory (MB)");
|
||||||
|
|
||||||
//Database properties Dialog
|
//Database properties Dialog
|
||||||
export const LastDatabaseBackupText = localize('objectManagement.lastDatabaseBackup', "Last Database Backup");
|
export const LastDatabaseBackupText = localize('objectManagement.lastDatabaseBackup', "Last Database Backup");
|
||||||
export const LastDatabaseLogBackupText = localize('objectManagement.lastDatabaseLogBackup', "Last Database Log Backup");
|
export const LastDatabaseLogBackupText = localize('objectManagement.lastDatabaseLogBackup', "Last Database Log Backup");
|
||||||
export const BackupSectionHeader = localize('objectManagement.databaseProperties.backupSectionHeader', "Backup");
|
export const BackupSectionHeader = localize('objectManagement.databaseProperties.backupSectionHeader', "Backup");
|
||||||
|
export const AutomaticSectionHeader = localize('objectManagement.databaseProperties.automaticSectionHeader', "Automatic");
|
||||||
|
export const LedgerSectionHeader = localize('objectManagement.databaseProperties.ledgerSectionHeader', "Ledger");
|
||||||
|
export const RecoverySectionHeader = localize('objectManagement.databaseProperties.recoverySectionHeader', "Recovery");
|
||||||
|
export const StateSectionHeader = localize('objectManagement.databaseProperties.stateSectionHeader', "State");
|
||||||
export const DatabaseSectionHeader = localize('objectManagement.databaseProperties.databaseSectionHeader', "Database");
|
export const DatabaseSectionHeader = localize('objectManagement.databaseProperties.databaseSectionHeader', "Database");
|
||||||
export const NamePropertyText = localize('objectManagement.databaseProperties.name', "Name");
|
export const NamePropertyText = localize('objectManagement.databaseProperties.name', "Name");
|
||||||
export const StatusText = localize('objectManagement.databaseProperties.status', "Status");
|
export const StatusText = localize('objectManagement.databaseProperties.status', "Status");
|
||||||
@@ -277,6 +280,19 @@ export const NumberOfUsersText = localize('objectManagement.databaseProperties.n
|
|||||||
export const MemoryAllocatedText = localize('objectManagement.databaseProperties.memoryAllocated', "Memory Allocated To Memory Optimized Objects");
|
export const MemoryAllocatedText = localize('objectManagement.databaseProperties.memoryAllocated', "Memory Allocated To Memory Optimized Objects");
|
||||||
export const MemoryUsedText = localize('objectManagement.databaseProperties.memoryUsed', "Memory Used By Memory Optimized Objects");
|
export const MemoryUsedText = localize('objectManagement.databaseProperties.memoryUsed', "Memory Used By Memory Optimized Objects");
|
||||||
export const StringValueInMB = (value: string) => localize('objectManagement.databaseProperties.mbUnitText', "{0} MB", value);
|
export const StringValueInMB = (value: string) => localize('objectManagement.databaseProperties.mbUnitText', "{0} MB", value);
|
||||||
|
export const AutoCreateIncrementalStatisticsText = localize('objectManagement.databaseProperties.autoCreateIncrementalStatisticsText', "Auto Create Incremental Statistics");
|
||||||
|
export const AutoCreateStatisticsText = localize('objectManagement.databaseProperties.AutoCreateStatisticsText', "Auto Create Statistics");
|
||||||
|
export const AutoShrinkText = localize('objectManagement.databaseProperties.autoShrinkText', "Auto Shrink");
|
||||||
|
export const AutoUpdateStatisticsText = localize('objectManagement.databaseProperties.autoUpdateStatisticsText', "Auto Update Statistics");
|
||||||
|
export const AutoUpdateStatisticsAsynchronouslyText = localize('objectManagement.databaseProperties.autoUpdateStatisticsAsynchronouslyText', "Auto Update Statistics Asynchronously");
|
||||||
|
export const IsLedgerDatabaseText = localize('objectManagement.databaseProperties.isLedgerDatabaseText', "Is Ledger Database");
|
||||||
|
export const PageVerifyText = localize('objectManagement.databaseProperties.pageVerifyText', "Page Verify");
|
||||||
|
export const TargetRecoveryTimeInSecondsText = localize('objectManagement.databaseProperties.targetRecoveryTimeInSecondsText', "Target Recovery Time (Seconds)");
|
||||||
|
export const DatabaseReadOnlyText = localize('objectManagement.databaseProperties.databaseReadOnlyText', "Database Read-Only");
|
||||||
|
export const DatabaseStateText = localize('objectManagement.databaseProperties.databaseStateText', "Database State");
|
||||||
|
export const EncryptionEnabledText = localize('objectManagement.databaseProperties.encryptionEnabledText', "Encryption Enabled");
|
||||||
|
export const RestrictAccessText = localize('objectManagement.databaseProperties.restrictAccessText', "Restrict Access");
|
||||||
|
|
||||||
|
|
||||||
// Util functions
|
// Util functions
|
||||||
export function getNodeTypeDisplayName(type: string, inTitle: boolean = false): string {
|
export function getNodeTypeDisplayName(type: string, inTitle: boolean = false): string {
|
||||||
|
|||||||
@@ -470,7 +470,18 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
owner: 'databaseProperties 1',
|
owner: 'databaseProperties 1',
|
||||||
sizeInMb: 16.00,
|
sizeInMb: 16.00,
|
||||||
spaceAvailableInMb: 1.15,
|
spaceAvailableInMb: 1.15,
|
||||||
status: 'Normal'
|
status: 'Normal',
|
||||||
|
autoCreateIncrementalStatistics: false,
|
||||||
|
autoCreateStatistics: true,
|
||||||
|
autoShrink: false,
|
||||||
|
autoUpdateStatistics: true,
|
||||||
|
autoUpdateStatisticsAsynchronously: false,
|
||||||
|
isLedgerDatabase: false,
|
||||||
|
pageVerify: 'CHECKSUM',
|
||||||
|
targetRecoveryTimeInSec: 60,
|
||||||
|
databaseReadOnly: true,
|
||||||
|
encryptionEnabled: false,
|
||||||
|
restrictAccess: 'SINGLE_USER',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,17 @@ import { IObjectManagementService } from 'mssql';
|
|||||||
import * as localizedConstants from '../localizedConstants';
|
import * as localizedConstants from '../localizedConstants';
|
||||||
import { CreateDatabaseDocUrl, DatabasePropertiesDocUrl } from '../constants';
|
import { CreateDatabaseDocUrl, DatabasePropertiesDocUrl } from '../constants';
|
||||||
import { Database, DatabaseViewInfo } from '../interfaces';
|
import { Database, DatabaseViewInfo } from '../interfaces';
|
||||||
import { convertNumToTwoDecimalStringinMB } from '../utils';
|
import { convertNumToTwoDecimalStringInMB } from '../utils';
|
||||||
|
import { isUndefinedOrNull } from '../../types';
|
||||||
|
|
||||||
export class DatabaseDialog extends ObjectManagementDialogBase<Database, DatabaseViewInfo> {
|
export class DatabaseDialog extends ObjectManagementDialogBase<Database, DatabaseViewInfo> {
|
||||||
// Database Properties tabs
|
// Database Properties tabs
|
||||||
private generalTab: azdata.Tab;
|
private generalTab: azdata.Tab;
|
||||||
|
private optionsTab: azdata.Tab;
|
||||||
|
private optionsTabSectionsContainer: azdata.Component[] = [];
|
||||||
|
|
||||||
// Database properties options
|
// Database properties options
|
||||||
|
// General Tab
|
||||||
private nameInput: azdata.InputBoxComponent;
|
private nameInput: azdata.InputBoxComponent;
|
||||||
private backupSection: azdata.GroupContainer;
|
private backupSection: azdata.GroupContainer;
|
||||||
private lastDatabaseBackupInput: azdata.InputBoxComponent;
|
private lastDatabaseBackupInput: azdata.InputBoxComponent;
|
||||||
@@ -30,6 +34,18 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
|||||||
private memoryAllocatedInput: azdata.InputBoxComponent;
|
private memoryAllocatedInput: azdata.InputBoxComponent;
|
||||||
private memoryUsedInput: azdata.InputBoxComponent;
|
private memoryUsedInput: azdata.InputBoxComponent;
|
||||||
private collationInput: azdata.InputBoxComponent;
|
private collationInput: azdata.InputBoxComponent;
|
||||||
|
// Options Tab
|
||||||
|
private autoCreateIncrementalStatisticsInput: azdata.CheckBoxComponent;
|
||||||
|
private autoCreateStatisticsInput: azdata.CheckBoxComponent;
|
||||||
|
private autoShrinkInput: azdata.CheckBoxComponent;
|
||||||
|
private autoUpdateStatisticsInput: azdata.CheckBoxComponent;
|
||||||
|
private autoUpdateStatisticsAsynchronouslyInput: azdata.CheckBoxComponent;
|
||||||
|
private isLedgerDatabaseInput!: azdata.CheckBoxComponent;
|
||||||
|
private pageVerifyInput!: azdata.DropDownComponent;
|
||||||
|
private targetRecoveryTimeInSecInput!: azdata.InputBoxComponent;
|
||||||
|
private databaseReadOnlyInput!: azdata.CheckBoxComponent;
|
||||||
|
private encryptionEnabledInput: azdata.CheckBoxComponent;
|
||||||
|
private restrictAccessInput!: azdata.DropDownComponent;
|
||||||
|
|
||||||
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
constructor(objectManagementService: IObjectManagementService, options: ObjectManagementDialogOptions) {
|
||||||
super(objectManagementService, options);
|
super(objectManagementService, options);
|
||||||
@@ -53,18 +69,36 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
|||||||
this.initializeBackupSection();
|
this.initializeBackupSection();
|
||||||
this.initializeDatabaseSection();
|
this.initializeDatabaseSection();
|
||||||
|
|
||||||
|
//Initilaize options Tab sections
|
||||||
|
this.initializeOptionsGeneralSection();
|
||||||
|
this.initializeAutomaticSection();
|
||||||
|
if (!isUndefinedOrNull(this.objectInfo.isLedgerDatabase)) {
|
||||||
|
this.initializeLedgerSection();
|
||||||
|
}
|
||||||
|
if (!isUndefinedOrNull(this.objectInfo.pageVerify) && !isUndefinedOrNull(this.objectInfo.targetRecoveryTimeInSec)) {
|
||||||
|
this.initializeRecoverySection();
|
||||||
|
}
|
||||||
|
this.initializeStateSection();
|
||||||
|
|
||||||
// Initilaize general Tab
|
// Initilaize general Tab
|
||||||
this.generalTab = {
|
this.generalTab = {
|
||||||
title: localizedConstants.GeneralSectionHeader,
|
title: localizedConstants.GeneralSectionHeader,
|
||||||
id: 'generalId',
|
id: 'general',
|
||||||
content: this.createGroup('', [
|
content: this.createGroup('', [
|
||||||
this.databaseSection,
|
this.databaseSection,
|
||||||
this.backupSection
|
this.backupSection
|
||||||
], false)
|
], false)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Initilaize Options Tab
|
||||||
|
this.optionsTab = {
|
||||||
|
title: localizedConstants.OptionsSectionHeader,
|
||||||
|
id: 'options',
|
||||||
|
content: this.createGroup('', this.optionsTabSectionsContainer, false)
|
||||||
|
};
|
||||||
|
|
||||||
// Initilaize tab group with tabbed panel
|
// Initilaize tab group with tabbed panel
|
||||||
const propertiesTabGroup = { title: '', tabs: [this.generalTab] };
|
const propertiesTabGroup = { title: '', tabs: [this.generalTab, this.optionsTab] };
|
||||||
const propertiesTabbedPannel = this.modelView.modelBuilder.tabbedPanel()
|
const propertiesTabbedPannel = this.modelView.modelBuilder.tabbedPanel()
|
||||||
.withTabs([propertiesTabGroup])
|
.withTabs([propertiesTabGroup])
|
||||||
.withProps({
|
.withProps({
|
||||||
@@ -137,9 +171,11 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
|||||||
|
|
||||||
//#region Database Properties - General Tab
|
//#region Database Properties - General Tab
|
||||||
private initializeBackupSection(): void {
|
private initializeBackupSection(): void {
|
||||||
|
// Last Database Backup
|
||||||
this.lastDatabaseBackupInput = this.createInputBox(localizedConstants.LastDatabaseBackupText, async () => { }, this.objectInfo.lastDatabaseBackup, this.options.isNewObject);
|
this.lastDatabaseBackupInput = this.createInputBox(localizedConstants.LastDatabaseBackupText, async () => { }, this.objectInfo.lastDatabaseBackup, this.options.isNewObject);
|
||||||
const lastDatabaseBackupContainer = this.createLabelInputContainer(localizedConstants.LastDatabaseBackupText, this.lastDatabaseBackupInput);
|
const lastDatabaseBackupContainer = this.createLabelInputContainer(localizedConstants.LastDatabaseBackupText, this.lastDatabaseBackupInput);
|
||||||
|
|
||||||
|
// Last Database Log Backup
|
||||||
this.lastDatabaseLogBackupInput = this.createInputBox(localizedConstants.LastDatabaseLogBackupText, async () => { }, this.objectInfo.lastDatabaseLogBackup, this.options.isNewObject);
|
this.lastDatabaseLogBackupInput = this.createInputBox(localizedConstants.LastDatabaseLogBackupText, async () => { }, this.objectInfo.lastDatabaseLogBackup, this.options.isNewObject);
|
||||||
const lastDatabaseLogBackupContainer = this.createLabelInputContainer(localizedConstants.LastDatabaseLogBackupText, this.lastDatabaseLogBackupInput);
|
const lastDatabaseLogBackupContainer = this.createLabelInputContainer(localizedConstants.LastDatabaseLogBackupText, this.lastDatabaseLogBackupInput);
|
||||||
|
|
||||||
@@ -150,33 +186,43 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
|||||||
}
|
}
|
||||||
|
|
||||||
private initializeDatabaseSection(): void {
|
private initializeDatabaseSection(): void {
|
||||||
|
// Database Name
|
||||||
this.nameInput = this.createInputBox(localizedConstants.NamePropertyText, async () => { }, this.objectInfo.name, this.options.isNewObject);
|
this.nameInput = this.createInputBox(localizedConstants.NamePropertyText, async () => { }, this.objectInfo.name, this.options.isNewObject);
|
||||||
const nameContainer = this.createLabelInputContainer(localizedConstants.NamePropertyText, this.nameInput);
|
const nameContainer = this.createLabelInputContainer(localizedConstants.NamePropertyText, this.nameInput);
|
||||||
|
|
||||||
|
// Database Status
|
||||||
this.statusInput = this.createInputBox(localizedConstants.StatusText, async () => { }, this.objectInfo.status, this.options.isNewObject);
|
this.statusInput = this.createInputBox(localizedConstants.StatusText, async () => { }, this.objectInfo.status, this.options.isNewObject);
|
||||||
const statusContainer = this.createLabelInputContainer(localizedConstants.StatusText, this.statusInput);
|
const statusContainer = this.createLabelInputContainer(localizedConstants.StatusText, this.statusInput);
|
||||||
|
|
||||||
|
// Database Owner
|
||||||
this.ownerInput = this.createInputBox(localizedConstants.OwnerPropertyText, async () => { }, this.objectInfo.owner, this.options.isNewObject);
|
this.ownerInput = this.createInputBox(localizedConstants.OwnerPropertyText, async () => { }, this.objectInfo.owner, this.options.isNewObject);
|
||||||
const ownerContainer = this.createLabelInputContainer(localizedConstants.OwnerPropertyText, this.ownerInput);
|
const ownerContainer = this.createLabelInputContainer(localizedConstants.OwnerPropertyText, this.ownerInput);
|
||||||
|
|
||||||
|
// Created Date
|
||||||
this.dateCreatedInput = this.createInputBox(localizedConstants.DateCreatedText, async () => { }, this.objectInfo.dateCreated, this.options.isNewObject);
|
this.dateCreatedInput = this.createInputBox(localizedConstants.DateCreatedText, async () => { }, this.objectInfo.dateCreated, this.options.isNewObject);
|
||||||
const dateCreatedContainer = this.createLabelInputContainer(localizedConstants.DateCreatedText, this.dateCreatedInput);
|
const dateCreatedContainer = this.createLabelInputContainer(localizedConstants.DateCreatedText, this.dateCreatedInput);
|
||||||
|
|
||||||
this.sizeInput = this.createInputBox(localizedConstants.SizeText, async () => { }, convertNumToTwoDecimalStringinMB(this.objectInfo.sizeInMb), this.options.isNewObject);
|
// Size
|
||||||
|
this.sizeInput = this.createInputBox(localizedConstants.SizeText, async () => { }, convertNumToTwoDecimalStringInMB(this.objectInfo.sizeInMb), this.options.isNewObject);
|
||||||
const sizeContainer = this.createLabelInputContainer(localizedConstants.SizeText, this.sizeInput);
|
const sizeContainer = this.createLabelInputContainer(localizedConstants.SizeText, this.sizeInput);
|
||||||
|
|
||||||
this.spaceAvailabeInput = this.createInputBox(localizedConstants.SpaceAvailableText, async () => { }, convertNumToTwoDecimalStringinMB(this.objectInfo.spaceAvailableInMb), this.options.isNewObject);
|
// Space Available
|
||||||
|
this.spaceAvailabeInput = this.createInputBox(localizedConstants.SpaceAvailableText, async () => { }, convertNumToTwoDecimalStringInMB(this.objectInfo.spaceAvailableInMb), this.options.isNewObject);
|
||||||
const spaceAvailabeContainer = this.createLabelInputContainer(localizedConstants.SpaceAvailableText, this.spaceAvailabeInput);
|
const spaceAvailabeContainer = this.createLabelInputContainer(localizedConstants.SpaceAvailableText, this.spaceAvailabeInput);
|
||||||
|
|
||||||
|
// Number of Users
|
||||||
this.numberOfUsersInput = this.createInputBox(localizedConstants.NumberOfUsersText, async () => { }, this.objectInfo.numberOfUsers.toString(), this.options.isNewObject);
|
this.numberOfUsersInput = this.createInputBox(localizedConstants.NumberOfUsersText, async () => { }, this.objectInfo.numberOfUsers.toString(), this.options.isNewObject);
|
||||||
const numberOfUsersContainer = this.createLabelInputContainer(localizedConstants.NumberOfUsersText, this.numberOfUsersInput);
|
const numberOfUsersContainer = this.createLabelInputContainer(localizedConstants.NumberOfUsersText, this.numberOfUsersInput);
|
||||||
|
|
||||||
this.memoryAllocatedInput = this.createInputBox(localizedConstants.MemoryAllocatedText, async () => { }, convertNumToTwoDecimalStringinMB(this.objectInfo.memoryAllocatedToMemoryOptimizedObjectsInMb), this.options.isNewObject);
|
// Memory Allocated To Memory Optimized Objects
|
||||||
|
this.memoryAllocatedInput = this.createInputBox(localizedConstants.MemoryAllocatedText, async () => { }, convertNumToTwoDecimalStringInMB(this.objectInfo.memoryAllocatedToMemoryOptimizedObjectsInMb), this.options.isNewObject);
|
||||||
const memoryAllocatedContainer = this.createLabelInputContainer(localizedConstants.MemoryAllocatedText, this.memoryAllocatedInput);
|
const memoryAllocatedContainer = this.createLabelInputContainer(localizedConstants.MemoryAllocatedText, this.memoryAllocatedInput);
|
||||||
|
|
||||||
this.memoryUsedInput = this.createInputBox(localizedConstants.MemoryUsedText, async () => { }, convertNumToTwoDecimalStringinMB(this.objectInfo.memoryUsedByMemoryOptimizedObjectsInMb), this.options.isNewObject);
|
// Memory Used By Memory Optimized Objects
|
||||||
|
this.memoryUsedInput = this.createInputBox(localizedConstants.MemoryUsedText, async () => { }, convertNumToTwoDecimalStringInMB(this.objectInfo.memoryUsedByMemoryOptimizedObjectsInMb), this.options.isNewObject);
|
||||||
const memoryUsedContainer = this.createLabelInputContainer(localizedConstants.MemoryUsedText, this.memoryUsedInput);
|
const memoryUsedContainer = this.createLabelInputContainer(localizedConstants.MemoryUsedText, this.memoryUsedInput);
|
||||||
|
|
||||||
|
// Collation
|
||||||
this.collationInput = this.createInputBox(localizedConstants.CollationText, async () => { }, this.objectInfo.collationName, this.options.isNewObject);
|
this.collationInput = this.createInputBox(localizedConstants.CollationText, async () => { }, this.objectInfo.collationName, this.options.isNewObject);
|
||||||
const collationContainer = this.createLabelInputContainer(localizedConstants.CollationText, this.collationInput);
|
const collationContainer = this.createLabelInputContainer(localizedConstants.CollationText, this.collationInput);
|
||||||
|
|
||||||
@@ -195,6 +241,144 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region Database Properties - Options Tab
|
||||||
|
private initializeOptionsGeneralSection(): void {
|
||||||
|
let containers: azdata.Component[] = [];
|
||||||
|
// Collation
|
||||||
|
let collationDropbox = this.createDropdown(localizedConstants.CollationText, async (newValue) => {
|
||||||
|
this.objectInfo.collationName = newValue as string;
|
||||||
|
}, this.viewInfo.collationNames, this.objectInfo.collationName);
|
||||||
|
containers.push(this.createLabelInputContainer(localizedConstants.CollationText, collationDropbox));
|
||||||
|
|
||||||
|
// Recovery Model
|
||||||
|
let displayOptionsArray = this.viewInfo.recoveryModels.length === 0 ? [this.objectInfo.recoveryModel] : this.viewInfo.recoveryModels;
|
||||||
|
let isEnabled = this.viewInfo.recoveryModels.length === 0 ? false : true;
|
||||||
|
let recoveryDropbox = this.createDropdown(localizedConstants.RecoveryModelText, async (newValue) => {
|
||||||
|
this.objectInfo.recoveryModel = newValue as string;
|
||||||
|
}, displayOptionsArray, this.objectInfo.recoveryModel, isEnabled);
|
||||||
|
containers.push(this.createLabelInputContainer(localizedConstants.RecoveryModelText, recoveryDropbox));
|
||||||
|
|
||||||
|
// Compatibility Level
|
||||||
|
let compatibilityDropbox = this.createDropdown(localizedConstants.CompatibilityLevelText, async (newValue) => {
|
||||||
|
this.objectInfo.compatibilityLevel = newValue as string;
|
||||||
|
}, this.viewInfo.compatibilityLevels, this.objectInfo.compatibilityLevel);
|
||||||
|
containers.push(this.createLabelInputContainer(localizedConstants.CompatibilityLevelText, compatibilityDropbox));
|
||||||
|
|
||||||
|
// Containment Type
|
||||||
|
displayOptionsArray = this.viewInfo.containmentTypes.length === 0 ? [this.objectInfo.containmentType] : this.viewInfo.containmentTypes;
|
||||||
|
isEnabled = this.viewInfo.containmentTypes.length === 0 ? false : true;
|
||||||
|
let containmentDropbox = this.createDropdown(localizedConstants.ContainmentTypeText, async (newValue) => {
|
||||||
|
this.objectInfo.containmentType = newValue as string;
|
||||||
|
}, displayOptionsArray, this.objectInfo.containmentType, isEnabled);
|
||||||
|
containers.push(this.createLabelInputContainer(localizedConstants.ContainmentTypeText, containmentDropbox));
|
||||||
|
|
||||||
|
const optionsGeneralSection = this.createGroup('', containers, true, true);
|
||||||
|
this.optionsTabSectionsContainer.push(optionsGeneralSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
private initializeAutomaticSection(): void {
|
||||||
|
// Auto Create Incremental Statistics
|
||||||
|
this.autoCreateIncrementalStatisticsInput = this.createCheckbox(localizedConstants.AutoCreateIncrementalStatisticsText, async (checked) => {
|
||||||
|
this.objectInfo.autoCreateIncrementalStatistics = checked;
|
||||||
|
}, this.objectInfo.autoCreateIncrementalStatistics);
|
||||||
|
|
||||||
|
// Auto Create Statistics
|
||||||
|
this.autoCreateStatisticsInput = this.createCheckbox(localizedConstants.AutoCreateStatisticsText, async (checked) => {
|
||||||
|
this.objectInfo.autoCreateStatistics = checked;
|
||||||
|
}, this.objectInfo.autoCreateStatistics);
|
||||||
|
|
||||||
|
// Auto Shrink
|
||||||
|
this.autoShrinkInput = this.createCheckbox(localizedConstants.AutoShrinkText, async (checked) => {
|
||||||
|
this.objectInfo.autoShrink = checked;
|
||||||
|
}, this.objectInfo.autoShrink);
|
||||||
|
|
||||||
|
// Auto Update Statistics
|
||||||
|
this.autoUpdateStatisticsInput = this.createCheckbox(localizedConstants.AutoUpdateStatisticsText, async (checked) => {
|
||||||
|
this.objectInfo.autoUpdateStatistics = checked;
|
||||||
|
}, this.objectInfo.autoUpdateStatistics);
|
||||||
|
|
||||||
|
//Auto Update Statistics Asynchronously
|
||||||
|
this.autoUpdateStatisticsAsynchronouslyInput = this.createCheckbox(localizedConstants.AutoUpdateStatisticsAsynchronouslyText, async (checked) => {
|
||||||
|
this.objectInfo.autoUpdateStatisticsAsynchronously = checked;
|
||||||
|
}, this.objectInfo.autoUpdateStatisticsAsynchronously);
|
||||||
|
const automaticSection = this.createGroup(localizedConstants.AutomaticSectionHeader, [
|
||||||
|
this.autoCreateIncrementalStatisticsInput,
|
||||||
|
this.autoCreateStatisticsInput,
|
||||||
|
this.autoShrinkInput,
|
||||||
|
this.autoUpdateStatisticsInput,
|
||||||
|
this.autoUpdateStatisticsAsynchronouslyInput
|
||||||
|
], true);
|
||||||
|
|
||||||
|
this.optionsTabSectionsContainer.push(automaticSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
private initializeLedgerSection(): void {
|
||||||
|
// Ledger Database
|
||||||
|
this.isLedgerDatabaseInput = this.createCheckbox(localizedConstants.IsLedgerDatabaseText, async (checked) => {
|
||||||
|
this.objectInfo.isLedgerDatabase = checked;
|
||||||
|
}, this.objectInfo.isLedgerDatabase);
|
||||||
|
|
||||||
|
const ledgerSection = this.createGroup(localizedConstants.LedgerSectionHeader, [
|
||||||
|
this.isLedgerDatabaseInput
|
||||||
|
], true);
|
||||||
|
|
||||||
|
this.optionsTabSectionsContainer.push(ledgerSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
private initializeRecoverySection(): void {
|
||||||
|
// Page Verify
|
||||||
|
this.pageVerifyInput = this.createDropdown(localizedConstants.PageVerifyText, async (newValue) => {
|
||||||
|
this.objectInfo.pageVerify = newValue;
|
||||||
|
}, this.viewInfo.pageVerifyOptions, this.objectInfo.pageVerify, true);
|
||||||
|
const pageVerifyContainer = this.createLabelInputContainer(localizedConstants.PageVerifyText, this.pageVerifyInput);
|
||||||
|
|
||||||
|
// Recovery Time In Seconds
|
||||||
|
this.targetRecoveryTimeInSecInput = this.createInputBox(localizedConstants.TargetRecoveryTimeInSecondsText, async (newValue) => {
|
||||||
|
this.objectInfo.targetRecoveryTimeInSec = Number(newValue);
|
||||||
|
}, this.objectInfo.targetRecoveryTimeInSec.toString(), true, 'number');
|
||||||
|
const targetRecoveryTimeContainer = this.createLabelInputContainer(localizedConstants.TargetRecoveryTimeInSecondsText, this.targetRecoveryTimeInSecInput);
|
||||||
|
|
||||||
|
const recoverySection = this.createGroup(localizedConstants.RecoverySectionHeader, [
|
||||||
|
pageVerifyContainer,
|
||||||
|
targetRecoveryTimeContainer
|
||||||
|
], true);
|
||||||
|
|
||||||
|
this.optionsTabSectionsContainer.push(recoverySection);
|
||||||
|
}
|
||||||
|
|
||||||
|
private initializeStateSection(): void {
|
||||||
|
let containers: azdata.Component[] = [];
|
||||||
|
// Database Read-Only
|
||||||
|
if (!isUndefinedOrNull(this.objectInfo.databaseReadOnly)) {
|
||||||
|
this.databaseReadOnlyInput = this.createCheckbox(localizedConstants.DatabaseReadOnlyText, async (checked) => {
|
||||||
|
this.objectInfo.databaseReadOnly = checked;
|
||||||
|
}, this.objectInfo.databaseReadOnly);
|
||||||
|
containers.push(this.databaseReadOnlyInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Database Status
|
||||||
|
this.statusInput = this.createInputBox(localizedConstants.StatusText, async () => { }, this.objectInfo.status, this.options.isNewObject);
|
||||||
|
containers.push(this.createLabelInputContainer(localizedConstants.DatabaseStateText, this.statusInput));
|
||||||
|
|
||||||
|
// Encryption Enabled
|
||||||
|
this.encryptionEnabledInput = this.createCheckbox(localizedConstants.EncryptionEnabledText, async (checked) => {
|
||||||
|
this.objectInfo.encryptionEnabled = checked;
|
||||||
|
}, this.objectInfo.encryptionEnabled);
|
||||||
|
containers.push(this.encryptionEnabledInput);
|
||||||
|
|
||||||
|
// Restrict Access
|
||||||
|
if (!isUndefinedOrNull(this.objectInfo.restrictAccess)) {
|
||||||
|
this.restrictAccessInput = this.createDropdown(localizedConstants.RestrictAccessText, async (newValue) => {
|
||||||
|
this.objectInfo.restrictAccess = newValue;
|
||||||
|
}, this.viewInfo.restrictAccessOptions, this.objectInfo.restrictAccess, true);
|
||||||
|
containers.push(this.createLabelInputContainer(localizedConstants.RestrictAccessText, this.restrictAccessInput));
|
||||||
|
}
|
||||||
|
|
||||||
|
const stateSection = this.createGroup(localizedConstants.StateSectionHeader, containers, true);
|
||||||
|
this.optionsTabSectionsContainer.push(stateSection);
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
private initializeConfigureSLOSection(): azdata.GroupContainer {
|
private initializeConfigureSLOSection(): azdata.GroupContainer {
|
||||||
let containers: azdata.Component[] = [];
|
let containers: azdata.Component[] = [];
|
||||||
if (this.viewInfo.azureEditions?.length > 0) {
|
if (this.viewInfo.azureEditions?.length > 0) {
|
||||||
|
|||||||
@@ -43,8 +43,10 @@ export function isValidSQLPassword(password: string, userName: string = 'sa'): b
|
|||||||
return !containsUserName && password.length >= 8 && password.length <= 128 && (hasUpperCase + hasLowerCase + hasNumbers + hasNonAlphas >= 3);
|
return !containsUserName && password.length >= 8 && password.length <= 128 && (hasUpperCase + hasLowerCase + hasNumbers + hasNonAlphas >= 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts number to two decimal placed string
|
/**
|
||||||
export function convertNumToTwoDecimalStringinMB(value: number): string {
|
* Converts number to two decimal placed string
|
||||||
|
*/
|
||||||
|
export function convertNumToTwoDecimalStringInMB(value: number): string {
|
||||||
return localizedConstants.StringValueInMB(value?.toFixed(2));
|
return localizedConstants.StringValueInMB(value?.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { escapeSingleQuotes } from '../../objectManagement/utils';
|
import { convertNumToTwoDecimalStringInMB, escapeSingleQuotes } from '../../objectManagement/utils';
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import * as should from 'should';
|
import * as should from 'should';
|
||||||
|
|
||||||
@@ -29,4 +29,10 @@ describe('escapeSingleQuotes Method Tests', () => {
|
|||||||
const ret = `Server/Database[@Name='${escapeSingleQuotes(dbName)}']`;
|
const ret = `Server/Database[@Name='${escapeSingleQuotes(dbName)}']`;
|
||||||
should(ret).equal(testString);
|
should(ret).equal(testString);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('convertNumToTwoDecimalStringInMB function should convert and return the passed integer value to string with two decimals and in MB units', () => {
|
||||||
|
should(convertNumToTwoDecimalStringInMB(0)).equals('0.00 MB', 'should return string value In MB with two decimals');
|
||||||
|
should(convertNumToTwoDecimalStringInMB(10)).equals('10.00 MB', 'should return string value In MB with two decimals');
|
||||||
|
should(convertNumToTwoDecimalStringInMB(10.23)).equals('10.23 MB', 'should return string value In MB with two decimals');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user