Description of problem: We have a Service Dialog that is launched from a button on a VM that has several dynamic dropdown lists. This dropdowns are percentages from 0 to 100. The $evm.object['values'] hash that is dynamically generated has keys that are integers (e.g. 0, 5, 10, etc.). We also set $evm.object['default_value'] to one of the percentages if a value has previously been saved as a custom attribute on the VM. In CF 4.1 when the dialog is loaded the dropdown lists correctly show the default percentages. In CF 4.2 the $evm.object['default_value'] is not honored and "0 %" is always shown. If the keys on the $evm.object['values'] hash are changed to strings (e.g. "0", "5", "10", etc.) then the $evm.object['default_value'] is honored and the correct value is shown as the default. $evm.object['data_type'] is set to integer. Version-Release number of selected component (if applicable): CFME 5.7.2.1 How reproducible: Always Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: Looks similar to bug 1439942: https://bugzilla.redhat.com/show_bug.cgi?id=1439942
I've determined the cause, and until we can get a fix out, the workaround to make the keys strings will work. They will still be submitted to the request as integers, because the data-type is set to integer, but currently the 'default_value' is always being treated as a string, so when comparing the string to the integer, it fails. Is it feasible to continue with this workaround for now until I can get a proper fix put together?
https://github.com/ManageIQ/manageiq/pull/14998
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/830dc8ab3a09a40bb5e1632111d07fb9d6e9f2cf commit 830dc8ab3a09a40bb5e1632111d07fb9d6e9f2cf Author: Erik Clarizio <eclarizi> AuthorDate: Thu May 4 09:23:12 2017 -0700 Commit: Erik Clarizio <eclarizi> CommitDate: Thu May 4 10:12:57 2017 -0700 Coerce default_value for sorted items into appropriate type https://bugzilla.redhat.com/show_bug.cgi?id=1447442 app/models/dialog_field_sorted_item.rb | 9 +++-- spec/models/dialog_field_drop_down_list_spec.rb | 52 +++++++++++++++++++++---- 2 files changed, 51 insertions(+), 10 deletions(-)
Can you please attach the dialog and dynamic method used . Thanks, Shveta
Created attachment 1278295 [details] dynamic_dropdown Attached the dynamic dropdown provided by the customer
Default value is stored in 5.9.0.2.20171010190026_0413a06