From 24abd5790d7b0ab41c47139adf7b1250f663dc5b Mon Sep 17 00:00:00 2001 From: vichansson Date: Wed, 19 Jun 2024 16:43:03 +0300 Subject: [PATCH] F OpenNebula/one#6233: Replace select controllers (#3119) Replaces majority of all select controllers with the autocomplete controller instead - Does not replace any select controllers under the oneprovision UI - Works similarly to the select controller, with the added functionality that you can filter all options by typing Signed-off-by: Victor Hansson --- .../FormControl/AutocompleteController.js | 52 +++++++++++++++++-- .../Steps/BasicConfiguration/schema.js | 3 +- .../CreateForm/Steps/General/schema.js | 12 +++-- .../ConfigurationAttributes/Fields/restic.js | 3 +- .../ConfigurationAttributes/Fields/vcenter.js | 6 ++- .../CreateForm/Steps/General/schema.js | 9 ++-- .../File/CreateForm/Steps/General/schema.js | 3 +- .../Group/CreateForm/Steps/Views/schema.js | 3 +- .../Steps/AdvancedOptions/schema.js | 9 ++-- .../Image/CreateForm/Steps/General/schema.js | 6 ++- .../CreateForm/Steps/General/schema.js | 3 +- .../CreateForm/Steps/Rules/schema.js | 18 ++++--- .../Steps/Extra/advancedParams/schema.js | 6 ++- .../Steps/Extra/customAttributes/schema.js | 3 +- .../Steps/Extra/networking/schema.js | 6 ++- .../RoleConfig/AdvancedParameters/schema.js | 3 +- .../RoleConfig/ElasticityPolicies/schema.js | 3 +- .../RoleConfig/ScheduledPolicies/schema.js | 6 ++- .../CreateForm/Steps/General/schema.js | 3 +- .../User/CreateForm/Steps/General/schema.js | 3 +- .../ExtraConfiguration/context/schema.js | 6 ++- .../ExtraConfiguration/context/schema.js | 6 ++- .../ExtraConfiguration/context/schema.js | 6 ++- .../CreateForm/Steps/General/commonFields.js | 6 ++- .../Forms/VNetwork/RecoverForm/schema.js | 3 +- .../Forms/VNetwork/ReserveForm/schema.js | 6 ++- .../Steps/Resources/ZonesSelect/schema.js | 3 +- .../Forms/Vm/AttachDiskForm/CommonFields.js | 21 +++++--- .../BasicConfiguration/schema.js | 12 +++-- .../Steps/AdvancedOptions/schema.js | 15 ++++-- .../Forms/Vm/AttachPciForm/schema.js | 3 +- .../Forms/Vm/CreateSchedActionForm/fields.js | 24 ++++++--- .../components/Forms/Vm/RecoverForm/schema.js | 3 +- .../VmGroup/CreateForm/Steps/Roles/schema.js | 3 +- .../Steps/ExtraConfiguration/backup/schema.js | 9 ++-- .../ExtraConfiguration/booting/bootSchema.js | 37 +++++-------- .../booting/cpuModelSchema.js | 6 ++- .../booting/featuresSchema.js | 24 ++++++--- .../context/userInputsSchema.js | 6 ++- .../inputOutput/inputsSchema.js | 6 ++- .../inputOutput/videoSchema.js | 6 ++- .../Steps/ExtraConfiguration/numa/schema.js | 12 +++-- .../ExtraConfiguration/storage/schema.js | 3 +- .../Steps/General/capacitySchema.js | 6 ++- .../CreateForm/Steps/General/capacityUtils.js | 3 +- .../Steps/General/informationSchema.js | 3 +- .../VmTemplate/CreateForm/Steps/index.js | 7 --- .../Tabs/Host/Numa/UpdatePinPolicy/schema.js | 3 +- .../Create/Steps/BasicConfiguration/schema.js | 6 ++- .../Form/Create/Steps/Networking/schema.js | 3 +- .../Tiers/Steps/BasicConfiguration/schema.js | 3 +- .../Tiers/Steps/Policies/schemas/fields.js | 6 ++- .../Form/Deploy/Steps/Networking/schema.js | 3 +- .../Form/Deploy/Steps/Tiers/schema.js | 6 ++- .../containers/Login/Opennebula/schema.js | 3 +- .../Settings/ConfigurationUI/schema.js | 12 +++-- .../containers/Settings/LoginToken/schema.js | 3 +- src/fireedge/src/client/utils/schema.js | 6 ++- 58 files changed, 303 insertions(+), 156 deletions(-) diff --git a/src/fireedge/src/client/components/FormControl/AutocompleteController.js b/src/fireedge/src/client/components/FormControl/AutocompleteController.js index 75fcb755358..de65674913f 100644 --- a/src/fireedge/src/client/components/FormControl/AutocompleteController.js +++ b/src/fireedge/src/client/components/FormControl/AutocompleteController.js @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ -import { memo, useCallback } from 'react' +import { memo, useCallback, useEffect } from 'react' import PropTypes from 'prop-types' import { TextField, Chip, Autocomplete } from '@mui/material' -import { useController } from 'react-hook-form' +import { useController, useWatch, useFormContext } from 'react-hook-form' import { ErrorHelper } from 'client/components/FormControl' import { Translate } from 'client/components/HOC' @@ -36,6 +36,8 @@ const AutocompleteController = memo( readOnly = false, optionsOnly = false, onConditionChange, + watcher, + dependencies, disableEnter = false, }) => { const { @@ -62,9 +64,42 @@ const AutocompleteController = memo( onConditionChange(newValueToChange ?? '') } }, - [onChange, onConditionChange, multiple] + [onChange, onConditionChange, multiple, renderValue] ) + // Add watcher to know if the dependencies fields have changes + const watch = useWatch({ + name: dependencies, + disabled: dependencies == null, + defaultValue: Array.isArray(dependencies) ? [] : undefined, + }) + + const filterOptions = (options, { inputValue }) => + options?.filter((option) => { + const optionText = typeof option?.text === 'string' ? option.text : '' + const optionValue = + typeof option?.value === 'string' ? option.value : '' + + const textMatch = optionText + .toLowerCase() + .includes(inputValue?.toLowerCase()) + const valueMatch = optionValue + .toLowerCase() + .includes(inputValue?.toLowerCase()) + + return textMatch || valueMatch + }) + + const formContext = useFormContext() + + useEffect(() => { + if (!watcher || !dependencies || !watch) return + + const watcherValue = watcher(watch, { name, formContext }) + + watcherValue !== undefined && onChange(watcherValue) + }, [watch, watcher, dependencies]) + return ( ( +
  • + {option?.text} +
  • + )} renderTags={(tags, getTagProps) => tags.map((tag, index) => { const labelTag = @@ -168,6 +209,11 @@ AutocompleteController.propTypes = { readOnly: PropTypes.bool, optionsOnly: PropTypes.bool, onConditionChange: PropTypes.func, + watcher: PropTypes.func, + dependencies: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.arrayOf(PropTypes.string), + ]), } AutocompleteController.displayName = 'AutocompleteController' diff --git a/src/fireedge/src/client/components/Forms/Backup/RestoreForm/Steps/BasicConfiguration/schema.js b/src/fireedge/src/client/components/Forms/Backup/RestoreForm/Steps/BasicConfiguration/schema.js index 3f8110a8b5f..db95f2d3af8 100644 --- a/src/fireedge/src/client/components/Forms/Backup/RestoreForm/Steps/BasicConfiguration/schema.js +++ b/src/fireedge/src/client/components/Forms/Backup/RestoreForm/Steps/BasicConfiguration/schema.js @@ -71,7 +71,8 @@ const NAME = { const INCREMENT_ID = ({ increments = [] }) => ({ name: 'increment_id', label: T.IncrementId, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: (deps) => { const selectedImage = deps?.[BACKUP_IMG_ID]?.[0] let backupIncrements = [].concat( diff --git a/src/fireedge/src/client/components/Forms/BackupJob/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/BackupJob/CreateForm/Steps/General/schema.js index 1ef39edcf01..5d99c54680c 100644 --- a/src/fireedge/src/client/components/Forms/BackupJob/CreateForm/Steps/General/schema.js +++ b/src/fireedge/src/client/components/Forms/BackupJob/CreateForm/Steps/General/schema.js @@ -56,7 +56,8 @@ const PRIORITY = { const EXECUTION = { name: 'EXECUTION', label: T.Execution, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(EXECUTION_OPTIONS), { getText: (type) => type, getValue: (type) => EXECUTION_OPTIONS[type], @@ -68,7 +69,8 @@ const EXECUTION = { const FS_FREEZE = { name: 'FS_FREEZE', label: T.FSFreeze, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(FS_FREEZE_OPTIONS), { getText: (type) => type, getValue: (type) => FS_FREEZE_OPTIONS[type], @@ -80,7 +82,8 @@ const FS_FREEZE = { const MODE = { name: 'MODE', label: T.Mode, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(BACKUP_MODE_OPTIONS), { addEmpty: true, getText: (type) => type, @@ -93,7 +96,8 @@ const MODE = { const INCREMENT_MODE = { name: 'INCREMENT_MODE', label: T.IncrementMode, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: MODE.name, htmlType: (mode) => mode !== BACKUP_MODE_OPTIONS[T.Increment] && INPUT_TYPES.HIDDEN, diff --git a/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/ConfigurationAttributes/Fields/restic.js b/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/ConfigurationAttributes/Fields/restic.js index 4a1ad756e61..59d98f70769 100644 --- a/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/ConfigurationAttributes/Fields/restic.js +++ b/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/ConfigurationAttributes/Fields/restic.js @@ -90,7 +90,8 @@ const RESTIC_COMPRESSION = { label: T.CompressionLevel, tooltip: T.CompressionLevelConcept, dependOf: '$general.STORAGE_BACKEND', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions(['OFF', 'AUTO', 'MAX'], { addEmpty: true, diff --git a/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/ConfigurationAttributes/Fields/vcenter.js b/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/ConfigurationAttributes/Fields/vcenter.js index e5396a4255b..df1ea0b953d 100644 --- a/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/ConfigurationAttributes/Fields/vcenter.js +++ b/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/ConfigurationAttributes/Fields/vcenter.js @@ -27,7 +27,8 @@ import { isVcenter, typeIsOneOf } from '../../functions' const VCENTER_ADAPTER_TYPE = { name: 'VCENTER_ADAPTER_TYPE', label: T.AdapterTypeUsedByVirtualDisksVMs, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions(Object.values(DS_VCENTER_ADAPTER_TYPE_OPTIONS), { addEmpty: true, @@ -45,7 +46,8 @@ const VCENTER_ADAPTER_TYPE = { const VCENTER_DISK_TYPE = { name: 'VCENTER_DISK_TYPE', label: T.TypeOfDiskToBeCreated, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions(Object.values(DS_VCENTER_DISK_TYPE_OPTIONS), { addEmpty: true, diff --git a/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/General/schema.js index 53ceb7abdf4..092b378dcd3 100644 --- a/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/General/schema.js +++ b/src/fireedge/src/client/components/Forms/Datastore/CreateForm/Steps/General/schema.js @@ -68,7 +68,8 @@ const NAME = { const STORAGE_BACKEND = { name: 'STORAGE_BACKEND', label: T.StorageBackend, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: TYPE.name, values: (type) => arrayToOptions(getStorageBackendsFromDStype(type), { @@ -87,7 +88,8 @@ const STORAGE_BACKEND = { const DS_MAD = { name: 'DS_MAD', label: T.Datastore, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: STORAGE_BACKEND.name, values: arrayToOptions(Object.values(DATASTORE_OPTIONS), { addEmpty: false, @@ -104,7 +106,8 @@ const DS_MAD = { const TM_MAD = { name: 'TM_MAD', label: T.Transfer, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: STORAGE_BACKEND.name, values: arrayToOptions(Object.values(TRANSFER_OPTIONS), { addEmpty: false, diff --git a/src/fireedge/src/client/components/Forms/File/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/File/CreateForm/Steps/General/schema.js index 0c1b02c4a27..f8b511b769f 100644 --- a/src/fireedge/src/client/components/Forms/File/CreateForm/Steps/General/schema.js +++ b/src/fireedge/src/client/components/Forms/File/CreateForm/Steps/General/schema.js @@ -68,7 +68,8 @@ export const DESCRIPTION = { export const TYPE = { name: 'TYPE', label: T.Type, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(IMAGE_TYPES_FOR_FILES), { addEmpty: false, getText: (type) => { diff --git a/src/fireedge/src/client/components/Forms/Group/CreateForm/Steps/Views/schema.js b/src/fireedge/src/client/components/Forms/Group/CreateForm/Steps/Views/schema.js index 589590c1044..8fbcf83d0d6 100644 --- a/src/fireedge/src/client/components/Forms/Group/CreateForm/Steps/Views/schema.js +++ b/src/fireedge/src/client/components/Forms/Group/CreateForm/Steps/Views/schema.js @@ -46,7 +46,8 @@ const VIEW = (view, admin) => ({ const DEFAULT_VIEW = (views, admin) => ({ name: admin ? `GROUP_ADMIN_DEFAULT_VIEW` : `DEFAULT_VIEW`, label: T['groups.views.default'], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(views, { getText: (view) => (T[view.name] ? T[view.name] : view.name), getValue: (view) => view.type, diff --git a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/schema.js b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/schema.js index 5dbd80eda3b..1b4fdddc8b0 100644 --- a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/schema.js +++ b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/AdvancedOptions/schema.js @@ -46,7 +46,8 @@ const htmlType = (opt) => (value) => value !== opt && INPUT_TYPES.HIDDEN export const DEV_PREFIX = { name: 'DEV_PREFIX', label: T.Bus, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.entries(BUS_TYPES), { addEmpty: true, getText: ([_, name]) => name, @@ -100,7 +101,8 @@ export const FORMAT_FIELD = { dependOf: `$general.${IMAGE_LOCATION_FIELD.name}`, htmlType: htmlType(IMAGE_LOCATION_TYPES.EMPTY), label: T.Format, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(FORMAT_TYPES), { addEmpty: true, getText: (type) => type.toUpperCase(), @@ -144,7 +146,8 @@ export const FS = { dependOf: `$general.${IMAGE_LOCATION_FIELD.name}`, htmlType: htmlType(IMAGE_LOCATION_TYPES.EMPTY), label: T.Fs, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { data: sunstoneConfig = {} } = useGetSunstoneConfigQuery() diff --git a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/schema.js index e6c5098bea3..a4f69b20861 100644 --- a/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/schema.js +++ b/src/fireedge/src/client/components/Forms/Image/CreateForm/Steps/General/schema.js @@ -73,7 +73,8 @@ export const DESCRIPTION = { export const TYPE = { name: 'TYPE', label: T.Type, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(IMAGE_TYPES_FOR_IMAGES), { addEmpty: false, getText: (type) => { @@ -181,7 +182,8 @@ export const SIZEUNIT = { dependOf: IMAGE_LOCATION_FIELD.name, htmlType: htmlType(IMAGE_LOCATION_TYPES.EMPTY, true), label: T.SizeUnit, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, tooltip: T.SizeUnitTooltip, values: arrayToOptions([UNITS.MB, UNITS.GB, UNITS.TB], { addEmpty: false, diff --git a/src/fireedge/src/client/components/Forms/Marketplace/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/Marketplace/CreateForm/Steps/General/schema.js index e7a801c06f7..afe0b47515b 100644 --- a/src/fireedge/src/client/components/Forms/Marketplace/CreateForm/Steps/General/schema.js +++ b/src/fireedge/src/client/components/Forms/Marketplace/CreateForm/Steps/General/schema.js @@ -45,7 +45,8 @@ const DESCRIPTION = { const TYPE = { name: 'MARKET_MAD', label: T['marketplace.form.create.general.type'], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(MARKET_TYPES), { addEmpty: true, getText: (key) => T[MARKET_TYPES[key].text], diff --git a/src/fireedge/src/client/components/Forms/SecurityGroups/CreateForm/Steps/Rules/schema.js b/src/fireedge/src/client/components/Forms/SecurityGroups/CreateForm/Steps/Rules/schema.js index 8c7068f21b6..3662fef9ccb 100644 --- a/src/fireedge/src/client/components/Forms/SecurityGroups/CreateForm/Steps/Rules/schema.js +++ b/src/fireedge/src/client/components/Forms/SecurityGroups/CreateForm/Steps/Rules/schema.js @@ -34,7 +34,8 @@ import { export const RULE_TYPE = { name: 'RULE_TYPE', label: T.Traffic, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(RULE_TYPE_STRING), { addEmpty: false, getText: (ruleType) => { @@ -60,7 +61,8 @@ export const RULE_TYPE = { export const PROTOCOL = { name: 'PROTOCOL', label: T.Protocol, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(PROTOCOL_STRING), { addEmpty: false, getText: (protocol) => { @@ -94,7 +96,8 @@ export const ICMP_TYPE = { name: 'ICMP_TYPE', dependOf: PROTOCOL.name, label: T.ICMP, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, htmlType: (protocol) => protocol !== PROTOCOL_STRING.ICMP && INPUT_TYPES.HIDDEN, values: arrayToOptions(Object.entries(ICMP_STRING), { @@ -115,7 +118,8 @@ export const ICMPV6_TYPE = { name: 'ICMPv6_TYPE', dependOf: PROTOCOL.name, label: T.ICMPV6, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, htmlType: (protocol) => protocol !== PROTOCOL_STRING.ICMPV6 && INPUT_TYPES.HIDDEN, values: arrayToOptions(Object.entries(ICMP_V6_STRING), { @@ -135,7 +139,8 @@ export const ICMPV6_TYPE = { export const RANGE_TYPE = { name: 'RANGE_TYPE', label: T.PortRange, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions([T.All, T.PortRange], { addEmpty: false, }), @@ -164,7 +169,8 @@ export const RANGE = { export const TARGET = { name: 'TARGET', label: T.TargetNetwork, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions( [T.AnyNetwork, T.ManualNetwork, T.OpennebulaVirtualNetwork], { diff --git a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/advancedParams/schema.js b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/advancedParams/schema.js index 0cd2e5d5e29..78997b41ce3 100644 --- a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/advancedParams/schema.js +++ b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/advancedParams/schema.js @@ -31,7 +31,8 @@ const VM_SHUTDOWN_TYPES = { const STRATEGY_TYPE = { label: 'Strategy', name: 'ADVANCED.DEPLOYMENT', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(STRATEGY_TYPES), { addEmpty: false, getText: (key) => STRATEGY_TYPES[key], @@ -49,7 +50,8 @@ const STRATEGY_TYPE = { const VM_SHUTDOWN_TYPE = { label: 'VM Shutdown', name: 'ADVANCED.VMSHUTDOWN', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(VM_SHUTDOWN_TYPES), { addEmpty: false }), validation: string() .trim() diff --git a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/customAttributes/schema.js b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/customAttributes/schema.js index be7a5253835..960636b0d4a 100644 --- a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/customAttributes/schema.js +++ b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/customAttributes/schema.js @@ -61,7 +61,8 @@ const CA_TYPES = { const CA_TYPE = { name: 'type', label: 'Type', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(CA_TYPES), { addEmpty: false }), defaultValueProp: CA_TYPES.text, validation: string() diff --git a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/networking/schema.js b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/networking/schema.js index 7edfa805609..0ab736dc04c 100644 --- a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/networking/schema.js +++ b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/networking/schema.js @@ -29,7 +29,8 @@ export const NETWORK_TYPES = { const NETWORK_TYPE = { name: 'type', label: 'Type', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(NETWORK_TYPES), { addEmpty: false }), validation: string() .trim() @@ -63,7 +64,8 @@ const DESCRIPTION = { const NETWORK_SELECTION = { name: 'network', label: 'Network', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { data: vnets = [] } = useGetVNetworksQuery() const networks = vnets diff --git a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/AdvancedParameters/schema.js b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/AdvancedParameters/schema.js index 0678dc8cb44..1aff4c0a626 100644 --- a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/AdvancedParameters/schema.js +++ b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/AdvancedParameters/schema.js @@ -32,7 +32,8 @@ const SHUTDOWN_ENUMS_ONEFLOW = { const SHUTDOWN_TYPE = { name: `${ADVANCED_SECTION_ID}.SHUTDOWNTYPE`, label: 'VM Shutdown action', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(SHUTDOWN_TYPES), { addEmpty: false, getText: (key) => SHUTDOWN_TYPES[key], diff --git a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/ElasticityPolicies/schema.js b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/ElasticityPolicies/schema.js index cef9348a0f7..09876890d0f 100644 --- a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/ElasticityPolicies/schema.js +++ b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/ElasticityPolicies/schema.js @@ -38,7 +38,8 @@ export const createElasticityPolicyFields = (pathPrefix) => { { name: getPath('TYPE'), label: 'Type', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, cy: 'roleconfig-elasticitypolicies', values: arrayToOptions(Object.keys(ELASTICITY_TYPES), { addEmpty: false, diff --git a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/ScheduledPolicies/schema.js b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/ScheduledPolicies/schema.js index a0e8611b9fe..a22f0df0d80 100644 --- a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/ScheduledPolicies/schema.js +++ b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/RoleConfig/ScheduledPolicies/schema.js @@ -50,7 +50,8 @@ export const createScheduledPolicyFields = (pathPrefix) => { { name: getPath('SCHEDTYPE'), label: 'Type', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, cy: 'roleconfig-scheduledpolicies', values: arrayToOptions(Object.keys(SCHED_TYPES), { addEmpty: false, @@ -88,7 +89,8 @@ export const createScheduledPolicyFields = (pathPrefix) => { { name: getPath('TIMEFORMAT'), label: 'Time Format', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, cy: 'roleconfig-scheduledpolicies', values: arrayToOptions(Object.values(TIME_TYPES), { addEmpty: false }), validation: string() diff --git a/src/fireedge/src/client/components/Forms/Support/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/Support/CreateForm/Steps/General/schema.js index ccb465e8cfb..f93b57a2284 100644 --- a/src/fireedge/src/client/components/Forms/Support/CreateForm/Steps/General/schema.js +++ b/src/fireedge/src/client/components/Forms/Support/CreateForm/Steps/General/schema.js @@ -40,7 +40,8 @@ export const BODY = { export const SEVERITY = { name: 'SEVERITY', label: T.Severity, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.entries(SEVERITIES), { addEmpty: false, getText: ([_, value]) => value, diff --git a/src/fireedge/src/client/components/Forms/User/CreateForm/Steps/General/schema.js b/src/fireedge/src/client/components/Forms/User/CreateForm/Steps/General/schema.js index 76762733ac3..1d3efdcd72a 100644 --- a/src/fireedge/src/client/components/Forms/User/CreateForm/Steps/General/schema.js +++ b/src/fireedge/src/client/components/Forms/User/CreateForm/Steps/General/schema.js @@ -33,7 +33,8 @@ const USERNAME_FIELD = { const AUTH_TYPE_FIELD = { name: 'authType', label: T.AuthType, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions(Object.keys(AUTH_DRIVER), { addEmpty: false, diff --git a/src/fireedge/src/client/components/Forms/VNTemplate/CreateForm/Steps/ExtraConfiguration/context/schema.js b/src/fireedge/src/client/components/Forms/VNTemplate/CreateForm/Steps/ExtraConfiguration/context/schema.js index cf8d63dd25b..b6c12bbe6a8 100644 --- a/src/fireedge/src/client/components/Forms/VNTemplate/CreateForm/Steps/ExtraConfiguration/context/schema.js +++ b/src/fireedge/src/client/components/Forms/VNTemplate/CreateForm/Steps/ExtraConfiguration/context/schema.js @@ -85,7 +85,8 @@ const GUEST_MTU_FIELD = { const METHOD_FIELD = { name: 'METHOD', label: T.NetMethod, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.entries(VNET_METHODS), { addEmpty: 'none (Use default)', getText: ([, text]) => text, @@ -98,7 +99,8 @@ const METHOD_FIELD = { const IP6_METHOD_FIELD = { name: 'IP6_METHOD', label: T.NetMethod6, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.entries(VNET_METHODS6), { addEmpty: 'none (Use default)', getText: ([, text]) => text, diff --git a/src/fireedge/src/client/components/Forms/VNTemplate/InstantiateForm/Steps/ExtraConfiguration/context/schema.js b/src/fireedge/src/client/components/Forms/VNTemplate/InstantiateForm/Steps/ExtraConfiguration/context/schema.js index cf8d63dd25b..b6c12bbe6a8 100644 --- a/src/fireedge/src/client/components/Forms/VNTemplate/InstantiateForm/Steps/ExtraConfiguration/context/schema.js +++ b/src/fireedge/src/client/components/Forms/VNTemplate/InstantiateForm/Steps/ExtraConfiguration/context/schema.js @@ -85,7 +85,8 @@ const GUEST_MTU_FIELD = { const METHOD_FIELD = { name: 'METHOD', label: T.NetMethod, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.entries(VNET_METHODS), { addEmpty: 'none (Use default)', getText: ([, text]) => text, @@ -98,7 +99,8 @@ const METHOD_FIELD = { const IP6_METHOD_FIELD = { name: 'IP6_METHOD', label: T.NetMethod6, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.entries(VNET_METHODS6), { addEmpty: 'none (Use default)', getText: ([, text]) => text, diff --git a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/schema.js b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/schema.js index cf8d63dd25b..b6c12bbe6a8 100644 --- a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/schema.js +++ b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/ExtraConfiguration/context/schema.js @@ -85,7 +85,8 @@ const GUEST_MTU_FIELD = { const METHOD_FIELD = { name: 'METHOD', label: T.NetMethod, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.entries(VNET_METHODS), { addEmpty: 'none (Use default)', getText: ([, text]) => text, @@ -98,7 +99,8 @@ const METHOD_FIELD = { const IP6_METHOD_FIELD = { name: 'IP6_METHOD', label: T.NetMethod6, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.entries(VNET_METHODS6), { addEmpty: 'none (Use default)', getText: ([, text]) => text, diff --git a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/General/commonFields.js b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/General/commonFields.js index 95705c1e4dc..5e8feb2d3bd 100644 --- a/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/General/commonFields.js +++ b/src/fireedge/src/client/components/Forms/VNetwork/CreateForm/Steps/General/commonFields.js @@ -195,7 +195,8 @@ const VXLAN_MODE_FIELD = { name: 'VXLAN_MODE', label: T.VxlanMode, tooltip: T.VxlanModeConcept, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, onlyOnHypervisors: [vxlan], values: arrayToOptions(['evpn', 'multicast']), validation: string() @@ -208,7 +209,8 @@ const VXLAN_TEP_FIELD = { name: 'VXLAN_TEP', label: T.VxlanTunnelEndpoint, tooltip: T.VxlanTunnelEndpointConcept, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, onlyOnHypervisors: [vxlan], dependOf: VXLAN_MODE_FIELD.name, htmlType: (mode) => mode !== 'evpn' && INPUT_TYPES.HIDDEN, diff --git a/src/fireedge/src/client/components/Forms/VNetwork/RecoverForm/schema.js b/src/fireedge/src/client/components/Forms/VNetwork/RecoverForm/schema.js index 843a76521a2..4dee391dd2d 100644 --- a/src/fireedge/src/client/components/Forms/VNetwork/RecoverForm/schema.js +++ b/src/fireedge/src/client/components/Forms/VNetwork/RecoverForm/schema.js @@ -20,7 +20,8 @@ import { T, INPUT_TYPES } from 'client/constants' const OPERATION = { name: 'operation', label: T.Operation, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: 'operation', // itself is a dependency tooltip: (operation) => ({ diff --git a/src/fireedge/src/client/components/Forms/VNetwork/ReserveForm/schema.js b/src/fireedge/src/client/components/Forms/VNetwork/ReserveForm/schema.js index 2d2fbd2495b..ca2c846c505 100644 --- a/src/fireedge/src/client/components/Forms/VNetwork/ReserveForm/schema.js +++ b/src/fireedge/src/client/components/Forms/VNetwork/ReserveForm/schema.js @@ -90,7 +90,8 @@ const NAME_FIELD = { const EXISTING_RESERVE_FIELD = ({ vnet = {} }) => ({ name: 'NETWORK_ID', label: T.SelectNetwork, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: SWITCH_FIELD.name, htmlType: (switcher) => switcher === SWITCH_TYPES.newVnet && INPUT_TYPES.HIDDEN, @@ -125,7 +126,8 @@ const EXISTING_RESERVE_FIELD = ({ vnet = {} }) => ({ const AR_FIELD = ({ arPool = {} }) => ({ name: 'AR_ID', label: T.CanSelectAddressFromAR, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: SWITCH_FIELD.name, values: arrayToOptions(arPool, { getText: ({ AR_ID, IP, MAC }) => diff --git a/src/fireedge/src/client/components/Forms/Vdc/CreateForm/Steps/Resources/ZonesSelect/schema.js b/src/fireedge/src/client/components/Forms/Vdc/CreateForm/Steps/Resources/ZonesSelect/schema.js index 343c38f758f..eea4614bc1b 100644 --- a/src/fireedge/src/client/components/Forms/Vdc/CreateForm/Steps/Resources/ZonesSelect/schema.js +++ b/src/fireedge/src/client/components/Forms/Vdc/CreateForm/Steps/Resources/ZonesSelect/schema.js @@ -23,7 +23,8 @@ export const ZONE_FIELD_NAME = 'ZONE_ID' const ZONE = (zones) => ({ name: ZONE_FIELD_NAME, label: T.Zone, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(zones, { addEmpty: false, getText: (zone) => `Zone ${zone.ID} - ${zone.NAME}`, diff --git a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/CommonFields.js b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/CommonFields.js index 14b490f20e8..f949f22df6f 100644 --- a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/CommonFields.js +++ b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/CommonFields.js @@ -34,7 +34,8 @@ export const GENERAL_FIELDS = [ name: 'READONLY', label: T.ReadOnly, notOnHypervisors: [vcenter], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: T.Yes, value: 'YES' }, { text: T.No, value: 'NO' }, @@ -48,7 +49,8 @@ export const GENERAL_FIELDS = [ name: 'DEV_PREFIX', label: T.Bus, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: '', value: '' }, { text: 'Virtio', value: 'vd' }, @@ -62,7 +64,8 @@ export const GENERAL_FIELDS = [ name: 'CACHE', label: T.Cache, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: '', value: '' }, { text: 'Default', value: 'default' }, @@ -77,7 +80,8 @@ export const GENERAL_FIELDS = [ name: 'IO', label: T.IoPolicy, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: '', value: '' }, { text: 'Threads', value: 'threads' }, @@ -90,7 +94,8 @@ export const GENERAL_FIELDS = [ name: 'DISCARD', label: T.Discard, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: '', value: '' }, { text: 'Ignore', value: 'ignore' }, @@ -129,7 +134,8 @@ export const VCENTER_FIELDS = [ name: 'VCENTER_ADAPTER_TYPE', label: T.BusAdapterController, onlyOnHypervisors: [vcenter], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: '', value: '' }, { text: 'lsiLogic', value: 'lsiLogic' }, @@ -143,7 +149,8 @@ export const VCENTER_FIELDS = [ name: 'VCENTER_DISK_TYPE', label: T.DiskProvisioningType, onlyOnHypervisors: [vcenter], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: '', value: '' }, { text: 'Thin', value: 'thin' }, diff --git a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/BasicConfiguration/schema.js b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/BasicConfiguration/schema.js index 4858d671197..0cf93b4a0e5 100644 --- a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/BasicConfiguration/schema.js +++ b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/BasicConfiguration/schema.js @@ -51,7 +51,8 @@ const SIZE = { export const SIZEUNIT = { name: 'SIZEUNIT', label: T.SizeUnit, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, tooltip: T.SizeUnitTooltip, values: arrayToOptions([UNITS.MB, UNITS.GB, UNITS.TB], { addEmpty: false, @@ -71,7 +72,8 @@ export const SIZEUNIT = { const TYPE = (hypervisor) => ({ name: 'TYPE', label: T.DiskType, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: hypervisor === vcenter ? [ @@ -93,7 +95,8 @@ const TYPE = (hypervisor) => ({ const FORMAT = (hypervisor) => ({ name: 'FORMAT', label: T.Format, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: 'TYPE', htmlType: (type) => type === 'swap' && INPUT_TYPES.HIDDEN, values: @@ -121,7 +124,8 @@ const FILESYSTEM = { name: 'FS', label: T.FileSystemType, notOnHypervisors: [vcenter], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: 'TYPE', htmlType: (type) => type === 'swap' && INPUT_TYPES.HIDDEN, values: () => arrayToOptions(SERVER_CONFIG?.supported_fs), diff --git a/src/fireedge/src/client/components/Forms/Vm/AttachNicForm/Steps/AdvancedOptions/schema.js b/src/fireedge/src/client/components/Forms/Vm/AttachNicForm/Steps/AdvancedOptions/schema.js index 50e91eec474..b057f42fccb 100644 --- a/src/fireedge/src/client/components/Forms/Vm/AttachNicForm/Steps/AdvancedOptions/schema.js +++ b/src/fireedge/src/client/components/Forms/Vm/AttachNicForm/Steps/AdvancedOptions/schema.js @@ -138,7 +138,8 @@ const GUACAMOLE_CONNECTIONS = [ { name: 'RDP_RESIZE_METHOD', label: T.RdpRizeMethod, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: 'RDP', values: [ { text: '-', value: undefined }, @@ -322,7 +323,8 @@ const OVERRIDE_IPV4_FIELDS = [ name: 'METHOD', label: T.NetworkMethod, tooltip: T.NetworkMethod4Concept, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(IPV4_METHODS), { getText: (key) => key, getValue: (key) => IPV4_METHODS[key], @@ -358,7 +360,8 @@ const OVERRIDE_IPV6_FIELDS = [ name: 'IP6_METHOD', label: T.NetworkMethod, tooltip: T.NetworkMethod6Concept, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(IPV6_METHODS), { getText: (key) => key, getValue: (key) => IPV6_METHODS[key], @@ -377,7 +380,8 @@ const HARDWARE_FIELDS = ( { name: PCI_TYPE_NAME, label: T.VirtualNicHardwareMode, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(NIC_HARDWARE), { addEmpty: false, getText: (key) => NIC_HARDWARE_STR[key], @@ -436,7 +440,8 @@ const HARDWARE_FIELDS = ( { name: DEVICE_LIST, label: T.DeviceName, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { data: hosts = [] } = useGetHostsAdminQuery() const pciDevices = hosts diff --git a/src/fireedge/src/client/components/Forms/Vm/AttachPciForm/schema.js b/src/fireedge/src/client/components/Forms/Vm/AttachPciForm/schema.js index 586521c923a..3cbec4fd159 100644 --- a/src/fireedge/src/client/components/Forms/Vm/AttachPciForm/schema.js +++ b/src/fireedge/src/client/components/Forms/Vm/AttachPciForm/schema.js @@ -69,7 +69,8 @@ const SPECIFIC_DEVICE = { const NAME_FIELD = { name: 'PCI_DEVICE_NAME', label: T.DeviceName, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: SPECIFIC_DEVICE.name, htmlType: (specificDevice) => specificDevice && INPUT_TYPES.HIDDEN, values: () => { diff --git a/src/fireedge/src/client/components/Forms/Vm/CreateSchedActionForm/fields.js b/src/fireedge/src/client/components/Forms/Vm/CreateSchedActionForm/fields.js index 71534579d0d..f4233fdf6d3 100644 --- a/src/fireedge/src/client/components/Forms/Vm/CreateSchedActionForm/fields.js +++ b/src/fireedge/src/client/components/Forms/Vm/CreateSchedActionForm/fields.js @@ -108,7 +108,8 @@ const createArgField = (argName) => ({ const ACTION_FIELD = (vm) => ({ name: ACTION_FIELD_NAME, label: T.Action, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions( Object.entries({ ...VM_ACTIONS_WITH_SCHEDULE, @@ -139,7 +140,8 @@ const ACTION_FIELD_FOR_CHARTERS = { const ARGS_DS_ID_FIELD = { ...createArgField(ARGS_TYPES.DS_ID), label: T.BackupDatastore, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { data: datastores = [] } = useGetDatastoresQuery() @@ -160,7 +162,8 @@ const ARGS_DS_ID_FIELD = { const ARGS_DISK_ID_FIELD = (vm) => ({ ...createArgField(ARGS_TYPES.DISK_ID), label: T.Disk, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(getDisks(vm), { getText: ({ IMAGE_ID, IMAGE, TARGET, SIZE } = {}) => { const isVolatile = !IMAGE && !IMAGE_ID @@ -188,7 +191,8 @@ const ARGS_NAME_FIELD = { const ARGS_SNAPSHOT_ID_FIELD = (vm) => ({ ...createArgField(ARGS_TYPES.SNAPSHOT_ID), label: T.Snapshot, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(getSnapshotList(vm), { getText: ({ NAME } = {}) => NAME, getValue: ({ SNAPSHOT_ID } = {}) => SNAPSHOT_ID, @@ -253,7 +257,8 @@ const TIME_FIELD = { const REPEAT_FIELD = { name: 'REPEAT', label: T.GranularityOfAction, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(REPEAT_VALUES), { addEmpty: true, getText: (key) => sentenceCase(key), @@ -277,7 +282,8 @@ const REPEAT_FIELD = { const WEEKLY_FIELD = { name: 'WEEKLY', dependOf: [PERIODIC_FIELD_NAME, REPEAT_FIELD.name], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, multiple: true, label: T.DayOfWeek, values: arrayToOptions(DAYS_OF_WEEK, { @@ -436,7 +442,8 @@ const DAYS_FIELD = { const END_TYPE_FIELD = { name: 'END_TYPE', label: T.EndType, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: PERIODIC_FIELD_NAME, htmlType: (typeAction) => typeAction !== SCHEDULE_TYPE.PERIODIC && INPUT_TYPES.HIDDEN, @@ -518,7 +525,8 @@ export const RELATIVE_TIME_FIELD = { export const PERIOD_FIELD = { name: 'PERIOD', label: T.PeriodType, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: PERIODIC_FIELD_NAME, htmlType: (typeAction) => typeAction !== SCHEDULE_TYPE.RELATIVE && INPUT_TYPES.HIDDEN, diff --git a/src/fireedge/src/client/components/Forms/Vm/RecoverForm/schema.js b/src/fireedge/src/client/components/Forms/Vm/RecoverForm/schema.js index 1da68b80bd1..c5784005a45 100644 --- a/src/fireedge/src/client/components/Forms/Vm/RecoverForm/schema.js +++ b/src/fireedge/src/client/components/Forms/Vm/RecoverForm/schema.js @@ -20,7 +20,8 @@ import { T, INPUT_TYPES } from 'client/constants' const OPERATION = { name: 'operation', label: T.Operation, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: 'operation', // itself is a dependency tooltip: (operation) => ({ diff --git a/src/fireedge/src/client/components/Forms/VmGroup/CreateForm/Steps/Roles/schema.js b/src/fireedge/src/client/components/Forms/VmGroup/CreateForm/Steps/Roles/schema.js index dd7dc8960c1..7dc185335a5 100644 --- a/src/fireedge/src/client/components/Forms/VmGroup/CreateForm/Steps/Roles/schema.js +++ b/src/fireedge/src/client/components/Forms/VmGroup/CreateForm/Steps/Roles/schema.js @@ -33,7 +33,8 @@ const ROLE_NAME_FIELD = { const POLICY_FIELD = { name: 'POLICY', label: 'VM-VM Affinity', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, validation: string() .required('No valid policy selected') .default(() => 'None'), diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/backup/schema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/backup/schema.js index c36676caf7a..a66dd59cb13 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/backup/schema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/backup/schema.js @@ -42,7 +42,8 @@ const FS_FREEZE_FIELD = { name: 'BACKUP_CONFIG.FS_FREEZE', label: T.FSFreeze, tooltip: T.FSFreezeConcept, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(FS_FREEZE_OPTIONS), { getText: (type) => type, getValue: (type) => FS_FREEZE_OPTIONS[type], @@ -68,7 +69,8 @@ const KEEP_LAST_FIELD = { const MODE_FIELD = { name: 'BACKUP_CONFIG.MODE', label: T.Mode, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.keys(BACKUP_MODE_OPTIONS), { addEmpty: true, getText: (type) => type, @@ -83,7 +85,8 @@ const MODE_FIELD = { const INCREMENT_MODE = { name: 'BACKUP_CONFIG.INCREMENT_MODE', label: T.IncrementMode, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: MODE_FIELD.name, htmlType: (mode) => mode !== BACKUP_MODE_OPTIONS[T.Increment] && INPUT_TYPES.HIDDEN, diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/bootSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/bootSchema.js index a5732787de0..df1bfe21983 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/bootSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/bootSchema.js @@ -36,7 +36,8 @@ export const ARCH = { name: 'OS.ARCH', label: T.CpuArchitecture, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions(CPU_ARCHITECTURES), validation: string() .trim() @@ -49,7 +50,8 @@ export const SD_DISK_BUS = { name: 'OS.SD_DISK_BUS', label: T.BusForSdDisks, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(SD_DISK_BUSES, { getText: (o) => o.toUpperCase() }), validation: string() .trim() @@ -62,7 +64,8 @@ export const MACHINE_TYPES = { name: 'OS.MACHINE', label: T.MachineType, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { data: hosts = [] } = useGetHostsQuery() const kvmMachines = getKvmMachines(hosts) @@ -145,35 +148,19 @@ export const UUID = { grid: { md: 12 }, } -/** @type {Field} Feature custom field */ -export const FEATURE_CUSTOM_ENABLED = { - name: 'OS.FEATURE_CUSTOM_ENABLED', - label: T.CustomPath, - notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SWITCH, - validation: boolean() - .yesOrNo() - .default(() => false) - .afterSubmit((value) => undefined), - grid: { md: 12 }, -} - /** @type {Field} Firmware field */ export const FIRMWARE = { name: 'OS.FIRMWARE', label: T.Firmware, tooltip: T.FirmwareConcept, notOnHypervisors: [firecracker, lxc], - type: ([, , custom] = [], formContext) => { - const enabled = formContext?.getValues('extra.OS.FEATURE_CUSTOM_ENABLED') - - return custom || enabled ? INPUT_TYPES.TEXT : INPUT_TYPES.SELECT - }, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: false, validation: string() .trim() .notRequired() .default(() => undefined), - dependOf: ['HYPERVISOR', '$general.HYPERVISOR', FEATURE_CUSTOM_ENABLED.name], + dependOf: ['HYPERVISOR', '$general.HYPERVISOR'], values: ([templateHyperv, hypervisor = templateHyperv] = []) => { const types = { @@ -183,6 +170,9 @@ export const FIRMWARE = { return arrayToOptions(types) }, + fieldProps: { + freeSolo: true, + }, grid: { md: 12 }, } @@ -192,8 +182,6 @@ export const FIRMWARE_SECURE = { label: T.FirmwareSecure, notOnHypervisors: [vcenter, firecracker, lxc], type: INPUT_TYPES.CHECKBOX, - dependOf: FEATURE_CUSTOM_ENABLED.name, - htmlType: (custom) => !custom && INPUT_TYPES.HIDDEN, validation: boolean().yesOrNo(), grid: { md: 12 }, } @@ -207,7 +195,6 @@ export const BOOT_FIELDS = [ KERNEL_CMD, BOOTLOADER, UUID, - FEATURE_CUSTOM_ENABLED, FIRMWARE, FIRMWARE_SECURE, ] diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/cpuModelSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/cpuModelSchema.js index 4132b832dad..5f684fda08a 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/cpuModelSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/cpuModelSchema.js @@ -47,7 +47,8 @@ export const MODEL = { name: 'CPU_MODEL.MODEL', label: T.CpuModel, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { data: hosts = [] } = useGetHostsQuery() const kvmCpuModels = getKvmCpuModels(hosts) @@ -66,7 +67,8 @@ export const FEATURES = { name: 'CPU_MODEL.FEATURES', label: T.CpuFeature, notOnHypervisors: [vcenter, firecracker, lxc], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, multiple: true, values: () => { const { data: hosts = [] } = useGetHostsQuery() diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/featuresSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/featuresSchema.js index 67b5c30cda3..3d8d91033c3 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/featuresSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/booting/featuresSchema.js @@ -43,7 +43,8 @@ export const ACPI = { label: T.Acpi, tooltip: T.AcpiConcept, notOnHypervisors: [vcenter, lxc, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: commonOptions, validation: commonValidation, } @@ -54,7 +55,8 @@ export const PAE = { label: T.Pae, tooltip: T.PaeConcept, notOnHypervisors: [vcenter, lxc, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: commonOptions, validation: commonValidation, } @@ -65,7 +67,8 @@ export const APIC = { label: T.Apic, tooltip: T.ApicConcept, notOnHypervisors: [vcenter, lxc, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: commonOptions, validation: commonValidation, } @@ -76,7 +79,8 @@ export const HYPERV = { label: T.Hyperv, tooltip: T.HypervConcept, notOnHypervisors: [vcenter, lxc, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: commonOptions, validation: commonValidation, } @@ -87,7 +91,8 @@ export const LOCALTIME = { label: T.Localtime, tooltip: T.LocaltimeConcept, notOnHypervisors: [vcenter, lxc, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: commonOptions, validation: commonValidation, } @@ -98,7 +103,8 @@ export const GUEST_AGENT = { label: T.GuestAgent, tooltip: T.GuestAgentConcept, notOnHypervisors: [vcenter, lxc, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: commonOptions, validation: commonValidation, } @@ -110,7 +116,8 @@ export const VIRTIO_SCSI_QUEUES = { label: T.VirtioQueues, tooltip: T.VirtioQueuesConcept, notOnHypervisors: [vcenter, lxc, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: optionsInputsVirtio, validation: commonValidation, } @@ -122,7 +129,8 @@ export const VIRTIO_BLK_QUEUES = { label: T.VirtioBlkQueues, tooltip: T.VirtioBlkQueuesConcept, notOnHypervisors: [vcenter, lxc, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: optionsInputsVirtio, validation: commonValidation, } diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/context/userInputsSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/context/userInputsSchema.js index 8fdcc39a992..6f6566be851 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/context/userInputsSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/context/userInputsSchema.js @@ -77,7 +77,8 @@ const NAME = { const TYPE = { name: 'type', label: T.Type, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: NAME.name, values: (name) => { let defaultValues = valuesOfUITypes @@ -198,9 +199,10 @@ const DEFAULT_VALUE = { name: 'default', label: T.DefaultValue, dependOf: [TYPE.name, OPTIONS.name], + optionsOnly: true, type: ([type] = []) => [uiBoolean, uiList, uiListMultiple].includes(type) - ? INPUT_TYPES.SELECT + ? INPUT_TYPES.AUTOCOMPLETE : INPUT_TYPES.TEXT, htmlType: ([type] = []) => ({ diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/inputsSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/inputsSchema.js index 10eaffc446e..b1cfd797b52 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/inputsSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/inputsSchema.js @@ -48,7 +48,8 @@ const TYPE = { name: 'TYPE', label: T.Type, notOnHypervisors: [lxc, vcenter], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(DEVICE_TYPES)), validation: string() .trim() @@ -62,7 +63,8 @@ const BUS = { name: 'BUS', label: T.Bus, notOnHypervisors: [lxc, vcenter], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(Object.values(DEVICE_BUS_TYPES)), validation: string() .trim() diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/videoSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/videoSchema.js index 69e198b0455..c809d2af3c2 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/videoSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/inputOutput/videoSchema.js @@ -46,7 +46,8 @@ const { kvm, dummy } = HYPERVISORS /** @type {Field} Type field */ export const VIDEO_TYPE = { name: 'VIDEO.TYPE', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, label: T.VideoType, tooltip: T.VideoTypeConcept, onlyOnHypervisors: [kvm, dummy], @@ -167,7 +168,8 @@ export const VRAM = { /** @type {Field} Resolution field */ export const RESOLUTION = { name: 'VIDEO.RESOLUTION', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, label: T.Resolution, tooltip: T.ResolutionConcept, onlyOnHypervisors: [kvm, dummy], diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/numa/schema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/numa/schema.js index 9c1bc07e98e..0239283c7f5 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/numa/schema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/numa/schema.js @@ -63,7 +63,8 @@ const PIN_POLICY = { name: 'TOPOLOGY.PIN_POLICY', label: T.PinPolicy, tooltip: [T.PinPolicyConcept, numaPinPolicies.join(', ')], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions(numaPinPolicies, { addEmpty: false, getText: sentenceCase, @@ -173,9 +174,10 @@ const THREADS = { htmlType: ([, enableNuma] = []) => !enableNuma ? INPUT_TYPES.HIDDEN : 'number', dependOf: ['$general.HYPERVISOR', ENABLE_NUMA.name], + optionsOnly: true, type: ([hypervisor] = []) => [firecracker, vcenter].includes(hypervisor) - ? INPUT_TYPES.SELECT + ? INPUT_TYPES.AUTOCOMPLETE : INPUT_TYPES.TEXT, values: (hypervisor) => ({ @@ -199,7 +201,8 @@ const HUGEPAGES = { notOnHypervisors: [vcenter, firecracker], dependOf: ENABLE_NUMA.name, htmlType: (enableNuma) => !enableNuma && INPUT_TYPES.HIDDEN, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { data: hosts = [] } = useGetHostsQuery() const sizes = hosts @@ -223,7 +226,8 @@ const MEMORY_ACCESS = { label: T.MemoryAccess, tooltip: [T.MemoryAccessConcept, NUMA_MEMORY_ACCESS.join(', ')], notOnHypervisors: [vcenter, firecracker], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, dependOf: ENABLE_NUMA.name, htmlType: (enableNuma) => !enableNuma && INPUT_TYPES.HIDDEN, values: arrayToOptions(NUMA_MEMORY_ACCESS, { getText: sentenceCase }), diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/storage/schema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/storage/schema.js index 3bbc41e4982..8af95d369f5 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/storage/schema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/ExtraConfiguration/storage/schema.js @@ -26,7 +26,8 @@ const TM_MAD_SYSTEM = { name: 'TM_MAD_SYSTEM', label: T.DeployMode, tooltip: T.DeployModeConcept, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { data: datastores = [] } = useGetDatastoresQuery() const modes = datastores.map(getDeployMode)?.flat() diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/capacitySchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/capacitySchema.js index 7523e9e7d86..4498161610b 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/capacitySchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/capacitySchema.js @@ -64,7 +64,8 @@ export const MEMORYUNIT = () => ({ name: 'MEMORYUNIT', label: T.MemoryUnit, tooltip: T.MemoryConceptUnit, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, grid: { md: 3 }, values: arrayToOptions([UNITS.MB, UNITS.GB, UNITS.TB], { addEmpty: false, @@ -232,7 +233,8 @@ export const SHOWBACK_FIELDS = (features) => export const MEMORY_RESIZE_MODE_FIELD = { name: 'MEMORY_RESIZE_MODE', label: T.MemoryResizeMode, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, notOnHypervisors: [lxc, firecracker, vcenter], dependOf: ['HYPERVISOR', '$general.HYPERVISOR'], values: arrayToOptions(Object.keys(MEMORY_RESIZE_OPTIONS), { diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/capacityUtils.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/capacityUtils.js index bfd8961e6da..c92741fee7a 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/capacityUtils.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/capacityUtils.js @@ -69,7 +69,8 @@ const getModificationIdsByFieldName = (fieldName) => ({ const modificationTypeInput = (fieldName, { type: typeId }) => ({ name: typeId, ...MODIFICATION_TRANSLATES[fieldName], - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions([fixed, range, list], { addEmpty: 'Any value', getValue: (type) => diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/informationSchema.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/informationSchema.js index 1cc17ecbccb..d9cf161e72c 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/informationSchema.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/General/informationSchema.js @@ -75,7 +75,8 @@ export const HYPERVISOR_FIELD = (isUpdate) => ({ export const LOGO = { name: 'LOGO', label: T.Logo, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: arrayToOptions( [['-', DEFAULT_TEMPLATE_LOGO], ...Object.entries(TEMPLATE_LOGOS)], { diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/index.js b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/index.js index a4c1d1e0265..ff59177baf6 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/index.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/CreateForm/Steps/index.js @@ -28,8 +28,6 @@ import General, { import { userInputsToArray } from 'client/models/Helper' import { createSteps, getUnknownAttributes, decodeBase64 } from 'client/utils' -import { KVM_FIRMWARE_TYPES, VCENTER_FIRMWARE_TYPES } from 'client/constants' - const Steps = createSteps([General, ExtraConfiguration, CustomVariables], { saveState: true, transformInitialValue: (vmTemplate, schema) => { @@ -56,13 +54,8 @@ const Steps = createSteps([General, ExtraConfiguration, CustomVariables], { // cast FIRMWARE const firmware = vmTemplate?.TEMPLATE?.OS?.FIRMWARE if (firmware) { - const firmwareOption = - KVM_FIRMWARE_TYPES.includes(firmware) || - VCENTER_FIRMWARE_TYPES.includes(firmware) - objectSchema[EXTRA_ID].OS = { ...vmTemplate?.TEMPLATE?.OS, - FEATURE_CUSTOM_ENABLED: !firmwareOption ? 'YES' : 'NO', } } diff --git a/src/fireedge/src/client/components/Tabs/Host/Numa/UpdatePinPolicy/schema.js b/src/fireedge/src/client/components/Tabs/Host/Numa/UpdatePinPolicy/schema.js index c75c57070f2..ee59cd1d716 100644 --- a/src/fireedge/src/client/components/Tabs/Host/Numa/UpdatePinPolicy/schema.js +++ b/src/fireedge/src/client/components/Tabs/Host/Numa/UpdatePinPolicy/schema.js @@ -22,7 +22,8 @@ import { PIN_POLICY, INPUT_TYPES } from 'client/constants' /** @type {Field} Pin Policy field */ const PIN_POLICY_FIELD = { name: 'PIN_POLICY', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: 'None', value: PIN_POLICY.NONE }, { text: 'Pinned', value: PIN_POLICY.PINNED }, diff --git a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/BasicConfiguration/schema.js b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/BasicConfiguration/schema.js index fde6a27ff09..6c6d20973f2 100644 --- a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/BasicConfiguration/schema.js +++ b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/BasicConfiguration/schema.js @@ -56,7 +56,8 @@ export const FORM_FIELDS = [ { name: 'deployment', label: 'Select a strategy', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: STRATEGIES_DEPLOY, validation: yup .string() @@ -68,7 +69,8 @@ export const FORM_FIELDS = [ { name: 'shutdown_action', label: 'Select a VM shutdown action', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: SHUTDOWN_ACTIONS, validation: yup .string() diff --git a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Networking/schema.js b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Networking/schema.js index d389537b8d2..cb958f41e8a 100644 --- a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Networking/schema.js +++ b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Networking/schema.js @@ -82,7 +82,8 @@ const DESCRIPTION = { const TYPE = { name: 'type', label: 'Select a type', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: TYPES_NETWORKS, validation: yup .string() diff --git a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Tiers/Steps/BasicConfiguration/schema.js b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Tiers/Steps/BasicConfiguration/schema.js index 8595ec5758d..4541219c949 100644 --- a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Tiers/Steps/BasicConfiguration/schema.js +++ b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Tiers/Steps/BasicConfiguration/schema.js @@ -50,7 +50,8 @@ const CARDINALITY = { const SHUTDOWN_ACTION = { name: 'shutdown_action', label: 'Select a VM shutdown action', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: SHUTDOWN_ACTIONS, validation: yup .string() diff --git a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Tiers/Steps/Policies/schemas/fields.js b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Tiers/Steps/Policies/schemas/fields.js index a699c92a1ae..279e673434c 100644 --- a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Tiers/Steps/Policies/schemas/fields.js +++ b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Create/Steps/Tiers/Steps/Policies/schemas/fields.js @@ -38,7 +38,8 @@ export const ID = { export const TYPE = { name: 'type', label: 'Type of adjustment', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: TYPES_POLICY, tooltip: ` CHANGE: Add/subtract the given number of VMs @@ -159,7 +160,8 @@ export const COOLDOWN = { export const TIME_FORMAT = { name: 'time_format', label: 'Time format', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: TIME_FORMATS, tooltip: ` START TIME: Exact time for the adjustment diff --git a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Networking/schema.js b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Networking/schema.js index 030c9deb158..2affe1751dd 100644 --- a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Networking/schema.js +++ b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Networking/schema.js @@ -36,7 +36,8 @@ const hasExtraValue = (type) => const TYPE = { name: 'type', label: 'Select a type', - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: TYPES_NETWORKS, validation: yup .string() diff --git a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Tiers/schema.js b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Tiers/schema.js index 644b739b9a6..4a24432ca01 100644 --- a/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Tiers/schema.js +++ b/src/fireedge/src/client/containers/ApplicationsTemplates/Form/Deploy/Steps/Tiers/schema.js @@ -95,7 +95,8 @@ const getUserInput = ({ mandatory, name, type, options, defaultValue }) => { return { values, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, validation: yup .string() .trim() @@ -110,7 +111,8 @@ const getUserInput = ({ mandatory, name, type, options, defaultValue }) => { return { values, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, multiple: true, validation: yup .array(yup.string().trim()) diff --git a/src/fireedge/src/client/containers/Login/Opennebula/schema.js b/src/fireedge/src/client/containers/Login/Opennebula/schema.js index 62bac8f2652..c59c7f384c2 100644 --- a/src/fireedge/src/client/containers/Login/Opennebula/schema.js +++ b/src/fireedge/src/client/containers/Login/Opennebula/schema.js @@ -80,7 +80,8 @@ const TOKEN = { const GROUP = { name: 'group', label: T.SelectYourActiveGroup, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => { const { user, groups } = useAuth() const primaryText = Tr(T.Primary) diff --git a/src/fireedge/src/client/containers/Settings/ConfigurationUI/schema.js b/src/fireedge/src/client/containers/Settings/ConfigurationUI/schema.js index 579d140f35c..5e9d1a64221 100644 --- a/src/fireedge/src/client/containers/Settings/ConfigurationUI/schema.js +++ b/src/fireedge/src/client/containers/Settings/ConfigurationUI/schema.js @@ -27,7 +27,8 @@ import { boolean, string } from 'yup' const SCHEME_FIELD = { name: 'SCHEME', label: T.Schema, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: [ { text: T.System, value: SCHEMES.SYSTEM }, { text: T.Dark, value: SCHEMES.DARK }, @@ -43,7 +44,8 @@ const SCHEME_FIELD = { const LANG_FIELD = { name: 'LANG', label: T.Language, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions(Object.entries(LANGUAGES), { addEmpty: false, @@ -68,7 +70,8 @@ const DISABLE_ANIMATIONS_FIELD = { const VIEW_FIELD = ({ views }) => ({ name: 'DEFAULT_VIEW', label: T.View, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions(Object.entries(views), { addEmpty: true, @@ -85,7 +88,8 @@ const VIEW_FIELD = ({ views }) => ({ const ZONE_ENDPOINT_FIELD = ({ zones = [] }) => ({ name: 'DEFAULT_ZONE_ENDPOINT', label: T.DefaultZoneEndpoint, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions( zones diff --git a/src/fireedge/src/client/containers/Settings/LoginToken/schema.js b/src/fireedge/src/client/containers/Settings/LoginToken/schema.js index b476a266389..bce9abab5b7 100644 --- a/src/fireedge/src/client/containers/Settings/LoginToken/schema.js +++ b/src/fireedge/src/client/containers/Settings/LoginToken/schema.js @@ -39,7 +39,8 @@ const EXPIRE_FIELD = { const GROUP_FIELD = (userGroups) => ({ name: constants.groupFieldName, label: T.Group, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, values: () => arrayToOptions(userGroups, { addEmpty: '-', diff --git a/src/fireedge/src/client/utils/schema.js b/src/fireedge/src/client/utils/schema.js index e8372accd49..f51fe0ffaca 100644 --- a/src/fireedge/src/client/utils/schema.js +++ b/src/fireedge/src/client/utils/schema.js @@ -339,7 +339,8 @@ export const schemaUserInput = ({ return { values, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, validation: string() .trim() .concat(requiredSchema(mandatory, string())) @@ -367,7 +368,8 @@ export const schemaUserInput = ({ return { values, - type: INPUT_TYPES.SELECT, + type: INPUT_TYPES.AUTOCOMPLETE, + optionsOnly: true, multiple: true, validation: array(string().trim()) .concat(requiredSchema(mandatory, array()))