summaryrefslogtreecommitdiffstats
path: root/dgbuilder/tools/splitFlows.js
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2018-11-19 22:38:06 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-19 22:38:06 +0000
commitfc59bbb6279e492dea2fa361c7080163f3f888ea (patch)
tree8a71a25cb3f68d728bc2c2b0187baabcda342494 /dgbuilder/tools/splitFlows.js
parentc125359c8fe20863d8773ab31ceee67660328093 (diff)
parent8797a459b6a5c4516032260cc55663e08a2ab538 (diff)
Merge "[CCSDK-683] fixed dg import from local git repo"
Diffstat (limited to 'dgbuilder/tools/splitFlows.js')
-rw-r--r--dgbuilder/tools/splitFlows.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/dgbuilder/tools/splitFlows.js b/dgbuilder/tools/splitFlows.js
new file mode 100644
index 00000000..39245a2b
--- /dev/null
+++ b/dgbuilder/tools/splitFlows.js
@@ -0,0 +1,29 @@
+var fs=require('fs');
+var path = require("path");
+var full_path_to_flows_json=process.argv[2];
+var output_dir=process.argv[3];
+console.log("full_path_to_flows_json:" + full_path_to_flows_json);
+console.log("output_dir:" + output_dir);
+var buf= null;
+if (fs.existsSync(full_path_to_flows_json)) {
+ buf = JSON.parse(fs.readFileSync(full_path_to_flows_json, "utf8"));
+}
+var tabs = [];
+for (var i=0;buf != null && i<buf.length;i++){
+ if(buf[i].type == "tab"){
+ tabs.push(buf[i]);
+ }
+}
+for(var i=0;tabs != null && i<tabs.length; i++){
+ var tab = tabs[i];
+ var tabId = tab.id;
+ var dgNodes=[];
+ for (var j=0;buf != null && j<buf.length;j++){
+ var zId = buf[j].z;
+ if(zId != undefined && zId != "" && tabId == zId){
+ dgNodes.push(buf[j]);
+ }
+ }
+
+ fs.writeFileSync( output_dir + "/" +tabId, JSON.stringify(dgNodes,null,4));
+}