Bug 1609076

Summary: Dynamic Drop down showing extra data which has hash data as values
Product: Red Hat CloudForms Management Engine Reporter: Nikhil Gupta <ngupta>
Component: AutomateAssignee: Tina Fitzgerald <tfitzger>
Status: CLOSED NOTABUG QA Contact: Shveta <sshveta>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.9.3CC: dmetzger, eclarizi, jprause, mkanoor, obarenbo, smallamp, tfitzger
Target Milestone: GAKeywords: Regression
Target Release: 5.9.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-08-01 13:03:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Dynamic dropdown extra data
none
Dynamic dropdown extra data inspect
none
Raw Automate Output after running the dialog method none

Description Nikhil Gupta 2018-07-27 00:10:48 UTC
Created attachment 1470918 [details]
Dynamic dropdown extra data

Description of problem:
In the Service dialog dropdown, a dynamic dropdown which has "hash" data as values and data type as a string show some extra data. Please see the attached screenshots.


Version-Release number of selected component (if applicable):
cfme-5.9.3.4 version


How reproducible:
Always


Steps to Reproduce:

1. Create a dynamic dropdown method which has "hash" data as values and data type as a string:
~~~
fruit_code = {}
fruit_code["{:code=>\"APP01\", :name=>\"Apple01\"}"] = "Apple01"

dialog_field = $evm.object
dialog_field["sort_by"] = "value"
dialog_field["sort_order"] = "ascending"
dialog_field["data_type"] = "string"
dialog_field["required"] = "true"
dialog_field["values"] = fruit_code
~~~

2. Create a Service dialog with a Dynamic Drop down list.

3. Use above service dialog in a catalog and try to order.


Actual results:
It is showing extra data in the dropdown.


Expected results:
It should only display values.


Additional info:
It works fine in Red Hat Cloudforms 4.5 version.

Comment 2 Nikhil Gupta 2018-07-27 00:12:07 UTC
Created attachment 1470919 [details]
Dynamic dropdown extra data inspect

Comment 5 eclarizi 2018-07-27 21:48:09 UTC
I took a quick look at this on the reproducer and was able to change the automate method to get things working again.

The simplest fix is to change this line:
fruit_code["{:code=>\"APP01\", :name=>\"Apple01\"}"] = "Apple01"

I haven't had time to dive much into the exact reason why this doesn't work anymore, but basically if the above line doesn't use escaped double quotes and uses single quotes instead, it behaves as expected.
fruit_code["{:code=>'APP01', :name=>'Apple01'}"] = "Apple01"

Comment 8 mkanoor 2018-08-01 16:03:20 UTC
I checked the values for the hash coming back from Automate, screenshot attached we seem to be preserving the keys like they are defined in the Automate Method.
The UI might be having issues with the hash keys. Another way to accomplish the same thing is to base64 encode the key and use that key.
It might be worth investigating why the UI doesn't like those key values when running the dialogs.

Comment 9 mkanoor 2018-08-01 16:04:12 UTC
Created attachment 1472148 [details]
Raw Automate Output after running the dialog method