Wizard: Refactor hostname and blueprint name inputs

This commit Implement refactor of HookValidatedInput for hostname and blueprint name
fields, addressing the following bugs:

1) Fixes a bug where the validation symbol persisted after a user deleted the value in the hostname field.
2) Fixes a bug where the validation symbol persisted after a user deleted the value in the blueprint name field.

These changes improve code maintainability and provide a more consistent user experience.
This commit is contained in:
Michal Gold 2025-02-10 16:03:27 +02:00 committed by Lucas Garfield
parent 1d39a57391
commit 12aa5cdf52
4 changed files with 29 additions and 17 deletions

View file

@ -19,7 +19,10 @@ import {
} from '../../../../store/wizardSlice';
import { useGenerateDefaultName } from '../../utilities/useGenerateDefaultName';
import { useDetailsValidation } from '../../utilities/useValidation';
import { HookValidatedInput } from '../../ValidatedInput';
import {
HookValidatedInput,
ValidatedInputAndTextArea,
} from '../../ValidatedInput';
const DetailsStep = () => {
const dispatch = useAppDispatch();
@ -55,15 +58,15 @@ const DetailsStep = () => {
blueprint.
</Text>
<FormGroup isRequired label="Blueprint name" fieldId="blueprint-name">
<HookValidatedInput
<ValidatedInputAndTextArea
ariaLabel="blueprint name"
dataTestId="blueprint"
value={blueprintName}
isDisabled={false}
onChange={handleNameChange}
placeholder="Add blueprint name"
stepValidation={stepValidation}
fieldName="name"
isRequired={true}
/>
<FormHelperText>
<HelperText>

View file

@ -8,7 +8,7 @@ import {
selectHostname,
} from '../../../../../store/wizardSlice';
import { useHostnameValidation } from '../../../utilities/useValidation';
import { HookValidatedInput } from '../../../ValidatedInput';
import { ValidatedInputAndTextArea } from '../../../ValidatedInput';
const HostnameInput = () => {
const dispatch = useAppDispatch();
@ -22,7 +22,7 @@ const HostnameInput = () => {
return (
<FormGroup label="Hostname">
<HookValidatedInput
<ValidatedInputAndTextArea
ariaLabel="hostname input"
value={hostname}
onChange={handleChange}