Bug 1720245

Summary: Validate field in CloudForms Service Dialogs
Product: Red Hat CloudForms Management Engine Reporter: Khushbu Borole <kborole>
Component: UI - OPSAssignee: Martin Hradil <mhradil>
Status: CLOSED CURRENTRELEASE QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.4CC: bmidwood, dmetzger, hkataria, jprause, lavenel, mhradil, mpovolny, mshriver, nansari, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.14 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1727990 (view as bug list) Environment:
Last Closed: 2019-12-13 15:01:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1727990    

Description Khushbu Borole 2019-06-13 13:31:56 UTC
Description of problem:
Validate field in CloudForms Service Dialogs does not validate properly

1. If I order the service, type "1" and clear the field, Submit button stays active -> OK
2. If I order the service, type "1" and clear the field, type "a" and clear the field, Submit button stays active -> OK
3. If I order the service, type "a" and clear the field, Submit button stays inactive -> NOK
Submit button should have become active when the field was cleared.

Version-Release number of selected component (if applicable):
Red Hat CloudForms 4.7.4

How reproducible:
Always

Steps to Reproduce:
1. Regular Expression - "^[0-9]*$"
2. Order the service
3. Type "a" and it will show a message that does not satisfy the regex.
4. Clear the field
5. Submit button stays inactive

Actual results:
Submit button stays inactive once I fill invalid regex value and delete it back.

Expected results:
Submit button should have become active when the validate field [not required field] was cleared.

Additional info:
Reference Bugzilla - https://bugzilla.redhat.com/show_bug.cgi?id=1702063

Comment 10 CFME Bot 2019-07-08 18:13:27 UTC
New commits detected on ManageIQ/ui-components/master:

https://github.com/ManageIQ/ui-components/commit/70541f5e02974cf2707caaacd52f2fe471412626
commit 70541f5e02974cf2707caaacd52f2fe471412626
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Jul  4 09:46:34 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Jul  4 09:46:34 2019 -0400

    DialogField#changesHappened - simplify, do not convert data

    DialogField.changesHappened triggers field validation,
    then it would convert arrays to joined strings, pass the converted value to DialogUser.updateDialogField,
    which runs the validation again, with the changed value.

    We should not do any value transformation before serializing for save.

    https://bugzilla.redhat.com/show_bug.cgi?id=1720245

 src/dialog-user/components/dialog-user/dialogField.ts | 38 +-
 1 file changed, 18 insertions(+), 20 deletions(-)


https://github.com/ManageIQ/ui-components/commit/f0e2cad1afd5e9ea0d269aa4ede3704ee29bc2f8
commit f0e2cad1afd5e9ea0d269aa4ede3704ee29bc2f8
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Jul  4 12:01:32 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Jul  4 12:01:32 2019 -0400

    dialogData.validateField - always expect value to validate, don't assume

    now the function doesn't have to guess,
    so it won't fall back to default_value when being passed a falsy value from validateFields

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1720245

 src/dialog-user/services/dialogData.spec.ts | 26 +-
 src/dialog-user/services/dialogData.ts | 13 +-
 2 files changed, 19 insertions(+), 20 deletions(-)

Comment 12 Niyaz Akhtar Ansari 2019-07-15 12:20:46 UTC
Verified in Version 5.11.0.14.20190710225033_cb17ff0