update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b third try
[osm/UI.git] / skyquake / plugins / composer / src / src / libraries / model / DescriptorModelMetaFactory.js
index 69098ec..f7e8562 100644 (file)
@@ -15,6 +15,7 @@ const assign = Object.assign;
 
 const exportInnerTypesMap = {
        'constituent-vnfd': 'nsd.constituent-vnfd',
+    'config-parameter-map': 'nsd.config-parameter-map',
        'vdu': 'vnfd.vdu'
 };
 
@@ -102,19 +103,15 @@ function serialize_leaf_empty(data) {
 function serialize_leaf_list(data) {
        data = data[this.name];
        if (data) {
-               commaSeparatedValues = data.reduce((d, v) => {
-                       let leaf = Serializer.leaf.call(this, d);
-                       let value = leaf & leaf[this.name];
-                       if (value && value.length) {
-                               if (v.length) {
-                                       v += ', ';
-                               }
-                               v += value;
+               data = data.reduce((result, value) => {
+                       if (value !== '' && value !== null && value !== undefined && typeof value !== 'object') {
+                               result.push(value);
                        }
-               }, "");
-               if (commaSeparatedValues.length) {
+                       return result;
+               }, []);
+               if (data.length){
                        let obj = {};
-                       obj[this.name] = commaSeparatedValues;
+                       obj[this.name] = data;
                        return obj;
                }
        }
@@ -125,7 +122,7 @@ function serialize_choice(data) {
        let keys = Object.keys(data);
        if (keys) {
                const chosen = this.properties.find(
-                       c => c.type === 'case' && c.properties && c.properties.some(p => keys.indexOf(p.name) > -1));
+                       c => c.type === 'case' && c.properties && c.properties.some(p => keys.indexOf(p.name) > -1 && data[p.name]));
                return chosen && serializeAll(chosen.properties, data);
        }
        return null;
@@ -192,6 +189,10 @@ export default {
                                                        parentMap[':meta'] = parentObj;
                                                        const properties = parentObj && parentObj.properties ? parentObj.properties : [];
                                                        properties.forEach(p => {
+                                                               const colonIndex = p.name.indexOf(':');
+                                                               if (colonIndex > 0) {
+                                                                               p.name = p.name.slice(colonIndex+1);
+                                                               }
                                                                parentMap[p.name] = mapProperties({}, assign(p, {
                                                                        ':qualified-type': parentObj[':qualified-type'] + '.' + p.name
                                                                }));