mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 17:23:10 -05:00
Refactor create inputbox method (#24113)
Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as azdata from 'azdata';
|
||||
import { ObjectManagementDialogBase, ObjectManagementDialogOptions } from './objectManagementDialogBase';
|
||||
import { DefaultInputWidth } from '../../ui/dialogBase';
|
||||
import { IObjectManagementService } from 'mssql';
|
||||
import * as localizedConstants from '../localizedConstants';
|
||||
import { ViewGeneralServerPropertiesDocUrl, ViewMemoryServerPropertiesDocUrl } from '../constants';
|
||||
@@ -88,60 +87,143 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
|
||||
}
|
||||
|
||||
private initializeGeneralSection(): void {
|
||||
this.nameInput = this.createInputBox(localizedConstants.NameText, async (newValue) => {
|
||||
this.objectInfo.name = newValue;
|
||||
}, this.objectInfo.name, this.options.isNewObject);
|
||||
this.nameInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.NameText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.name
|
||||
});
|
||||
const nameContainer = this.createLabelInputContainer(localizedConstants.NameText, this.nameInput);
|
||||
|
||||
this.hardwareGenerationInput = this.createInputBox(localizedConstants.HardwareGenerationText, async () => { }, this.objectInfo.hardwareGeneration.toString(), this.options.isNewObject);
|
||||
this.hardwareGenerationInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.HardwareGenerationText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.hardwareGeneration.toString()
|
||||
});
|
||||
const hardwareGenerationContainer = this.createLabelInputContainer(localizedConstants.HardwareGenerationText, this.hardwareGenerationInput);
|
||||
|
||||
this.languageDropdown = this.createDropdown(localizedConstants.LanguageText, async () => { }, [this.objectInfo.language], this.objectInfo.language, this.options.isNewObject);
|
||||
const languageContainer = this.createLabelInputContainer(localizedConstants.LanguageText, this.languageDropdown);
|
||||
|
||||
this.memoryInput = this.createInputBox(localizedConstants.MemoryText, async () => { }, this.objectInfo.memoryInMB.toString().concat(' MB'), this.options.isNewObject);
|
||||
this.memoryInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.MemoryText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: localizedConstants.StringValueInMB(this.objectInfo.memoryInMB.toString())
|
||||
});
|
||||
const memoryContainer = this.createLabelInputContainer(localizedConstants.MemoryText, this.memoryInput);
|
||||
|
||||
this.operatingSystemInput = this.createInputBox(localizedConstants.OperatingSystemText, async () => { }, this.objectInfo.operatingSystem, this.options.isNewObject);
|
||||
this.operatingSystemInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.OperatingSystemText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.operatingSystem
|
||||
});
|
||||
const operatingSystemContainer = this.createLabelInputContainer(localizedConstants.OperatingSystemText, this.operatingSystemInput);
|
||||
|
||||
this.platformInput = this.createInputBox(localizedConstants.PlatformText, async () => { }, this.objectInfo.platform, this.options.isNewObject);
|
||||
this.platformInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.PlatformText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.platform
|
||||
});
|
||||
const platformContainer = this.createLabelInputContainer(localizedConstants.PlatformText, this.platformInput);
|
||||
|
||||
this.processorsInput = this.createInputBox(localizedConstants.ProcessorsText, async () => { }, this.objectInfo.processors, this.options.isNewObject);
|
||||
this.processorsInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.ProcessorsText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.processors
|
||||
});
|
||||
const processorsContainer = this.createLabelInputContainer(localizedConstants.ProcessorsText, this.processorsInput);
|
||||
|
||||
this.isClusteredInput = this.createInputBox(localizedConstants.IsClusteredText, async () => { }, this.objectInfo.isClustered.toString(), this.options.isNewObject);
|
||||
this.isClusteredInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.IsClusteredText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.isClustered.toString()
|
||||
});
|
||||
const isClusteredContainer = this.createLabelInputContainer(localizedConstants.IsClusteredText, this.isClusteredInput);
|
||||
|
||||
this.isHadrEnabledInput = this.createInputBox(localizedConstants.IsHadrEnabledText, async () => { }, this.objectInfo.isHadrEnabled.toString(), this.options.isNewObject);
|
||||
this.isHadrEnabledInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.IsHadrEnabledText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.isHadrEnabled.toString()
|
||||
});
|
||||
const isHadrEnabledContainer = this.createLabelInputContainer(localizedConstants.IsHadrEnabledText, this.isHadrEnabledInput);
|
||||
|
||||
this.isPolyBaseInstalledInput = this.createInputBox(localizedConstants.IsPolyBaseInstalledText, async () => { }, this.objectInfo.isPolyBaseInstalled.toString(), this.options.isNewObject);
|
||||
this.isPolyBaseInstalledInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.IsPolyBaseInstalledText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.isPolyBaseInstalled.toString()
|
||||
});
|
||||
const isPolyBaseInstalledContainer = this.createLabelInputContainer(localizedConstants.IsPolyBaseInstalledText, this.isPolyBaseInstalledInput);
|
||||
|
||||
this.isXTPSupportedInput = this.createInputBox(localizedConstants.IsXTPSupportedText, async () => { }, this.objectInfo.isXTPSupported.toString(), this.options.isNewObject);
|
||||
this.isXTPSupportedInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.IsXTPSupportedText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.isXTPSupported.toString()
|
||||
});
|
||||
const isXTPSupportedContainer = this.createLabelInputContainer(localizedConstants.IsXTPSupportedText, this.isXTPSupportedInput);
|
||||
|
||||
this.productInput = this.createInputBox(localizedConstants.ProductText, async () => { }, this.objectInfo.product, this.options.isNewObject);
|
||||
this.productInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.ProductText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.product
|
||||
});
|
||||
const productContainer = this.createLabelInputContainer(localizedConstants.ProductText, this.productInput);
|
||||
|
||||
this.reservedStorageSizeInMBInput = this.createInputBox(localizedConstants.ReservedStorageSizeInMBText, async () => { }, localizedConstants.StringValueInMB(this.objectInfo.reservedStorageSizeMB.toString()), this.options.isNewObject);
|
||||
this.reservedStorageSizeInMBInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.ReservedStorageSizeInMBText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: localizedConstants.StringValueInMB(this.objectInfo.reservedStorageSizeMB.toString())
|
||||
});
|
||||
const reservedStorageSizeInMBContainer = this.createLabelInputContainer(localizedConstants.ReservedStorageSizeInMBText, this.reservedStorageSizeInMBInput);
|
||||
|
||||
this.rootDirectoryInput = this.createInputBox(localizedConstants.RootDirectoryText, async () => { }, this.objectInfo.rootDirectory, this.options.isNewObject);
|
||||
this.rootDirectoryInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.RootDirectoryText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.rootDirectory
|
||||
});
|
||||
const rootDirectoryContainer = this.createLabelInputContainer(localizedConstants.RootDirectoryText, this.rootDirectoryInput);
|
||||
|
||||
this.serverCollationInput = this.createInputBox(localizedConstants.ServerCollationText, async () => { }, this.objectInfo.serverCollation, this.options.isNewObject);
|
||||
this.serverCollationInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.ServerCollationText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.serverCollation
|
||||
});
|
||||
const serverCollationContainer = this.createLabelInputContainer(localizedConstants.ServerCollationText, this.serverCollationInput);
|
||||
|
||||
this.serviceTierInput = this.createInputBox(localizedConstants.ServiceTierText, async () => { }, this.objectInfo.serviceTier, this.options.isNewObject);
|
||||
this.serviceTierInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.ServiceTierText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.serviceTier
|
||||
});
|
||||
const serviceTierContainer = this.createLabelInputContainer(localizedConstants.ServiceTierText, this.serviceTierInput);
|
||||
|
||||
this.storageSpaceUsageInMBInput = this.createInputBox(localizedConstants.StorageSpaceUsageInMBText, async () => { }, localizedConstants.StringValueInMB(this.objectInfo.storageSpaceUsageInMB.toString()), this.options.isNewObject);
|
||||
this.storageSpaceUsageInMBInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.StorageSpaceUsageInMBText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: localizedConstants.StringValueInMB(this.objectInfo.storageSpaceUsageInMB.toString())
|
||||
});
|
||||
const storageSpaceUsageInMbContainer = this.createLabelInputContainer(localizedConstants.StorageSpaceUsageInMBText, this.storageSpaceUsageInMBInput);
|
||||
|
||||
this.versionInput = this.createInputBox(localizedConstants.VersionText, async () => { }, this.objectInfo.version, this.options.isNewObject);
|
||||
this.versionInput = this.createInputBox(async () => { }, {
|
||||
ariaLabel: localizedConstants.VersionText,
|
||||
inputType: 'text',
|
||||
enabled: this.options.isNewObject,
|
||||
value: this.objectInfo.version
|
||||
});
|
||||
const versionContainer = this.createLabelInputContainer(localizedConstants.VersionText, this.versionInput);
|
||||
|
||||
let platformItems = [
|
||||
@@ -181,14 +263,30 @@ export class ServerPropertiesDialog extends ObjectManagementDialogBase<Server, S
|
||||
|
||||
private initializeMemorySection(): void {
|
||||
const isEnabled = this.engineEdition !== azdata.DatabaseEngineEdition.SqlManagedInstance;
|
||||
this.minServerMemoryInput = this.createInputBox(localizedConstants.minServerMemoryText, async (newValue) => {
|
||||
const minServerProps: azdata.InputBoxProperties = {
|
||||
ariaLabel: localizedConstants.minServerMemoryText,
|
||||
inputType: 'number',
|
||||
enabled: isEnabled,
|
||||
max: this.objectInfo.minServerMemory.maximumValue,
|
||||
min: this.objectInfo.minServerMemory.minimumValue,
|
||||
required: true
|
||||
};
|
||||
this.minServerMemoryInput = this.createInputBox(async (newValue) => {
|
||||
this.objectInfo.minServerMemory.value = +newValue;
|
||||
}, this.objectInfo.minServerMemory.value.toString(), isEnabled, 'number', DefaultInputWidth, true, this.objectInfo.minServerMemory.minimumValue, this.objectInfo.minServerMemory.maximumValue);
|
||||
}, minServerProps);
|
||||
const minMemoryContainer = this.createLabelInputContainer(localizedConstants.minServerMemoryText, this.minServerMemoryInput);
|
||||
|
||||
this.maxServerMemoryInput = this.createInputBox(localizedConstants.maxServerMemoryText, async (newValue) => {
|
||||
const maxServerProps: azdata.InputBoxProperties = {
|
||||
ariaLabel: localizedConstants.maxServerMemoryText,
|
||||
inputType: 'number',
|
||||
enabled: isEnabled,
|
||||
max: this.objectInfo.maxServerMemory.maximumValue,
|
||||
min: this.objectInfo.maxServerMemory.minimumValue,
|
||||
required: true
|
||||
};
|
||||
this.maxServerMemoryInput = this.createInputBox(async (newValue) => {
|
||||
this.objectInfo.maxServerMemory.value = +newValue;
|
||||
}, this.objectInfo.maxServerMemory.value.toString(), isEnabled, 'number', DefaultInputWidth, true, this.objectInfo.maxServerMemory.minimumValue, this.objectInfo.maxServerMemory.maximumValue);
|
||||
}, maxServerProps);
|
||||
const maxMemoryContainer = this.createLabelInputContainer(localizedConstants.maxServerMemoryText, this.maxServerMemoryInput);
|
||||
|
||||
this.memorySection = this.createGroup('', [
|
||||
|
||||
Reference in New Issue
Block a user