Yangman + Yangtutils - request header + rpc element bug fixing
[dlux.git] / modules / common-yangutils-resources / src / main / resources / yangutils / services / path-utils.services.js
index 1789a9adb1a683ebf34089ed73eed334c3fa9ab1..44068ffd2614a6a3d029e82ad389d306377ba16b 100644 (file)
@@ -53,7 +53,7 @@ define([], function () {
         }
 
         // TODO: add service's description
-        function translate(path, prefixConverter, importNodes, getDefaultModuleCallback) {
+        function translate(path, prefixConverter, importNodes, getDefaultModuleCallback, notIdentifiers) {
             var pathStrElements = path.split('/').filter(function (e) {
                     return e !== '';
                 }),
@@ -72,9 +72,10 @@ define([], function () {
 
             for (index = 0; index < maxIndex; index += 1) {
                 var actElem = pathStrElements[index],
-                    lastElem = getLastElement(pathArrayElements);
+                    lastElem = getLastElement(pathArrayElements),
+                    checkIdentifier = notIdentifiers ? false : isIdentifier(actElem);
 
-                if (isIdentifier(actElem) && lastElem) {
+                if (checkIdentifier && lastElem) {
                     lastElem.addIdentifier(actElem.slice(1, -1));
                 } else {
 
@@ -132,7 +133,7 @@ define([], function () {
                 if ( pathItem.hasIdentifier() ){
                     pathItem.identifiers.forEach(function (identifier){
                         pathPosition++;
-                        identifier.value = pathArray[pathPosition];
+                        identifier.value = isIdentifier(pathArray[pathPosition]) ? '' : pathArray[pathPosition];
                     });
                 }
                 pathPosition++;
@@ -148,8 +149,8 @@ define([], function () {
         }
 
         // TODO: add service's description
-        function searchNodeByPath(pathString, treeApis, treeData, disabledExpand) {
-            var pathArray = translate(trimPath(pathString)),
+        function searchNodeByPath(pathString, treeApis, treeData, disabledExpand, notIdentifiers) {
+            var pathArray = translate(trimPath(pathString), null, null, null, notIdentifiers),
                 module = pathArray.length > 1 ? pathArray[1].module : null,
                 selectedTreeApi = module ? treeApis.filter(function (treeApi) {
                     return treeApi.module === module;