mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-05 01:25:38 -05:00
Add Configure SLO section to Create Database dialog for Azure servers (#23359)
This commit is contained in:
@@ -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