Bug 1576288 - When using dynamic multi select dialog elements the first element is always selected even if nil default is specified and it does not show up as selected in UI
Summary: When using dynamic multi select dialog elements the first element is always s...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - Service
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.10.0
Assignee: eclarizi
QA Contact: Niyaz Akhtar Ansari
URL:
Whiteboard:
Depends On:
Blocks: 1581307
TreeView+ depends on / blocked
 
Reported: 2018-05-09 07:21 UTC by Ian Tewksbury
Modified: 2019-02-11 13:58 UTC (History)
9 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1581307 (view as bug list)
Environment:
Last Closed: 2019-02-11 13:58:48 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ian Tewksbury 2018-05-09 07:21:03 UTC
Description of problem:
When using dynamic multi select dialog elements the first element is always selected even if nil default is specified and it does not show up as selected in UI


Version-Release number of selected component (if applicable):
5.9.2.4.20180501195858_35dc609

How reproducible:
Always


Steps to Reproduce:
1. Create a multi select dynamic drop down and have the automate method set the `default_value` to nil
2. Open the service catalog item

Actual results:
The dialog element displays correctly with no elements selected but if you look at the logs or submit you will find that the first element is selected. This is doubly bad because the first element is selected even though the UI does not show it as selected and there seems to be no way to select no default which is a regression from 5.8.

Expected results:
Should be able to set the default value to nil and have no items selected by default.


Additional info:
Worked around this by adding a bogos entry of { nil => "<Choose>" } but even that option won't be selected when the default option is set to nil and so it just becomes another item in the drop down cluttering the UI.

Comment 2 Chris Hale 2018-05-11 18:33:31 UTC
I have worked on this with Erik Clarizio and discovered a few things.  The backend seems to be changing the data type for the return of defaults in a multiselect scenario.   It converts an array over to a string and it is confusing the frontend.  Erik has offered to take a look at this issue to fix the backend.

Comment 6 CFME Bot 2018-05-21 18:11:06 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/b73e8f6613be622a6f190b241b8904981facf0a9
commit b73e8f6613be622a6f190b241b8904981facf0a9
Author:     Erik Clarizio <eclarizi>
AuthorDate: Mon May 21 01:01:39 2018 -0400
Commit:     Erik Clarizio <eclarizi>
CommitDate: Mon May 21 01:01:39 2018 -0400

    Adjust how default_value is calculated for multi-value drop downs

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

 app/models/dialog_field_drop_down_list.rb | 22 +
 app/models/dialog_field_sorted_item.rb | 3 -
 spec/models/dialog_field_drop_down_list_spec.rb | 56 +-
 spec/models/dialog_field_sorted_item_spec.rb | 23 -
 4 files changed, 76 insertions(+), 28 deletions(-)

Comment 8 Niyaz Akhtar Ansari 2018-10-30 10:58:17 UTC
Verified in Version 5.10.0.21.20181023151612_4c11b0d


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