Skip to content

Commit

Permalink
Dialogs - call initField from refreshFieldCallback, JSON.parse in set…
Browse files Browse the repository at this point in the history
…upField only when string

initField needs to be called from refreshFieldCallback so that we don't run the initialization only on initial load, but also on every refresh from server - this makes initial loads and refreshes consistent

setupField should only try to parse json multivalues when not already converted

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1693294
  • Loading branch information
himdel committed Jul 8, 2019
1 parent 6e8137b commit 04716e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/dialog-user/components/dialog-user/dialogUser.ts
Expand Up @@ -230,6 +230,8 @@ export class DialogUserController extends DialogClass implements IDialogs {
*/

private refreshFieldCallback(field, data) {
this.initField(data);

this.dialogFields[field] = this.updateDialogFieldData(field, data);

this.dialogValues[field] = data.default_value;
Expand Down
4 changes: 3 additions & 1 deletion src/dialog-user/services/dialogData.ts
Expand Up @@ -93,7 +93,9 @@ export default class DialogDataService {
defaultValue = data.default_value ? new Date(data.default_value) : new Date();
}

if (data.type === 'DialogFieldDropDownList' && data.options.force_multi_value && data.default_value) {
// FIXME maybe better make sure it's never not string (must come from double call)
if (data.type === 'DialogFieldDropDownList' && data.options.force_multi_value
&& data.default_value && _.isString(data.default_value)) {
defaultValue = JSON.parse(data.default_value);
}

Expand Down

0 comments on commit 04716e9

Please sign in to comment.