Bug 1609076 - Dynamic Drop down showing extra data which has hash data as values
Summary: Dynamic Drop down showing extra data which has hash data as values
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.9.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.9.4
Assignee: Tina Fitzgerald
QA Contact: Shveta
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-27 00:10 UTC by Nikhil Gupta
Modified: 2021-09-09 15:12 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-01 13:03:17 UTC
Category: Bug
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Dynamic dropdown extra data (16.66 KB, image/png)
2018-07-27 00:10 UTC, Nikhil Gupta
no flags Details
Dynamic dropdown extra data inspect (254.68 KB, image/png)
2018-07-27 00:12 UTC, Nikhil Gupta
no flags Details
Raw Automate Output after running the dialog method (194.56 KB, image/png)
2018-08-01 16:04 UTC, mkanoor
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3547611 0 None None None 2018-07-31 02:25:35 UTC

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


Note You need to log in before you can comment on or make changes to this bug.