summaryrefslogtreecommitdiffstats
path: root/dgbuilder/tools
diff options
context:
space:
mode:
authorSheshashailavas Chinthakayala <sc2914@att.com>2018-11-12 22:28:37 +0000
committerSheshashailavas Chinthakayala <sc2914@att.com>2018-11-12 22:29:33 +0000
commit8797a459b6a5c4516032260cc55663e08a2ab538 (patch)
tree7b5d9ab9eba158952c87afced4b4bd77a244f5b4 /dgbuilder/tools
parent424327075cba872296535ffbfe69f32c228b218a (diff)
[CCSDK-683] fixed dg import from local git repo
and also added option to view difference of json and xml since import Change-Id: I4e2616f1880805bd74031020418ba2776616cbfa Issue-ID: CCSDK-683 Signed-off-by: Sheshashailavas Chinthakayala <sc2914@att.com>
Diffstat (limited to 'dgbuilder/tools')
-rw-r--r--dgbuilder/tools/splitFlows.js29
-rwxr-xr-xdgbuilder/tools/splitFlows.sh8
2 files changed, 37 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));
+}
diff --git a/dgbuilder/tools/splitFlows.sh b/dgbuilder/tools/splitFlows.sh
new file mode 100755
index 00000000..ccb70cf9
--- /dev/null
+++ b/dgbuilder/tools/splitFlows.sh
@@ -0,0 +1,8 @@
+if [ "$#" != "2" ]
+then
+ echo "Usage: $0 full_path_to_flows_json_file full_path_to_output_dir"
+ exit
+fi
+rm -rf "$2" 2>/dev/null
+mkdir "$2" 2>/dev/null
+node ${PROJECT_HOME}/tools/splitFlows.js $1 $2