Skip to content

Instantly share code, notes, and snippets.

@paul121
Created November 27, 2019 09:19
Show Gist options
  • Save paul121/7048f7fdae069e6aa8ad71e210afd515 to your computer and use it in GitHub Desktop.
Save paul121/7048f7fdae069e6aa8ad71e210afd515 to your computer and use it in GitHub Desktop.
node-red test flow
[
{
"id": "58ff452f.d398fc",
"type": "tab",
"label": "Test farmOS Flow",
"disabled": false,
"info": ""
},
{
"id": "4e4527de.360678",
"type": "http in",
"z": "58ff452f.d398fc",
"name": "",
"url": "/farm/info",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 180,
"y": 280,
"wires": [
[
"529af0b3.a670b8"
]
]
},
{
"id": "529af0b3.a670b8",
"type": "http request",
"z": "58ff452f.d398fc",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": false,
"url": "http://localhost/farm.json",
"tls": "",
"persist": false,
"proxy": "",
"authType": "bearer",
"x": 430,
"y": 280,
"wires": [
[
"3e31d9dc.eeff06"
]
]
},
{
"id": "3e31d9dc.eeff06",
"type": "json",
"z": "58ff452f.d398fc",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 630,
"y": 280,
"wires": [
[
"534f40f5.71706"
]
]
},
{
"id": "534f40f5.71706",
"type": "http response",
"z": "58ff452f.d398fc",
"name": "",
"statusCode": "",
"headers": {},
"x": 790,
"y": 280,
"wires": []
},
{
"id": "9793e818.72b8b8",
"type": "ui_text",
"z": "58ff452f.d398fc",
"group": "b5079d0.289126",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"label": "Server Name",
"format": "{{msg.payload.name}}",
"layout": "row-spread",
"x": 830,
"y": 360,
"wires": []
},
{
"id": "88b453e3.fc91b",
"type": "http request",
"z": "58ff452f.d398fc",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": false,
"url": "http://localhost/farm.json",
"tls": "",
"persist": false,
"proxy": "",
"authType": "bearer",
"x": 430,
"y": 400,
"wires": [
[
"9793e818.72b8b8",
"48e94484.4d3f6c",
"be262591.529b9",
"57797f06.f8162",
"6ad6e304.35c3cc"
]
]
},
{
"id": "48e94484.4d3f6c",
"type": "ui_text",
"z": "58ff452f.d398fc",
"group": "b5079d0.289126",
"order": 2,
"width": 0,
"height": 0,
"name": "",
"label": "API Version",
"format": "{{msg.payload.api_version}}",
"layout": "row-spread",
"x": 830,
"y": 400,
"wires": []
},
{
"id": "886badef.c8fb1",
"type": "ui_dropdown",
"z": "58ff452f.d398fc",
"name": "",
"label": "Farm Terms",
"tooltip": "",
"place": "Select option",
"group": "b5079d0.289126",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "",
"x": 830,
"y": 480,
"wires": [
[]
]
},
{
"id": "be262591.529b9",
"type": "function",
"z": "58ff452f.d398fc",
"name": "Filter Terms",
"func": "termDict = msg.payload.resources.taxonomy_term;\noptions = [];\n\nObject.keys(termDict).forEach(function (key) {\n var label = termDict[key].label;\n var vid = termDict[key].vid;\n var opt = {};\n opt[label] = vid;\n options.push(opt);\n});\nmsg.options = options;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 650,
"y": 480,
"wires": [
[
"886badef.c8fb1"
]
]
},
{
"id": "d9b95b2c.26ebe",
"type": "ui_dropdown",
"z": "58ff452f.d398fc",
"name": "",
"label": "Farm Assets",
"tooltip": "",
"place": "Select option",
"group": "b5079d0.289126",
"order": 4,
"width": 0,
"height": 0,
"passthru": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "",
"x": 830,
"y": 540,
"wires": [
[]
]
},
{
"id": "57797f06.f8162",
"type": "function",
"z": "58ff452f.d398fc",
"name": "Filter Assets",
"func": "assets = msg.payload.resources.farm_asset;\noptions = [];\n\nObject.keys(assets).forEach(function (key) {\n var label = assets[key].label;\n var value = assets[key];\n var opt = {};\n opt[label] = value;\n options.push(opt);\n});\nmsg.options = options;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 650,
"y": 540,
"wires": [
[
"d9b95b2c.26ebe"
]
]
},
{
"id": "17438159.6e513f",
"type": "ui_dropdown",
"z": "58ff452f.d398fc",
"name": "",
"label": "Farm Logs",
"tooltip": "",
"place": "Select option",
"group": "b5079d0.289126",
"order": 5,
"width": 0,
"height": 0,
"passthru": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "",
"x": 830,
"y": 600,
"wires": [
[]
]
},
{
"id": "6ad6e304.35c3cc",
"type": "function",
"z": "58ff452f.d398fc",
"name": "Filter Logs",
"func": "logs = msg.payload.resources.log;\noptions = [];\n\nObject.keys(logs).forEach(function (key) {\n var label = logs[key].label;\n var value = logs[key];\n var opt = {};\n opt[label] = value;\n options.push(opt);\n});\nmsg.options = options;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 650,
"y": 600,
"wires": [
[
"17438159.6e513f"
]
]
},
{
"id": "bd8bb6d6.d16e98",
"type": "ui_gauge",
"z": "58ff452f.d398fc",
"name": "",
"group": "b5079d0.289126",
"order": 6,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "# Logs",
"label": "units",
"format": "{{value}}",
"min": 0,
"max": "50",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 830,
"y": 660,
"wires": []
},
{
"id": "12088869.8da06",
"type": "http request",
"z": "58ff452f.d398fc",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": false,
"url": "http://localhost/log.json",
"tls": "",
"persist": false,
"proxy": "",
"authType": "bearer",
"x": 430,
"y": 620,
"wires": [
[
"6ac73876.d9bd7"
]
]
},
{
"id": "df4262fa.d3bc2",
"type": "ui_button",
"z": "58ff452f.d398fc",
"name": "",
"group": "b5079d0.289126",
"order": 7,
"width": 0,
"height": 0,
"passthru": false,
"label": "Refresh!!",
"tooltip": "",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "",
"x": 180,
"y": 400,
"wires": [
[
"88b453e3.fc91b",
"12088869.8da06",
"150edf61.428f89"
]
]
},
{
"id": "6ac73876.d9bd7",
"type": "function",
"z": "58ff452f.d398fc",
"name": "Parse # Logs",
"func": "var size = Object.keys(msg.payload.list).length;\n\nmsg.payload = size;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 650,
"y": 660,
"wires": [
[
"bd8bb6d6.d16e98"
]
]
},
{
"id": "26110d8.1b23872",
"type": "ui_gauge",
"z": "58ff452f.d398fc",
"name": "",
"group": "b5079d0.289126",
"order": 6,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "# Assets",
"label": "units",
"format": "{{value}}",
"min": 0,
"max": "15",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "10",
"seg2": "12",
"x": 840,
"y": 720,
"wires": []
},
{
"id": "838b1e95.678388",
"type": "function",
"z": "58ff452f.d398fc",
"name": "Parse # Assets",
"func": "var size = Object.keys(msg.payload.list).length;\n\nmsg.payload = size;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 660,
"y": 720,
"wires": [
[
"26110d8.1b23872"
]
]
},
{
"id": "150edf61.428f89",
"type": "http request",
"z": "58ff452f.d398fc",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": false,
"url": "http://localhost/farm_asset.json",
"tls": "",
"persist": false,
"proxy": "",
"authType": "bearer",
"x": 430,
"y": 680,
"wires": [
[
"838b1e95.678388"
]
]
},
{
"id": "b5079d0.289126",
"type": "ui_group",
"z": "",
"name": "Server Info",
"tab": "7820596d.bb40b",
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "7820596d.bb40b",
"type": "ui_tab",
"z": "",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment