added query for log viewing.

This commit is contained in:
Joe Tretter
2020-01-07 09:22:34 -06:00
parent 1d2bdfc4df
commit 46e514c0d8

View File

@@ -6,6 +6,45 @@
"disabled": false, "disabled": false,
"info": "" "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", "id": "42702610.230028",
"type": "kraken-credentials", "type": "kraken-credentials",
@@ -19,6 +58,13 @@
"db": "KrakenTradingDB.sqlite3", "db": "KrakenTradingDB.sqlite3",
"mode": "RW" "mode": "RW"
}, },
{
"id": "4378beea.a2c7f",
"type": "sqlitedb",
"z": "",
"db": "KrakenTradingDB.sqlite3",
"mode": "RWC"
},
{ {
"id": "b8c92875.131c58", "id": "b8c92875.131c58",
"type": "get-server-time", "type": "get-server-time",
@@ -252,14 +298,15 @@
"id": "57c6ead4.4943d4", "id": "57c6ead4.4943d4",
"type": "debug", "type": "debug",
"z": "6d543cb4.ed3084", "z": "6d543cb4.ed3084",
"name": "", "name": "Ticker Retrieval Error",
"active": true, "active": true,
"tosidebar": true, "tosidebar": true,
"console": false, "console": true,
"tostatus": false, "tostatus": false,
"complete": "false", "complete": "payload",
"x": 530, "targetType": "msg",
"y": 1080, "x": 510,
"y": 1100,
"wires": [] "wires": []
}, },
{ {
@@ -414,7 +461,7 @@
"name": "gt (Sell)", "name": "gt (Sell)",
"active": true, "active": true,
"tosidebar": true, "tosidebar": true,
"console": false, "console": true,
"tostatus": false, "tostatus": false,
"complete": "true", "complete": "true",
"targetType": "full", "targetType": "full",
@@ -429,11 +476,11 @@
"name": "lt (buy)", "name": "lt (buy)",
"active": true, "active": true,
"tosidebar": true, "tosidebar": true,
"console": false, "console": true,
"tostatus": false, "tostatus": false,
"complete": "true", "complete": "true",
"targetType": "full", "targetType": "full",
"x": 1390, "x": 1400,
"y": 1100, "y": 1100,
"wires": [] "wires": []
}, },
@@ -527,7 +574,7 @@
"name": "Not Selling, min Volume reached.", "name": "Not Selling, min Volume reached.",
"active": true, "active": true,
"tosidebar": true, "tosidebar": true,
"console": false, "console": true,
"tostatus": false, "tostatus": false,
"complete": "payload", "complete": "payload",
"targetType": "msg", "targetType": "msg",
@@ -542,11 +589,11 @@
"name": "SELLING!", "name": "SELLING!",
"active": true, "active": true,
"tosidebar": true, "tosidebar": true,
"console": false, "console": true,
"tostatus": false, "tostatus": false,
"complete": "payload", "complete": "payload",
"targetType": "msg", "targetType": "msg",
"x": 1720, "x": 1730,
"y": 1020, "y": 1020,
"wires": [] "wires": []
}, },
@@ -557,11 +604,11 @@
"name": "BUYING!", "name": "BUYING!",
"active": true, "active": true,
"tosidebar": true, "tosidebar": true,
"console": false, "console": true,
"tostatus": false, "tostatus": false,
"complete": "payload", "complete": "payload",
"targetType": "msg", "targetType": "msg",
"x": 1700, "x": 1710,
"y": 1180, "y": 1180,
"wires": [] "wires": []
}, },
@@ -605,11 +652,11 @@
"name": "Not buying, max Volume reached.", "name": "Not buying, max Volume reached.",
"active": true, "active": true,
"tosidebar": true, "tosidebar": true,
"console": false, "console": true,
"tostatus": false, "tostatus": false,
"complete": "payload", "complete": "payload",
"targetType": "msg", "targetType": "msg",
"x": 1780, "x": 1790,
"y": 1260, "y": 1260,
"wires": [] "wires": []
}, },
@@ -684,5 +731,159 @@
"wires": [ "wires": [
[] []
] ]
},
{
"id": "71b8fd74.2d9404",
"type": "template",
"z": "af98615f.cf9ce",
"name": "HTML",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<html>\n <head>\n <title>{{payload.title}}</title>\n <style>{{payload.style}}</style>\n </head>\n<body>\n<table border='1'>\n <tr>\n {{#payload.header}}\n <th>{{.}}</th>\n {{/payload.header}}\n </tr>\n {{#payload.data}}\n <tr>\n {{#.}}\n <td><pre>{{.}}</pre></td>\n {{/.}}\n </tr>\n {{/payload.data}}\n</table>\n</body>\n</html>",
"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"
]
]
} }
] ]