From 2b745dfb51536811633f734be4b854f18634d0db Mon Sep 17 00:00:00 2001 From: znetsixe Date: Tue, 26 May 2026 18:06:54 +0200 Subject: [PATCH] example(dashboardapi): basic.flow.json demos end-to-end Grafana round-trip (#42) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the placeholder inject→dashboardapi→debug example with the full chain: inject (simulating a measurement child registration) → dashboardapi (composes dashboard JSON) → http request (POSTs to Grafana) → debug (shows the response). Default targets http://grafana:3000 inside the Docker compose network. Configure bearer token via the encrypted credentials field. Refs #42 --- examples/basic.flow.json | 72 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/examples/basic.flow.json b/examples/basic.flow.json index bd4ff4c..c78146f 100644 --- a/examples/basic.flow.json +++ b/examples/basic.flow.json @@ -1,6 +1,70 @@ [ - {"id":"dashboardAPI_basic_tab","type":"tab","label":"dashboardAPI basic","disabled":false,"info":"dashboardAPI basic example"}, - {"id":"dashboardAPI_basic_node","type":"dashboardapi","z":"dashboardAPI_basic_tab","name":"dashboardAPI basic","x":420,"y":180,"wires":[["dashboardAPI_basic_dbg"]]}, - {"id":"dashboardAPI_basic_inj","type":"inject","z":"dashboardAPI_basic_tab","name":"basic trigger","props":[{"p":"topic","vt":"str"},{"p":"payload","vt":"str"}],"topic":"ping","payload":"1","payloadType":"str","x":160,"y":180,"wires":[["dashboardAPI_basic_node"]]}, - {"id":"dashboardAPI_basic_dbg","type":"debug","z":"dashboardAPI_basic_tab","name":"dashboardAPI basic debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":660,"y":180,"wires":[]} + { + "id": "dashboardAPI_basic_tab", + "type": "tab", + "label": "dashboardAPI basic — measurement → Grafana", + "disabled": false, + "info": "Demonstrates the round-trip:\n- inject simulates a child.register message from a measurement node\n- dashboardapi composes a Grafana dashboard for that child\n- http request posts the dashboard to Grafana\n- debug shows the HTTP response\n\nConfigure the dashboardapi node with your Grafana host/port + bearer token\n(encrypted via Node-RED credentials). Default targets http://grafana:3000\nfrom inside the Docker compose stack." + }, + { + "id": "dashboardAPI_basic_node", + "type": "dashboardapi", + "z": "dashboardAPI_basic_tab", + "name": "dashboardAPI", + "protocol": "http", + "host": "grafana", + "port": 3000, + "folderUid": "", + "defaultBucket": "telemetry", + "x": 460, + "y": 200, + "wires": [["dashboardAPI_basic_http"]] + }, + { + "id": "dashboardAPI_basic_inj", + "type": "inject", + "z": "dashboardAPI_basic_tab", + "name": "simulate child.register (measurement)", + "props": [ + { "p": "topic", "vt": "str" }, + { "p": "payload", "v": "{\"config\":{\"general\":{\"id\":\"meas-demo-001\",\"name\":\"FT-001 demo\"},\"functionality\":{\"softwareType\":\"measurement\",\"positionVsParent\":\"downstream\"}}}", "vt": "json" } + ], + "topic": "child.register", + "x": 180, + "y": 200, + "wires": [["dashboardAPI_basic_node"]] + }, + { + "id": "dashboardAPI_basic_http", + "type": "http request", + "z": "dashboardAPI_basic_tab", + "name": "POST /api/dashboards/db", + "method": "use", + "ret": "obj", + "paytoqs": "ignore", + "url": "", + "tls": "", + "persist": false, + "proxy": "", + "authType": "", + "senderr": false, + "x": 720, + "y": 200, + "wires": [["dashboardAPI_basic_dbg"]] + }, + { + "id": "dashboardAPI_basic_dbg", + "type": "debug", + "z": "dashboardAPI_basic_tab", + "name": "Grafana response", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "payload", + "targetType": "msg", + "x": 960, + "y": 200, + "wires": [] + } ]