Bug 1568440

Summary: In dynamic dropdown list, the default value contains ALL the values of the list
Product: Red Hat CloudForms Management Engine Reporter: Andrea Perotti <aperotti>
Component: AutomateAssignee: eclarizi
Status: CLOSED CURRENTRELEASE QA Contact: Shveta <sshveta>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.9.0CC: cpelland, greartes, mkanoor, obarenbo, tfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1569472 (view as bug list) Environment:
Last Closed: 2019-02-11 14:08:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1468726, 1569472    

Description Andrea Perotti 2018-04-17 13:56:05 UTC
Description of problem:
In a dynamic dropdown list, the default value contains ALL the values of the list.

Given this list: 

dialog_field["values"] = {"255.255.254.0" => "255.255.254.0", "255.255.255.0" => "255.255.255.0", "255.255.255.248" => "255.255.255.248"}

if the default value is selected, this is the received value:

dialog_option_0_subnet_mask: [["255.255.254.0", "255.255.254.0"], ["255.255.255.0", "255.255.255.0"], ["255.255.255.248", "255.255.255.248"]]


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

How reproducible:
always

Steps to Reproduce:

a) create a dynamic dropdown list (netmask element) configured this way:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
dialog_field = $evm.object
# sort_by: value / description / none
dialog_field["sort_by"] = "value"
# sort_order: ascending / descending
dialog_field["sort_order"] = "ascending"
# data_type: string / integer
dialog_field["data_type"] = "string"
# required: true / false
dialog_field["required"] = "true"
dialog_field["values"] = {"255.255.254.0" => "255.255.254.0", "255.255.255.0" => "255.255.255.0", "255.255.255.248" => "255.255.255.248"}
dialog_field["default_value"] = "255.255.255.0"
$evm.object['visible'] = true|false

if $evm.root['dialog_option_0_addr_mode'] == 'static'
$evm.object['visible'] = true
else
$evm.object['visible'] = false
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

b) If you does not choose another value, the default value is as below:
"dialog_option_0_subnet_mask: [["255.255.254.0", "255.255.254.0"], ["255.255.255.0", "255.255.255.0"], ["255.255.255.248", "255.255.255.248"]]" and the provisioning does not work.

This is the automation log:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[----] I, [2018-04-17T12:30:43.140918 #11753:1251970]  INFO -- : <AEMethod check_provisioned> Listing Root Object Attributes:
[----] I, [2018-04-17T12:30:43.146876 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   ae_next_state:
[----] I, [2018-04-17T12:30:43.148113 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   ae_result: ok
[----] I, [2018-04-17T12:30:43.149381 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   ae_retry_server_affinity: false
[----] I, [2018-04-17T12:30:43.150710 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   ae_state: checkprovisioned
[----] I, [2018-04-17T12:30:43.151984 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   ae_state_max_retries: 100
[----] I, [2018-04-17T12:30:43.153406 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   ae_state_retries: 1
[----] I, [2018-04-17T12:30:43.154722 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   ae_state_started: 2018-04-17 10:29:32 UTC
[----] I, [2018-04-17T12:30:43.156026 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   ae_state_step: main
[----] I, [2018-04-17T12:30:43.157367 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   dialog_option_0_addr_mode: static
[----] I, [2018-04-17T12:30:43.158666 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   dialog_option_0_cores_per_socket: 1
[----] I, [2018-04-17T12:30:43.159911 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   dialog_option_0_dns_servers: 8.8.8.8
[----] I, [2018-04-17T12:30:43.161178 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   dialog_option_0_gateway: 10.4.5.1
[----] I, [2018-04-17T12:30:43.162394 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   dialog_option_0_ip_addr: 10.4.5.2
[----] I, [2018-04-17T12:30:43.163723 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   dialog_option_0_placement_ds_name: PRE-POC-CEM01_car
[----] I, [2018-04-17T12:30:43.165012 #11753:14f53d4]  INFO -- : <AEMethod check_provisioned>   dialog_option_0_subnet_mask: [["255.255.254.0", "255.255.254.0"], ["255.255.255.0", "255.255.255.0"], ["255.255.255.248", "255.255.255.248"]]
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Actual results:
"dialog_option_0_subnet_mask: [["255.255.254.0", "255.255.254.0"], ["255.255.255.0", "255.255.255.0"], ["255.255.255.248", "255.255.255.248"]]" 

Expected results:
"dialog_option_0_subnet_mask: ["255.255.254.0", "255.255.254.0"]"

Comment 3 CFME Bot 2018-04-19 08:59:25 UTC
New commit detected on ManageIQ/ui-components/master:

https://github.com/ManageIQ/ui-components/commit/8b9d1e4430dbac0170ae797eab14fbb5a128f1db
commit 8b9d1e4430dbac0170ae797eab14fbb5a128f1db
Author:     Erik Clarizio <eclarizio>
AuthorDate: Tue Apr 17 13:32:27 2018 -0400
Commit:     Erik Clarizio <eclarizio>
CommitDate: Tue Apr 17 13:32:27 2018 -0400

    Assign default_value instead of values to the dialogValues hash

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

 src/dialog-user/components/dialog-user/dialogUser.spec.ts | 48 +
 src/dialog-user/components/dialog-user/dialogUser.ts | 39 +-
 2 files changed, 73 insertions(+), 14 deletions(-)

Comment 5 eclarizi 2018-04-26 22:46:52 UTC
I think this will fail based on some preliminary tests. Pushing up another fix shortly.

Comment 7 CFME Bot 2018-04-27 00:51:58 UTC
New commit detected on ManageIQ/ui-components/master:

https://github.com/ManageIQ/ui-components/commit/91633f412c9da333f91f0337520114b4baafb906
commit 91633f412c9da333f91f0337520114b4baafb906
Author:     Erik Clarizio <eclarizio>
AuthorDate: Thu Apr 26 18:46:13 2018 -0400
Commit:     Erik Clarizio <eclarizio>
CommitDate: Thu Apr 26 18:46:13 2018 -0400

    Use default_value for sorted items but values for non-sorted items

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

 src/dialog-user/components/dialog-user/dialogUser.spec.ts | 164 +-
 src/dialog-user/components/dialog-user/dialogUser.ts | 18 +-
 2 files changed, 151 insertions(+), 31 deletions(-)

Comment 8 Shveta 2018-07-18 18:55:09 UTC
Fixed in 5.10.0.3.20180705151325_ce4d2b5