Bug 1531316 - Default Value on Dropdown inside Dialog does not store value
Summary: Default Value on Dropdown inside Dialog does not store value
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.9.0
Hardware: x86_64
OS: Mac OS
high
high
Target Milestone: GA
: 5.9.0
Assignee: eclarizi
QA Contact: Antonin Pagac
URL:
Whiteboard: testathon
Depends On: 1516721
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-04 23:58 UTC by Satoe Imaishi
Modified: 2018-03-06 15:31 UTC (History)
12 users (show)

Fixed In Version: 5.9.0.22
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1516721
Environment:
Last Closed: 2018-03-06 15:31:05 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
missing default_value in request (196.96 KB, image/png)
2018-02-06 14:46 UTC, Roman Blanco
no flags Details
Dropdown element in SUI (30.60 KB, image/png)
2018-02-15 09:47 UTC, Antonin Pagac
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1540273 0 high CLOSED Service Dialogs: Different behaviour of items wrt default values 2021-02-22 00:41:40 UTC

Internal Links: 1540273

Comment 2 Satoe Imaishi 2018-01-08 16:22:27 UTC
This change is included in ui-components 1.0.4 (https://github.com/ManageIQ/manageiq-ui-classic/pull/3175)

Comment 3 Antonin Pagac 2018-01-19 14:18:46 UTC
I'm still not seeing the default value appear on the dropdown element.
Although I have set the default value in the options tab to be the key and value that I created, my dropdown still shows "<None>" as a default value.

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

Comment 5 CFME Bot 2018-01-19 21:23:33 UTC
New commit detected on ManageIQ/ui-components/master:
https://github.com/ManageIQ/ui-components/commit/592de0a50ddcdc61a9ccdce598b76d13be64ebf5

commit 592de0a50ddcdc61a9ccdce598b76d13be64ebf5
Author:     Roman Blanco <rblanco>
AuthorDate: Fri Jan 19 17:23:02 2018 +0100
Commit:     Roman Blanco <rblanco>
CommitDate: Fri Jan 19 20:10:27 2018 +0100

    Corrected displaying of default value in Dialog Editor preview
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1531316
    
    issue was introduced in commit 9245795638b338b7fb5898a9ee9d407543b0bda4

 src/dialog-editor/components/field/field.html | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comment 6 Antonin Pagac 2018-01-30 15:03:12 UTC
Appliance version 5.9.0.18

The default values are now displayed when adding or editing dialog:

Automation -> Automate -> Customization; Service Dialogs; Configuration -> Add a new Dialog / Edit this Dialog

The bug still remains when using the provisioning dialog to order a service (Services -> Catalogs; Service Catalogs; <new catalog>; Order), looks like the dialog doesn't work with default values. This can be seen also via SUI.

Comment 7 Roman Blanco 2018-01-31 14:10:14 UTC
The current problem probably is, the Dialog User does not work correctly with the update I've done regarding storing `default_value`. I'm working on it.

Roman

Comment 8 Roman Blanco 2018-02-01 21:11:49 UTC
So far what I know, is that while loading the data in the Dialog User, the `default_value` for the dropdown field is not loaded correctly, and is always `null`.

The problem is already in the `setupField` method:

https://github.com/ManageIQ/ui-components/blob/6286f9e8751b362bb2e97aec4bbde91958e75c95/src/dialog-user/services/dialogData.ts#L14

The same is for:

https://github.com/ManageIQ/ui-components/blob/6286f9e8751b362bb2e97aec4bbde91958e75c95/src/dialog-user/components/dialog-user/dialogUser.ts#L48

- `this.dialog` already has `null` instead of the correct value.

Comment 9 Roman Blanco 2018-02-06 14:46:44 UTC
Created attachment 1392115 [details]
missing default_value in request

This looks to be an API issue (service dialog serializer). 

The dropdown has the `default_value` set correctly (`"Three"`), as can be seen on the top part of the attached screenshot.

After sending a GET request, the `default_value` of the dropdown dialog field has a value `null`.

I've asked Jillian Tullo for a help with the issue.

Comment 10 Jillian Tullo 2018-02-06 19:23:16 UTC
I was able to look into the issue with Roman, and from what I can tell it is not an API issue, but an issue in the serializer. I have reached out to Erik Clarizio as well for some guidance, who believes it is also a serializer issue.

Comment 14 CFME Bot 2018-02-09 21:22:10 UTC
New commit detected on ManageIQ/ui-components/master:
https://github.com/ManageIQ/ui-components/commit/e9b6f5ffa88b311c44c316f43bcf79c07562c178

commit e9b6f5ffa88b311c44c316f43bcf79c07562c178
Author:     Erik Clarizio <eclarizio>
AuthorDate: Thu Feb 8 13:30:12 2018 -0800
Commit:     Erik Clarizio <eclarizio>
CommitDate: Thu Feb 8 14:16:21 2018 -0800

    Ensure value and description values for drop down fields are correct
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1531316
    
    In a sample value list: ["1", "one"], ["2", "two"], "one" and "two"
    should be the values shown on the drop-down, but "1" and "2" should be
    what is sent as the actual value. Before this commit, it was the other
    way around which is incorrect.

 src/dialog-editor/components/field/field.html                 |  4 ++--
 .../components/modal-field-template/drop-down-list.html       |  4 ++--
 src/dialog-user/components/dialog-user/dialogField.html       | 11 +++++++----
 3 files changed, 11 insertions(+), 8 deletions(-)

Comment 15 CFME Bot 2018-02-09 21:22:16 UTC
New commit detected on ManageIQ/ui-components/master:
https://github.com/ManageIQ/ui-components/commit/cebfbc5d1a5475ca959d13a9019aaaa3ff5188ea

commit cebfbc5d1a5475ca959d13a9019aaaa3ff5188ea
Author:     Erik Clarizio <eclarizio>
AuthorDate: Thu Feb 8 13:31:56 2018 -0800
Commit:     Erik Clarizio <eclarizio>
CommitDate: Thu Feb 8 14:18:09 2018 -0800

    Ensure multivalue drop-downs show their default values properly
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1531316
    
    default_value initially gets set as a string, but for multivalue
    dropdowns it needs to be an array

 src/dialog-editor/components/field/field.html      |  1 +
 .../components/field/fieldComponent.spec.ts        | 24 ++++++++++++++++++++++
 .../components/field/fieldComponent.ts             | 10 +++++++++
 .../components/dialog-user/dialogField.html        |  6 ++++--
 .../components/dialog-user/dialogField.spec.ts     |  8 ++++++++
 .../components/dialog-user/dialogField.ts          | 10 +++++++++
 6 files changed, 57 insertions(+), 2 deletions(-)
 create mode 100644 src/dialog-editor/components/field/fieldComponent.spec.ts

Comment 16 CFME Bot 2018-02-09 21:26:45 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/d51217471073936f8337620cb959982aecf9b3b5

commit d51217471073936f8337620cb959982aecf9b3b5
Author:     Erik Clarizio <eclarizi>
AuthorDate: Thu Feb 8 14:11:33 2018 -0800
Commit:     Erik Clarizio <eclarizi>
CommitDate: Fri Feb 9 07:28:57 2018 -0800

    Use correct comparison for multi-value default value inclusion rules
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1531316
    
    Since the default value for a multi-value drop-down is a string,
    comparing directly to the list of values in a drop-down did not work. It
    needs to be converted to an array and then compare the overlap to see if
    the default value is appropriate.

 app/models/dialog_field_drop_down_list.rb          | 14 +++++
 .../orchestration_template_service_dialog_spec.rb  |  4 +-
 spec/models/dialog_field_drop_down_list_spec.rb    | 64 ++++++++++++++++------
 3 files changed, 64 insertions(+), 18 deletions(-)

Comment 17 Satoe Imaishi 2018-02-09 23:35:55 UTC
ui-components change is included in 1.0.11

https://github.com/ManageIQ/manageiq-ui-classic/pull/3387

Comment 18 CFME Bot 2018-02-09 23:37:01 UTC
New commit detected on ManageIQ/manageiq/gaprindashvili:
https://github.com/ManageIQ/manageiq/commit/35c564c61ea4844c04476ed694b07176e5d3e4ca

commit 35c564c61ea4844c04476ed694b07176e5d3e4ca
Author:     Greg McCullough <gmccullo>
AuthorDate: Fri Feb 9 16:17:58 2018 -0500
Commit:     Satoe Imaishi <simaishi>
CommitDate: Fri Feb 9 18:32:56 2018 -0500

    Merge pull request #16978 from eclarizio/BZ1531316
    
    Use correct comparison for multi-value default value inclusion rules
    (cherry picked from commit 6056dc85b025d7fa6b1a533fd5c6bd9ec03e7652)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1531316

 app/models/dialog_field_drop_down_list.rb          | 14 +++++
 .../orchestration_template_service_dialog_spec.rb  |  4 +-
 spec/models/dialog_field_drop_down_list_spec.rb    | 64 ++++++++++++++++------
 3 files changed, 64 insertions(+), 18 deletions(-)

Comment 19 Antonin Pagac 2018-02-15 09:06:46 UTC
Verified with 5.9.0.21.

Default value for dropdown now works in all screens correctly.

Comment 20 Antonin Pagac 2018-02-15 09:46:42 UTC
No it doesn't!

I'm now looking at ordering screen in SUI and the Dropdown element seems to be broken. It contains numbers instead of strings and it does NOT show default value (see screenshot).

So it works everywhere except the SUI.

Comment 21 Antonin Pagac 2018-02-15 09:47:33 UTC
Created attachment 1396358 [details]
Dropdown element in SUI

Comment 22 eclarizi 2018-02-15 16:42:39 UTC
This is fixed in https://github.com/ManageIQ/manageiq-ui-service/pull/1383.

Comment 23 CFME Bot 2018-02-15 18:23:19 UTC
New commit detected on ManageIQ/manageiq-ui-service/gaprindashvili:
https://github.com/ManageIQ/manageiq-ui-service/commit/53e1d03bbbd3fd443988a4387ad52044e18df5d9

commit 53e1d03bbbd3fd443988a4387ad52044e18df5d9
Author:     Allen Wight <allen.b.wight>
AuthorDate: Tue Feb 13 07:57:38 2018 -0500
Commit:     Satoe Imaishi <simaishi>
CommitDate: Thu Feb 15 13:15:54 2018 -0500

    Merge pull request #1383 from chalettu/dialog-select-ui-components
    
    Updated UI components version to remedy dialog select issue
    (cherry picked from commit 2ee001eb3df3a646666126e14595fba8d471c782)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1531316

 package.json | 2 +-
 yarn.lock    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comment 24 Antonin Pagac 2018-02-26 14:10:56 UTC
Appliance version: 5.9.0.22

Works perfectly, marking as verified.


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