ManageIQ / ui-components

Angular UI Components for ManageIQ
Apache License 2.0
16 stars 52 forks source link

Correctly set 'null' default value for TagControl & Dropdown #447

Closed mzazrivec closed 4 years ago

mzazrivec commented 4 years ago

This is what data.values for single-value DialogFieldDropDownList looks like:

Array(4)
0: (2) [null, "<None>"]
1: (2) ["1", "One"]
2: (2) ["3", "Three"]
3: (2) ["2", "Two"]
length: 4
__proto__: Array(0)

This is what data.values for single-value DialogFieldTagControl looks like:

Array(5)
0: {id: null, name: "<None>", description: "<None>"}
1: {id: "3", name: "chicago", description: "Chicago"}
2: {id: "4", name: "london", description: "London"}
3: {id: "2", name: "ny", description: "New York"}
4: {id: "5", name: "paris", description: "Paris"}
length: 5
__proto__: Array(0)

Setting the null default value for these cases will make the Nothing Selected thing go away.

Before: Screenshot from 2020-08-03 17-14-29

After: Screenshot from 2020-08-03 17-06-41

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

miq-bot commented 4 years ago

Checked commit https://github.com/mzazrivec/ui-components/commit/e96d5440bf5de5a8c3da19c3f4d39679465af8a7 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint 0 files checked, 0 offenses detected Everything looks fine. :trophy:

himdel commented 4 years ago

Ah, using ng-options consistently now, so the empty value is no longer "" but null, makes sense.

simaishi commented 4 years ago

Jansa backport details:

$ git log -1
commit 1185798d9c48eb71fb2f2352da7e913515f57d51
Author: Martin Hradil <mhradil@redhat.com>
Date:   Mon Aug 3 15:51:36 2020 +0000

    Merge pull request #447 from mzazrivec/correctly_set_null_default_value_for_tag_control_and_dropdown

    Correctly set 'null' default value for TagControl & Dropdown

    (cherry picked from commit 718469070abb168923af861211f7950cfc736317)
simaishi commented 4 years ago

Ivanchuk backport details:

$ git log -1
commit 0b7e11f518e0766a4fc2cd2ab3d90426fd65a1d5
Author: Martin Hradil <mhradil@redhat.com>
Date:   Mon Aug 3 15:51:36 2020 +0000

    Merge pull request #447 from mzazrivec/correctly_set_null_default_value_for_tag_control_and_dropdown

    Correctly set 'null' default value for TagControl & Dropdown

    (cherry picked from commit 718469070abb168923af861211f7950cfc736317)

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