diff --git a/libs/i18n/locales/en/translation.json b/libs/i18n/locales/en/translation.json index cefab47f..e88a2c4a 100644 --- a/libs/i18n/locales/en/translation.json +++ b/libs/i18n/locales/en/translation.json @@ -25,6 +25,7 @@ "Bare metal instances": "Bare metal instances", "Bare Metal Machines": "Bare Metal Machines", "Bare metal provisioning wizard": "Bare metal provisioning wizard", + "Boot disk": "Boot disk", "Break-glass credentials": "Break-glass credentials", "Browse catalog items and launch virtual machines, clusters, or bare metal machines from published offerings.": "Browse catalog items and launch virtual machines, clusters, or bare metal machines from published offerings.", "Cancel": "Cancel", @@ -54,11 +55,7 @@ "catalogProvision.instanceTypes.deprecatedSuffix": " (deprecated)", "catalogProvision.instanceTypes.loadError": "Could not load instance types", "catalogProvision.networking.loadError": "Could not load networking options", - "catalogProvision.review.catalogItem": "Catalog item", "catalogProvision.steps.catalog.title": "Catalog item", - "catalogProvision.steps.configuration.title": "Configuration", - "catalogProvision.steps.general.title": "General", - "catalogProvision.steps.networking.title": "Networking", "catalogProvision.steps.review.title": "Review", "catalogProvision.validation.bootDiskNumber": "Boot disk size must be a number", "catalogProvision.validation.catalogItemRequired": "Select a catalog item", @@ -194,7 +191,12 @@ "Failed to download kubeconfig": "Failed to download kubeconfig", "Failed to edit resource": "Failed to edit resource", "Failed to enable Identity provider": "Failed to enable Identity provider", + "Failed to fetch host types": "Failed to fetch host types", "Failed to fetch Identity provider": "Failed to fetch Identity provider", + "Failed to fetch instance type": "Failed to fetch instance type", + "Failed to fetch security groups": "Failed to fetch security groups", + "Failed to fetch subnet": "Failed to fetch subnet", + "Failed to fetch virtual network": "Failed to fetch virtual network", "Failed to load cluster password": "Failed to load cluster password", "Failed to load graphical console viewer": "Failed to load graphical console viewer", "Failed to load security groups": "Failed to load security groups", @@ -388,6 +390,7 @@ "Use IPv4 CIDR notation (for example 10.128.0.0/14).": "Use IPv4 CIDR notation (for example 10.128.0.0/14).", "Use IPv4 CIDR notation (for example 172.30.0.0/16).": "Use IPv4 CIDR notation (for example 172.30.0.0/16).", "User data": "User data", + "User Data": "User Data", "User Data is required": "User Data is required", "User data must not exceed 64 KB.": "User data must not exceed 64 KB.", "User info URL": "User info URL", @@ -402,6 +405,7 @@ "Virtual Network": "Virtual Network", "Virtual network is required": "Virtual network is required", "Virtual networks": "Virtual networks", + "VM image": "VM image", "Worker nodes": "Worker nodes", "You are not authorized to access this resource.": "You are not authorized to access this resource." } diff --git a/libs/ui-components/src/components/Form/MultiSelectField.tsx b/libs/ui-components/src/components/Form/MultiSelectField.tsx index 43c2e706..d61909c4 100644 --- a/libs/ui-components/src/components/Form/MultiSelectField.tsx +++ b/libs/ui-components/src/components/Form/MultiSelectField.tsx @@ -6,7 +6,6 @@ import { useField } from 'formik'; import { getVisibleFieldError } from './fieldError'; import { useShowFieldValidationErrors } from './FieldValidationContext'; import { FormFieldHelper } from './FormFieldHelper'; -import { type LabeledResourceRef } from './labeledResourceRef'; import type { SelectFieldOption } from './SelectField'; interface MultiSelectFieldProps { @@ -37,7 +36,7 @@ export const MultiSelectField = ({ noOptionsFoundMessage = (filter) => `No options found for "${filter}"`, autoSelectSingleOption = false, }: MultiSelectFieldProps) => { - const [field, meta, helpers] = useField(name); + const [field, meta, helpers] = useField<(string | number)[]>(name); const showValidationErrors = useShowFieldValidationErrors(); const error = getVisibleFieldError(meta, showValidationErrors); const validated = error ? 'error' : 'default'; @@ -59,25 +58,18 @@ export const MultiSelectField = ({ ) { return; } - void helpers.setValue([{ value: options[0].value, label: options[0].label }], false); + void helpers.setValue([options[0].value], false); }, [autoSelectSingleOption, helpers, isDisabled, isLoading, options, selectedValues.length]); const initialOptions = useMemo(() => { return options.map((option) => ({ content: option.label, value: option.value, - selected: selectedValues.some((value) => value.value === option.value), + selected: selectedValues.some((value) => value === option.value), isDisabled: option.isDisabled, })); }, [options, selectedValues]); - const toLabeledResourceRefs = (selections: (string | number)[]) => - selections.map((selection) => { - const value = String(selection); - const option = options.find((entry) => entry.value === value); - return option ? { value: option.value, label: option.label } : { value, label: value }; - }); - return ( { - void helpers.setValue(toLabeledResourceRefs(selections), true); + void helpers.setValue(selections, true); void helpers.setTouched(true); }} onToggle={(open) => { diff --git a/libs/ui-components/src/components/Form/SelectField.test.tsx b/libs/ui-components/src/components/Form/SelectField.test.tsx index 72472499..3645e762 100644 --- a/libs/ui-components/src/components/Form/SelectField.test.tsx +++ b/libs/ui-components/src/components/Form/SelectField.test.tsx @@ -4,26 +4,24 @@ import { Formik, type FormikErrors } from 'formik'; import { describe, expect, it } from 'vitest'; import * as yup from 'yup'; -import { EMPTY_LABELED_RESOURCE_REF, type LabeledResourceRef } from './labeledResourceRef'; -import { labeledResourceRefSchema } from './labeledResourceRefSchema'; import { SelectField } from './SelectField'; const renderSelect = ({ autoSelectSingleOption = false, - initialValue = EMPTY_LABELED_RESOURCE_REF, + initialValue = '', isLoading = false, }: { autoSelectSingleOption?: boolean; - initialValue?: LabeledResourceRef; + initialValue?: string; isLoading?: boolean; } = {}) => { - let latestErrors: FormikErrors<{ kind: LabeledResourceRef }> = {}; + let latestErrors: FormikErrors<{ kind: string }> = {}; render( undefined} > @@ -39,7 +37,7 @@ const renderSelect = ({ placeholder="Select a kind" options={[{ value: 'only-option', label: 'Only option label' }]} /> - {values.kind.value || '(empty)'} + {values.kind || '(empty)'}