From d1569975bb18f4359fac18aa98f55b69c248a3ad Mon Sep 17 00:00:00 2001 From: "Chinthakayala, Sheshashailavas (sc2914)" Date: Mon, 28 Aug 2017 05:25:46 -0900 Subject: [CCSDK-28] populated the seed code for dgbuilder updated the code to point to the new package name for sli Change-Id: I3b5a1d05dc5193664fd4a667afdcd0b2354010a4 Issue-ID:{CCSDK-28} Signed-off-by: Chinthakayala, Sheshashailavas (sc2914) Signed-off-by: Chinthakayala, Sheshashailavas (sc2914) --- dgbuilder/tools/json_to_html_table | 144 +++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100755 dgbuilder/tools/json_to_html_table (limited to 'dgbuilder/tools/json_to_html_table') diff --git a/dgbuilder/tools/json_to_html_table b/dgbuilder/tools/json_to_html_table new file mode 100755 index 00000000..20c9cfeb --- /dev/null +++ b/dgbuilder/tools/json_to_html_table @@ -0,0 +1,144 @@ +try{ +var jsonStr='{}'; +jsonObj=JSON.parse(jsonStr); +var htmlObj ={}; +var objectId =0; +var level=0; +var htmlStr="" +htmlStr += ""; +htmlStr += ""; +htmlStr += ""; +htmlStr += ""; +htmlStr += ""; +htmlStr += "
\n\n"; +console.log("
"); +printObjectValues(jsonObj,null,level); +console.log("
"); +htmlStr += "\n\n
"; +//var pattern = new RegExp("\\n","g"); +//htmlstr =htmlStr.replace(pattern,''); +htmlStr += ""; +//console.log(htmlStr); + +//console.dir(htmlObj); +var keyObj={}; +for (var key in htmlObj) { + var idx = key.lastIndexOf("."); + if(idx != -1){ + var str = key.substr(0,idx); + keyObj[str] =''; + }else{ + keyObj[key] =''; + } + //console.log(str); +} + +console.dir(keyObj); +console.log("
    "); +for (var key in keyObj) { + console.log("
  • " + key + "
  • "); +} +console.log("
"); + +function tabs(level){ +return ''; +} +function tabsOrig(level){ + var tabs=""; + for(var i=0;i" + pkey + "." + key + "" +printValue(v) + "" ); + htmlObj[pkey + "." + key ] = printValue(v); + }else{ + //console.log( key + ":" +printValue(v) ); + console.log("" + key + "" +printValue(v) + "" ); + htmlObj[key ] = printValue(v); + } + //printValue(v); + } + } +} +}catch(err){ + console.log(err); +} +return output; +} + +}catch(err){ +console.log( err ); +} + +function printArrayValues(arrObj,pkey,level){ +var output =""; +var arrayHtmlStr =""; +try{ + for(var i=0;arrObj != null && i" + pkey + "." + key + "" +printValue(o) + "" ); + htmlObj[pkey + "." + key ] = printValue(o); + //console.log(pkey + ":" +printValue(o) ); + //output += tabs(level) + "" + printValue(o) + "\n"; + } + } +}catch(err){ + console.log(err); +} +return output; +} + +function printValue(obj){ + if(obj != undefined){ + if(typeof obj == 'string'){ + return "'" + obj + "'"; + }else{ + return obj; + } + }else{ + return ""; + } +} -- cgit 1.2.3-korg