-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix assumption that all field.values are objects #227
Conversation
@romanblanco : please, review ASAP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good 👍 Thanks @eclarizio
@@ -48,7 +48,9 @@ export default class DialogEditorService { | |||
*/ | |||
public getDialogTabs() { | |||
this.forEachDialogField((field: any) => { | |||
field.values = field.values.filter(value => value[0] && value[1]); | |||
if (! _.isEmpty(field.values) && _.isObject(field.values)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, but better to use _.isArray
, since this will take in effect any Object. isEmpty
does not need to be there, because filtering over empty array does nothing.
if (field.hasOwnProperty('values') && _.isArray(field.values)) {
field.values = field.values.filter(value => value[0] && value[1]);
}
d0071e2
to
e6a183b
Compare
Checked commit eclarizio@e6a183b with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Thanks @karelhala, fixed. |
@miq-bot add_label gaprindashvili/backported This was released in manageiq-ui-components 1.0.4, backported to gaprindashvili via ManageIQ/manageiq-ui-classic#3175 . |
This got changed back in #223, but it makes it so that when you try to edit anything other than drop down or radio button fields (the ones that use objects for their values), it attempts to call
.filter
on a string and ends up blowing up silently in JS with you unable to edit your fields.@romanblanco @martinpovolny please review
@miq-bot add_label gaprindashvili/yes