fieldset corrected to handle values of expandalbe fields (containing multiple expandable fields)

parent aa8f4785
......@@ -91,6 +91,7 @@
queue = new RSVP.Queue()
.push(function () {
var reserved_keys = [];
if (node_id) {
addField('id', {'type': 'string'}, node_id);
}
......@@ -99,7 +100,8 @@
var property_definition =
options.property_definition.properties[property_name],
value,
i=0, property;
i=0, property,
index;
if (property_definition) {
value = property_definition.default || {};
if (property_definition.allOf) {
......@@ -122,6 +124,33 @@
console.log(options);
console.log(options.value);
console.log(property_name);
// XXX if the field is complex then the value may be complex
// eg options.value > "time_to_failure":{},"time_to_repair":{}...
// while the property_names are abstract as allOf_1 corresponding
// to (for example) time_to_failure
if (options.property_definition
.properties[property_name].allOf) {
if ((options.value || {})[property_name] === undefined) {
if (typeof options.value === 'object') {
if (Object.keys(options.value).length > 0) {
for (index = 0;
index < Object.keys(options.value).length-1;
index += 1) {
if (!(reserved_keys
.indexOf(Object.keys(options.value)[index])
> -1)) {
reserved_keys.push(
Object.keys(options.value)[index]
);
value =
options.value[Object.keys(options.value)[index]];
break;
}
}
}
}
}
}
value = (options.value || {})[property_name] === undefined
? value : options.value[property_name];
if (property_name !== 'coordinate'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment