From 46e514c0d8a7109eb0088782a977eff25d656800 Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Tue, 7 Jan 2020 09:22:34 -0600 Subject: [PATCH] added query for log viewing. --- flows_nodered_kraken.json | 231 +++++++++++++++++++++++++++++++++++--- 1 file changed, 216 insertions(+), 15 deletions(-) diff --git a/flows_nodered_kraken.json b/flows_nodered_kraken.json index cc38712..488e853 100644 --- a/flows_nodered_kraken.json +++ b/flows_nodered_kraken.json @@ -6,6 +6,45 @@ "disabled": false, "info": "" }, + { + "id": "d8e8a587.a39408", + "type": "tab", + "label": "HTML Queries", + "disabled": false, + "info": "" + }, + { + "id": "af98615f.cf9ce", + "type": "subflow", + "name": "DB Data to HTML Table", + "info": "", + "category": "", + "in": [ + { + "x": 20, + "y": 80, + "wires": [ + { + "id": "3ff8fa1b.3148f6" + } + ] + } + ], + "out": [ + { + "x": 320, + "y": 240, + "wires": [ + { + "id": "71b8fd74.2d9404", + "port": 0 + } + ] + } + ], + "env": [], + "color": "#DDAA99" + }, { "id": "42702610.230028", "type": "kraken-credentials", @@ -19,6 +58,13 @@ "db": "KrakenTradingDB.sqlite3", "mode": "RW" }, + { + "id": "4378beea.a2c7f", + "type": "sqlitedb", + "z": "", + "db": "KrakenTradingDB.sqlite3", + "mode": "RWC" + }, { "id": "b8c92875.131c58", "type": "get-server-time", @@ -252,14 +298,15 @@ "id": "57c6ead4.4943d4", "type": "debug", "z": "6d543cb4.ed3084", - "name": "", + "name": "Ticker Retrieval Error", "active": true, "tosidebar": true, - "console": false, + "console": true, "tostatus": false, - "complete": "false", - "x": 530, - "y": 1080, + "complete": "payload", + "targetType": "msg", + "x": 510, + "y": 1100, "wires": [] }, { @@ -414,7 +461,7 @@ "name": "gt (Sell)", "active": true, "tosidebar": true, - "console": false, + "console": true, "tostatus": false, "complete": "true", "targetType": "full", @@ -429,11 +476,11 @@ "name": "lt (buy)", "active": true, "tosidebar": true, - "console": false, + "console": true, "tostatus": false, "complete": "true", "targetType": "full", - "x": 1390, + "x": 1400, "y": 1100, "wires": [] }, @@ -527,7 +574,7 @@ "name": "Not Selling, min Volume reached.", "active": true, "tosidebar": true, - "console": false, + "console": true, "tostatus": false, "complete": "payload", "targetType": "msg", @@ -542,11 +589,11 @@ "name": "SELLING!", "active": true, "tosidebar": true, - "console": false, + "console": true, "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 1720, + "x": 1730, "y": 1020, "wires": [] }, @@ -557,11 +604,11 @@ "name": "BUYING!", "active": true, "tosidebar": true, - "console": false, + "console": true, "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 1700, + "x": 1710, "y": 1180, "wires": [] }, @@ -605,11 +652,11 @@ "name": "Not buying, max Volume reached.", "active": true, "tosidebar": true, - "console": false, + "console": true, "tostatus": false, "complete": "payload", "targetType": "msg", - "x": 1780, + "x": 1790, "y": 1260, "wires": [] }, @@ -684,5 +731,159 @@ "wires": [ [] ] + }, + { + "id": "71b8fd74.2d9404", + "type": "template", + "z": "af98615f.cf9ce", + "name": "HTML", + "field": "payload", + "fieldType": "msg", + "format": "handlebars", + "syntax": "mustache", + "template": "\n \n {{payload.title}}\n \n \n\n\n \n {{#payload.header}}\n \n {{/payload.header}}\n \n {{#payload.data}}\n \n {{#.}}\n \n {{/.}}\n \n {{/payload.data}}\n
{{.}}
{{.}}
\n\n", + "output": "str", + "x": 190, + "y": 240, + "wires": [ + [] + ] + }, + { + "id": "3ff8fa1b.3148f6", + "type": "function", + "z": "af98615f.cf9ce", + "name": "JSON Obj -> Array split Header and Data", + "func": "function toArray(json_data){\n for(var i in json_data)\n result.push([i, json_data [i]]);\n}\n\nfunction getHeader(json_data){\n let keys=Object.keys(json_data);\n return keys;\n}\n\nlet pl=msg.payload;\ndelete msg.payload;\n\nmsg.payload={};\nmsg.payload.header=[];\nmsg.payload.data=[];\nmsg.payload.title=msg.title;\n\nlet y=[];\nfor(var i in pl) {\n if (i==1) {\n msg.payload.header=getHeader(pl[i]);\n }\n let x=[];\n for (var j in pl[i]){\n x.push(pl[i][j]);\n }\n y.push(x);\n}\n\nmsg.payload.data=y;\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "x": 260, + "y": 80, + "wires": [ + [ + "325628f8.f9bb48" + ] + ] + }, + { + "id": "325628f8.f9bb48", + "type": "template", + "z": "af98615f.cf9ce", + "name": "CSS", + "field": "payload.style", + "fieldType": "msg", + "format": "handlebars", + "syntax": "mustache", + "template": "html,\nbody {\n height: 100%;\n}\nbody {\n margin: 0;\n background: #222222;\n font-family: sans-serif;\n font-weight: 100;\n}\n.container {\n position: absolute;\n top: 50%;\n left: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n}\ntable {\n width: 800px;\n border-collapse: collapse;\n overflow: hidden;\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);\n}\ntd {\n padding: 0px;\n background-color: rgba(255, 255, 255, 0.2);\n color: #ffffff;\n text-align: left;\n}\npre {\n margin: 0;\n text-align: left;\n}\nth {\n background-color: #27206f;\n color: yellow;\n}\ntbody tr:hover {\n background-color: rgba(255, 255, 255, 0.3);\n}\ntbody td {\n position: relative;\n}\ntbody td:hover:before {\n content: \"\";\n position: absolute;\n left: 0;\n right: 0;\n top: -9999px;\n bottom: -9999px;\n background-color: rgba(255, 255, 255, 0.2);\n z-index: -1;\n}\n", + "output": "str", + "x": 190, + "y": 160, + "wires": [ + [ + "71b8fd74.2d9404" + ] + ] + }, + { + "id": "8b96370c.e63028", + "type": "debug", + "z": "d8e8a587.a39408", + "d": true, + "name": "", + "active": true, + "tosidebar": true, + "console": true, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 360, + "y": 100, + "wires": [] + }, + { + "id": "448c23fb.54356c", + "type": "http response", + "z": "d8e8a587.a39408", + "name": "", + "statusCode": "", + "headers": {}, + "x": 1000, + "y": 140, + "wires": [] + }, + { + "id": "e7546e50.b4e6", + "type": "sqlite", + "z": "d8e8a587.a39408", + "mydb": "4378beea.a2c7f", + "sqlquery": "fixed", + "sql": "select * from TradeGeneralLog order by ID desc limit 10000;", + "name": "", + "x": 680, + "y": 140, + "wires": [ + [ + "b67c9c51.fda15" + ] + ] + }, + { + "id": "79f2b3b4.db6cdc", + "type": "change", + "z": "d8e8a587.a39408", + "name": "Set Title (Manual)", + "rules": [ + { + "t": "set", + "p": "title", + "pt": "msg", + "to": "LOGs", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 300, + "y": 140, + "wires": [ + [ + "e7546e50.b4e6", + "8b96370c.e63028" + ] + ] + }, + { + "id": "b67c9c51.fda15", + "type": "subflow:af98615f.cf9ce", + "z": "d8e8a587.a39408", + "name": "", + "env": [], + "x": 760, + "y": 220, + "wires": [ + [ + "448c23fb.54356c" + ] + ] + }, + { + "id": "7f957960.b6cd58", + "type": "http in", + "z": "d8e8a587.a39408", + "name": "", + "url": "/getLog", + "method": "get", + "upload": false, + "swaggerDoc": "", + "x": 80, + "y": 140, + "wires": [ + [ + "79f2b3b4.db6cdc" + ] + ] } ] \ No newline at end of file