mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 19:18:32 -05:00
Add Configure SLO section to Create Database dialog for Azure servers (#23359)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||
"version": "4.8.0.20",
|
||||
"version": "4.8.0.22",
|
||||
"downloadFileNames": {
|
||||
"Windows_86": "win-x86-net7.0.zip",
|
||||
"Windows_64": "win-x64-net7.0.zip",
|
||||
|
||||
@@ -430,6 +430,11 @@ export interface Database extends ObjectManagement.SqlObject {
|
||||
recoveryModel?: string;
|
||||
compatibilityLevel?: string;
|
||||
containmentType?: string;
|
||||
|
||||
azureBackupRedundancyLevel?: string;
|
||||
azureServiceLevelObjective?: string;
|
||||
azureEdition?: string;
|
||||
azureMaxSize?: string;
|
||||
}
|
||||
|
||||
export interface DatabaseViewInfo extends ObjectManagement.ObjectViewInfo<Database> {
|
||||
@@ -438,4 +443,15 @@ export interface DatabaseViewInfo extends ObjectManagement.ObjectViewInfo<Databa
|
||||
compatibilityLevels: string[];
|
||||
containmentTypes: string[];
|
||||
recoveryModels: string[];
|
||||
|
||||
isAzureDB: boolean;
|
||||
azureBackupRedundancyLevels: string[];
|
||||
azureServiceLevelObjectives: AzureEditionDetails[];
|
||||
azureEditions: string[];
|
||||
azureMaxSizes: AzureEditionDetails[];
|
||||
}
|
||||
|
||||
export interface AzureEditionDetails {
|
||||
editionDisplayName: string;
|
||||
details: string[];
|
||||
}
|
||||
|
||||
@@ -155,7 +155,11 @@ export const CollationText = localize('objectManagement.collationLabel', "Collat
|
||||
export const RecoveryModelText = localize('objectManagement.recoveryModelLabel', "Recovery Model");
|
||||
export const CompatibilityLevelText = localize('objectManagement.compatibilityLevelLabel', "Compatibility Level");
|
||||
export const ContainmentTypeText = localize('objectManagement.containmentTypeLabel', "Containment Type");
|
||||
|
||||
export const ConfigureSLOSectionHeader = localize('objectManagement.configureSLOSectionHeader', "Configure SLO");
|
||||
export const BackupRedundancyText = localize('objectManagement.backupRedundancyLabel', "Backup Storage Redundancy");
|
||||
export const CurrentSLOText = localize('objectManagement.currentSLOLabel', "Current Service Level Objective");
|
||||
export const EditionText = localize('objectManagement.editionLabel', "Edition");
|
||||
export const MaxSizeText = localize('objectManagement.maxSizeLabel', "Max Size");
|
||||
|
||||
// Login
|
||||
export const BlankPasswordConfirmationText: string = localize('objectManagement.blankPasswordConfirmation', "Creating a login with a blank password is a security risk. Are you sure you want to continue?");
|
||||
|
||||
@@ -22,9 +22,13 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
||||
}
|
||||
|
||||
protected async initializeUI(): Promise<void> {
|
||||
let generalSection = this.initializeGeneralSection();
|
||||
let optionsSection = this.initializeOptionsSection();
|
||||
this.formContainer.addItems([generalSection, optionsSection]);
|
||||
let components = [];
|
||||
components.push(this.initializeGeneralSection());
|
||||
components.push(this.initializeOptionsSection());
|
||||
if (this.viewInfo.isAzureDB) {
|
||||
components.push(this.initializeConfigureSLOSection());
|
||||
}
|
||||
this.formContainer.addItems(components);
|
||||
}
|
||||
|
||||
private initializeGeneralSection(): azdata.GroupContainer {
|
||||
@@ -82,4 +86,60 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
||||
|
||||
return this.createGroup(localizedConstants.OptionsSectionHeader, containers, true, true);
|
||||
}
|
||||
|
||||
private initializeConfigureSLOSection(): azdata.GroupContainer {
|
||||
let containers: azdata.Component[] = [];
|
||||
if (this.viewInfo.azureEditions?.length > 0) {
|
||||
let defaultEdition = this.viewInfo.azureEditions[0];
|
||||
this.objectInfo.azureEdition = defaultEdition;
|
||||
|
||||
// Service Level Objective options
|
||||
let sloDetails = this.viewInfo.azureServiceLevelObjectives?.find(details => details.editionDisplayName === defaultEdition);
|
||||
let serviceLevels = sloDetails?.details ?? [];
|
||||
this.objectInfo.azureServiceLevelObjective = serviceLevels[0];
|
||||
let serviceLevelDropbox = this.createDropdown(localizedConstants.CurrentSLOText, async () => {
|
||||
this.objectInfo.azureServiceLevelObjective = serviceLevelDropbox.value as string;
|
||||
}, serviceLevels, serviceLevels[0]);
|
||||
|
||||
// Maximum Database Size options
|
||||
let sizeDetails = this.viewInfo.azureMaxSizes?.find(details => details.editionDisplayName === defaultEdition);
|
||||
let maxSizes = sizeDetails?.details ?? [];
|
||||
this.objectInfo.azureMaxSize = maxSizes[0];
|
||||
let sizeDropbox = this.createDropdown(localizedConstants.MaxSizeText, async () => {
|
||||
this.objectInfo.azureMaxSize = sizeDropbox.value as string;
|
||||
}, maxSizes, maxSizes[0]);
|
||||
|
||||
// Azure Database Edition options
|
||||
let editionDropbox = this.createDropdown(localizedConstants.EditionText, async () => {
|
||||
let edition = editionDropbox.value as string;
|
||||
this.objectInfo.azureEdition = edition;
|
||||
|
||||
// Update dropboxes for SLO and Size, since they're edition specific
|
||||
sloDetails = this.viewInfo.azureServiceLevelObjectives?.find(details => details.editionDisplayName === edition);
|
||||
serviceLevels = sloDetails?.details ?? [];
|
||||
serviceLevelDropbox.loading = true;
|
||||
await serviceLevelDropbox.updateProperties({ value: serviceLevels[0], values: serviceLevels });
|
||||
serviceLevelDropbox.loading = false;
|
||||
|
||||
sizeDetails = this.viewInfo.azureMaxSizes?.find(details => details.editionDisplayName === edition);
|
||||
maxSizes = sizeDetails?.details ?? [];
|
||||
sizeDropbox.loading = true;
|
||||
await sizeDropbox.updateProperties({ value: maxSizes[0], values: maxSizes });
|
||||
sizeDropbox.loading = false;
|
||||
}, this.viewInfo.azureEditions, defaultEdition);
|
||||
|
||||
containers.push(this.createLabelInputContainer(localizedConstants.EditionText, editionDropbox));
|
||||
containers.push(this.createLabelInputContainer(localizedConstants.CurrentSLOText, serviceLevelDropbox));
|
||||
containers.push(this.createLabelInputContainer(localizedConstants.MaxSizeText, sizeDropbox));
|
||||
}
|
||||
|
||||
if (this.viewInfo.azureBackupRedundancyLevels?.length > 0) {
|
||||
let backupDropbox = this.createDropdown(localizedConstants.BackupRedundancyText, async () => {
|
||||
this.objectInfo.azureBackupRedundancyLevel = backupDropbox.value as string;
|
||||
}, this.viewInfo.azureBackupRedundancyLevels, this.viewInfo.azureBackupRedundancyLevels[0]);
|
||||
containers.push(this.createLabelInputContainer(localizedConstants.BackupRedundancyText, backupDropbox));
|
||||
}
|
||||
|
||||
return this.createGroup(localizedConstants.ConfigureSLOSectionHeader, containers, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user