Behavior of non required text fields when update
Description In the form text fields, when you're trying to delete a value after having a template that has a value in this field, an error is showed if the field is empty, you need to add a value even the field is not required. For example, if you create a template with a volatile disk that has the field Total values of Throttling (Bytes/s) section and you try to update this template, the form shows an error when the field is empty.
To Reproduce
- Create a template with a volatile disk that has the field Total values of Throttling (Bytes/s) with any value (e.g. 1)
- After created it, update the template and edit the disk. Delete the value fo the field Total values of Throttling (Bytes/s) and click Finish.
- An error appears saying that this field has to have a number.
Expected behavior That is a field is non required, the user could click on the Finish button and finish the form without errors when the field is empty.
Details
- Affected Component: FireEdge Sunstone
- Hypervisor: N/A
- Version: 6.8
Additional context Video recording the case: Screencast from 30-01-24 11:28:34.webm
Also, this problem is in all the text fields that are not required, not only in the volatile form disk.
A possible solution it's transform the value:
{ name: 'TOTAL_BYTES_SEC', label: T.TotalValue, type: INPUT_TYPES.TEXT, htmlType: 'number', notOnHypervisors: [lxc, firecracker, vcenter], validation: number() .min(0) .transform((value, originalValue) => originalValue && originalValue?.trim() === '' ? undefined : value ) .notRequired() .default(() => undefined), },
This could be added in a generic way in the TextController but checking that the required fields still working. If not, we need to check the schemas to add this transform function.
Progress Status
- [ ] Code committed
- [ ] Testing - QA
- [ ] Documentation (Release notes - resolved issues, compatibility, known issues)