Bug 1757888

Summary: Service catalog default set to "none" if set to non required with a default value
Product: Red Hat CloudForms Management Engine Reporter: Tuan <tuado>
Component: ProvisioningAssignee: Martin Hradil <mhradil>
Status: CLOSED NOTABUG QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.8CC: dmetzger, jhardy, nansari, obarenbo, simaishi, wfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.12.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1783375 1783377 (view as bug list) Environment:
Last Closed: 2020-06-10 12:48:59 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: 1783375, 1783377    

Comment 5 William Fitzgerald 2019-10-03 13:33:10 UTC
Tuan,

Can I get a copy of the dialog?

Thanks

Billy

Comment 21 CFME Bot 2019-12-02 15:20:33 UTC
New commit detected on ManageIQ/ui-components/master:

https://github.com/ManageIQ/ui-components/commit/5c16e8081dc13c4191d4a02d0705e821f12dc460
commit 5c16e8081dc13c4191d4a02d0705e821f12dc460
Author:     Martin Hradil <mhradil>
AuthorDate: Mon Nov 25 20:19:19 2019 -0500
Commit:     Martin Hradil <mhradil>
CommitDate: Mon Nov 25 20:19:19 2019 -0500

    dialog-user: fix integer dropdown 0 default_value handling

    Have a dropdown with integer data_type,
    have the values set so that one value is 0,
    select that value as default value.

    Loading the dialog, default_value: '0' comes from the server,
    DialogData#setDefaultValue converts it to numeric 0, based on the data type,
    but when it gets called again, the numeric 0 fails a falsy check, and the first option in the list gets used instead.

    Adding a data_type === 'integer', default_value === 0 exception to the falsy check.

    (A better but also much larger fix would be to refactor dialog user so that setDefaultValue never gets called twice on the same data.)

    Before:

    numReq old 0 string
           new 0 number
    numOpt old 0 string
           new 0 number
    strReq old 0 string
           new 0 string
    strOpt old 0 string
           new 0 string
    numReq old 0 number
           new 1 number
    numOpt old 0 number
           new null object
    strReq old 0 string
           new 0 string
    strOpt old 0 string
           new 0 string

    Now:

    numReq old 0 string
           new 0 number
    numOpt old 0 string
           new 0 number
    strReq old 0 string
           new 0 string
    strOpt old 0 string
           new 0 string
    numReq old 0 number
           new 0 number
    numOpt old 0 number
           new 0 number
    strReq old 0 string
           new 0 string
    strOpt old 0 string
           new 0 string

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

 src/dialog-user/services/dialogData.ts | 5 +-
 1 file changed, 4 insertions(+), 1 deletion(-)