Closed himdel closed 5 years ago
Hammer backport details:
$ git log -1
commit 9fae6ca38c0d845d67dcffa2cb712e482b3f9dbc
Author: Martin Povolny <mpovolny@redhat.com>
Date: Mon Dec 2 14:11:26 2019 +0100
Merge pull request #430 from himdel/bz1757888
dialog-user: fix integer dropdown 0 default_value handling
(cherry picked from commit 0a1de7d6694bb6f49aa6631124b0b193c38f4bcd)
https://bugzilla.redhat.com/show_bug.cgi?id=1783377
Ivanchuk backport details:
$ git log -1
Satoes-MacBook-Pro:ui-components simaishi (ivanchuk) $ git logb
commit 2d49420c2fbaf6a291f32095f2c1da3b98aaf6c3
Author: Martin Povolny <mpovolny@redhat.com>
Date: Mon Dec 2 14:11:26 2019 +0100
Merge pull request #430 from himdel/bz1757888
dialog-user: fix integer dropdown 0 default_value handling
(cherry picked from commit 0a1de7d6694bb6f49aa6631124b0b193c38f4bcd)
https://bugzilla.redhat.com/show_bug.cgi?id=1783375
Have a dropdown with integer data_type, have the values set so that one value is 0, select that value as default value. (in dialog editor or the dialog field yaml)
Loading the dialog,
default_value: '0'
comes from the server,DialogData#setDefaultValue
converts it to numeric0
, based on the data type, but when it gets called again, the numeric0
fails a falsy check, and the first option in the list gets used instead.Adding a
data_type === 'integer'
,default_value === 0
exception to the falsy check.(A better but also much larger fix would be to refactor dialog user so that
setDefaultValue
never gets called twice on the same data.)Before:
Now:
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1757888