Bug 177 - Export of nsd/vnfd should not prompt for format and grammar
[osm/UI.git] / skyquake / plugins / composer / src / src / libraries / model / DescriptorModelMetaFactory.js
index 258b894..164c850 100644 (file)
@@ -6,7 +6,7 @@
 
 'use strict';
 
-import _ from 'lodash'
+import _cloneDeep from 'lodash/cloneDeep'
 import utils from './../utils'
 import DescriptorModelMetaProperty from './DescriptorModelMetaProperty'
 import CommonUtils from 'utils/utils';
@@ -72,7 +72,7 @@ export default {
                // resolve paths like 'nsd' or 'vnfd.vdu' or 'nsd.constituent-vnfd'
                const found = utils.resolvePath(modelMetaByPropertyNameMap, getPathForType(typeOrPath));
                if (found) {
-                       const uiState = _.cloneDeep(found[':meta']);
+                       const uiState = _cloneDeep(found[':meta']);
                        uiState.properties = uiState.properties.filter(filterProperties);
                        return uiState;
                }
@@ -82,7 +82,20 @@ export default {
                // resolve paths like 'nsd' or 'vnfd.vdu' or 'nsd.constituent-vnfd'
                const found = utils.resolvePath(modelMetaByPropertyNameMap, getPathForType(typeOrPath));
                if (found) {
-                       return found[':meta'].properties.map(p => p.name);
+                       let result = [];
+                       found[':meta'].properties.map((p) => {
+                               // if(false) {
+                               if(p.type == 'choice') {
+                                       result.push(p.name)
+                                       return p.properties.map(function(q){
+                                               result.push(q.properties[0].name);
+                                       })
+
+                               } else  {
+                                       return result.push(p.name);
+                               }
+                       })
+                       return result;
                }
                console.warn('no model uiState found for type', typeOrPath);
        }