one icon indicating copy to clipboard operation
one copied to clipboard

Behavior of non required text fields when update

Open dcarracedo opened this issue 2 years ago • 0 comments

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

  1. Create a template with a volatile disk that has the field Total values of Throttling (Bytes/s) with any value (e.g. 1)
  2. 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.
  3. 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)

dcarracedo avatar Jan 30 '24 10:01 dcarracedo