Bug 1442383

Summary: Self Service UI does not properly select defaults for dynamic drop downs
Product: Red Hat CloudForms Management Engine Reporter: Ian Tewksbury <itewksbu>
Component: UI - ServiceAssignee: Chris Hale <chhale>
Status: CLOSED CURRENTRELEASE QA Contact: Shveta <sshveta>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.7.0CC: dclarizi, fdewaley, itewksbu, jhardy, obarenbo, simaishi, sshveta
Target Milestone: GAKeywords: TestOnly
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: ssui
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1444060 1444062 (view as bug list) Environment:
Last Closed: 2018-03-06 14:44:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1444060, 1444062    
Attachments:
Description Flags
dialog
none
self service - no defaults
none
ops ui - defaults work
none
one example of the method populating one of the dynamic drop downs
none
Setting of Defaults none

Description Ian Tewksbury 2017-04-14 12:23:21 UTC
Description of problem:
If I have a dynamic drop down that sets a default option the default option shows up fine in the traditional OPs UI but in the Self Service UI the default is not selected.


Version-Release number of selected component (if applicable):
5.7.1
5.7.2.1.20170406142927_0a1ad0e


How reproducible:
Always


Steps to Reproduce:
1. Create a dynamic drop down with default option
2. order service catalog item with dynamic drop down in self service UI

Actual results:
Default is not selected, no option is selected.


Expected results:
Specified default option should be selected.

Comment 3 Chris Hale 2017-04-17 18:36:46 UTC
 Can you send me a copy of the dialog you created and also point me to the appliance you tested this on?  I am unable to reproduce this locally and these two things would help me to determine if this is reproducible.

Comment 4 Ian Tewksbury 2017-04-17 18:41:21 UTC
Created attachment 1272136 [details]
dialog

Comment 5 Ian Tewksbury 2017-04-17 18:41:50 UTC
Created attachment 1272137 [details]
self service - no defaults

Comment 6 Ian Tewksbury 2017-04-17 18:42:29 UTC
Created attachment 1272138 [details]
ops ui - defaults work

Comment 7 Ian Tewksbury 2017-04-17 18:44:14 UTC
Created attachment 1272139 [details]
one example of the method populating one of the dynamic drop downs

Comment 8 Ian Tewksbury 2017-04-17 18:44:53 UTC
@Chris,

I have attached what I think you were asking for. Let me know if you need more.

Blue skies,
Ian

Comment 10 Chris Hale 2017-04-17 19:00:36 UTC
Ian, 
  The method you attached does not have a default value set for the dropdown based on the code you sent.   I have tested a dynamic dropdown locally where I set the default_value in ruby code that defines that dynamic dropdown.   The SUI does recognize this if it is set.

Comment 11 Chris Hale 2017-04-17 19:01:33 UTC
Created attachment 1272143 [details]
Setting of Defaults

Comment 12 Chris Hale 2017-04-17 19:12:03 UTC
Could you test out modifying your dropdown to define a default similar to how I have attached and see if that sets the default that you had defined

Comment 13 Ian Tewksbury 2017-04-17 20:19:55 UTC
@Chris,

Should the default value be the key or the value from the hash? It is unclear from your example since both key and value are the same string.

Then, also assuming this works, why do I need to set this for Self Service but for the OPS UI the behavior is to select the first option in the list? That is inconsistent.

Comment 14 Ian Tewksbury 2017-04-17 20:32:35 UTC
```
  dialog_field                  = $evm.object
  dialog_field["sort_by"]       = "value"
  dialog_field["sort_order"]    = "ascending"
  dialog_field["data_type"]     = "integer"
  dialog_field["required"]      = true
  dialog_field['default_value'] = organization_index['results'][0]['id']
  dialog_field["values"]        = Hash[ *organization_index['results'].collect { |item| [item['id'], item['label']] }.flatten ]
```

That still doesn't work.

Comment 15 Chris Hale 2017-04-17 21:24:29 UTC
Ian,
   If its possible to give me access to the appliance you are experiencing this issue on , it would help me to take a look and see what the API is returning for this drop down.

Comment 16 Ian Tewksbury 2017-04-18 12:04:22 UTC
Chris,

I sent you an email with the log in info for the internal lab.

Comment 17 Chris Hale 2017-04-19 17:33:27 UTC
GH PR https://github.com/ManageIQ/manageiq-ui-service/pull/692

Comment 19 Ian Tewksbury 2017-04-19 18:55:14 UTC
@Chris,

For my own edification, what was the issue? I looked at the pull request, was it something to do with having an int value rathe rather then a string value?

Comment 22 Shveta 2017-11-02 01:18:48 UTC
Fixed in 5.9.0.4.20171024163837_ef71ea6