}
});
selectedOptionValue = utils.resolvePath(container.model, ['uiState.choice', selectName, 'selected'].join('.'));
+ } else {
+ property.properties.map(function(p) {
+ let pname = p.properties[0].name;
+ if(container.model.hasOwnProperty(pname)) {
+ utils.assignPathValue(container.model, ['uiState.choice', selectName, 'selected'].join('.'), [p.name, pname].join('.'));
+ }
+ })
+ selectedOptionValue = utils.resolvePath(container.model, ['uiState.choice', selectName, 'selected'].join('.'));
}
}
//If selectedOptionValue is present, take first item in string which represents the case name.
{build(container, d, childPath, childValue, props)}
</div>
);
- }) : (!isMissingDescriptorMeta) ? build(container, valueProperty, path.concat(valueProperty.name), utils.resolvePath(container.model, path.concat(valueProperty.name).join('.'))) : null
+ }) : (!isMissingDescriptorMeta) ? build(container, valueProperty, path.concat(valueProperty.name), utils.resolvePath(container.model, path.concat(valueProperty.name).join('.')) || container.model[valueProperty.name]) : null
// end magic
const onFocus = onFocusPropertyFormInputElement.bind(container, property, path, value);
if (property.type === 'choice') {
value = utils.resolvePath(container.model, ['uiState.choice'].concat(path, 'selected').join('.'));
+ if(!value) {
+ property.properties.map(function(p) {
+ let pname = p.properties[0].name;
+ if(container.model.hasOwnProperty(pname)) {
+ value = container.model[pname];
+ }
+ })
+ }
}
let displayValue = typeof value === 'object' ? '' : value;
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
if (confd.hasOwnProperty(key) && confd[key] === '') {
delete confd[key];
}
+ //removes choice properties from top level object and copies immediate children onto it.
+ checkForChoiceAndRemove(key, confd, vldModel);
}
+
const deepProperty = 'provider-network';
for (var key in confd[deepProperty]) {
if (confd[deepProperty].hasOwnProperty(key) && confd[deepProperty][key] === '') {
},
vdu: {
serialize(vduModel) {
- const confd = _.omit(vduModel, ['uiState']);
+ const copy = _.clone(vduModel);
+ for (let k in copy) {
+ checkForChoiceAndRemove(k, copy, vduModel)
+ }
+ const confd = _.omit(copy, ['uiState']);
return confd;
}
}
};
+
+function checkForChoiceAndRemove(k, confd, model) {
+ let state = model.uiState;
+ if (state.choice) {
+ let choice = state.choice[k]
+ if(choice) {
+ for (let key in confd[k]) {
+ confd[key] = confd[k][key]
+ };
+ delete confd[k];
+ }
+ }
+ return confd;
+ }
+
export default DescriptorModelSerializer;