tada

just a test dont use

[{"id":"f54f0743.8aa018","type":"tab","label":"Calc","disabled":false,"info":""},{"id":"17856a5b.1d96f6","type":"tab","label":"Load Rate Sheets","disabled":false,"info":""},{"id":"1c582dd7.4317d2","type":"tab","label":"Simulator","disabled":false,"info":""},{"id":"38b8793a.268cc6","type":"subflow","name":"Load Discount","info":"","in":[{"x":260,"y":160,"wires":[{"id":"e94fb00f.1f0a7"}]}],"out":[{"x":640,"y":160,"wires":[{"id":"e94fb00f.1f0a7","port":0}]}]},{"id":"52d21b9c.584754","type":"subflow","name":"Apply Discount","info":"","in":[{"x":50,"y":30,"wires":[{"id":"8bbbcecd.6867"}]}],"out":[{"x":340,"y":40,"wires":[{"id":"8bbbcecd.6867","port":0}]}]},{"id":"b0b918e1.1029f8","type":"swagger-doc","z":"","summary":"Test","description":"","tags":"","consumes":"","produces":"","parameters":[{"name":"number","in":"query","description":"Number","required":true,"type":"integer"},{"name":"factor","in":"query","description":"Factor","required":false,"type":"integer"},{"name":"index","in":"query","description":"index","required":false,"type":"integer"}],"responses":{},"deprecated":false},{"id":"28fbfc45.087204","type":"http in","z":"f54f0743.8aa018","name":"calc","url":"/calc","method":"get","upload":false,"swaggerDoc":"b0b918e1.1029f8","x":100,"y":220,"wires":[["44650b6b.7c4e14"]]},{"id":"b2847697.337bc8","type":"http response","z":"f54f0743.8aa018","name":"","statusCode":"","headers":{},"x":610,"y":600,"wires":[]},{"id":"3b9f8963.31bd96","type":"function","z":"f54f0743.8aa018","name":"calculculate","func":"var result = msg.payload.number*msg.payload.factor;\n\n\nmsg.payload.result = result * msg.payload.baseRate[msg.payload.index];\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":440,"wires":[["86a8f0e.475131"]]},{"id":"44650b6b.7c4e14","type":"function","z":"f54f0743.8aa018","name":"baseRates","func":"const tada = 'yahoo';\n\nconst br = ()=>{\n    return [1,2,3,4,5,6,7,8,9,10];\n};\n\nmsg.payload.baseRate = br(); \nreturn msg;","outputs":1,"noerr":0,"x":280,"y":280,"wires":[["df41d9da.3d6a18"]]},{"id":"2f8932a9.7d5f9e","type":"template","z":"f54f0743.8aa018","name":"render result","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div>Result: {{payload.result}} !</div>","output":"str","x":270,"y":560,"wires":[["b2847697.337bc8"]]},{"id":"a8bd4f4d.198e3","type":"catch","z":"f54f0743.8aa018","name":"","scope":null,"x":100,"y":80,"wires":[["3911d6e6.9b3ada","16a37351.7f14ad"]]},{"id":"4d945357.cca8cc","type":"http response","z":"f54f0743.8aa018","name":"Error","statusCode":"400","headers":{},"x":450,"y":80,"wires":[]},{"id":"3911d6e6.9b3ada","type":"debug","z":"f54f0743.8aa018","name":"","active":false,"console":"false","complete":"false","x":270,"y":60,"wires":[]},{"id":"16a37351.7f14ad","type":"template","z":"f54f0743.8aa018","name":"Error Flow","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Error Thrown: {{payload}} !","output":"str","x":270,"y":120,"wires":[["4d945357.cca8cc"]]},{"id":"e94fb00f.1f0a7","type":"function","z":"38b8793a.268cc6","name":"Appliy Discount","func":"msg.payload.discount = .30;\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":160,"wires":[[]]},{"id":"df41d9da.3d6a18","type":"subflow:38b8793a.268cc6","z":"f54f0743.8aa018","name":"","x":280,"y":360,"wires":[["3b9f8963.31bd96"]]},{"id":"8bbbcecd.6867","type":"function","z":"52d21b9c.584754","name":"Apply discount","func":"msg.payload.result = msg.payload.result * msg.payload.discount;\nreturn msg;","outputs":1,"noerr":0,"x":220,"y":40,"wires":[[]]},{"id":"86a8f0e.475131","type":"subflow:52d21b9c.584754","z":"f54f0743.8aa018","x":280,"y":500,"wires":[["2f8932a9.7d5f9e","eb020712.95c5e8"]]},{"id":"15e988af.e08747","type":"inject","z":"17856a5b.1d96f6","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":120,"y":120,"wires":[["49032c82.17d504"]]},{"id":"49032c82.17d504","type":"function","z":"17856a5b.1d96f6","name":"","func":"msg.meta = {};\nmsg.meta.loaded = true;\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":140,"wires":[["e5677066.c3bdf"]]},{"id":"e5677066.c3bdf","type":"debug","z":"17856a5b.1d96f6","name":"","active":false,"console":"false","complete":"false","x":500,"y":160,"wires":[]},{"id":"eb020712.95c5e8","type":"debug","z":"f54f0743.8aa018","name":"","active":true,"console":"false","complete":"false","x":520,"y":520,"wires":[]},{"id":"dbb9c831.1829c8","type":"http in","z":"1c582dd7.4317d2","name":"sim","url":"/sim","method":"get","upload":false,"swaggerDoc":"","x":130,"y":260,"wires":[["1d3779d0.3e0456"]]},{"id":"21543da4.930bd2","type":"http response","z":"1c582dd7.4317d2","name":"","statusCode":"","headers":{},"x":490,"y":260,"wires":[]},{"id":"1d3779d0.3e0456","type":"http request","z":"1c582dd7.4317d2","name":"","method":"GET","ret":"txt","url":"http://localhost:1880/calc?number=10&factor=2&index=8","tls":"","x":320,"y":260,"wires":[["21543da4.930bd2"]]},{"id":"286eb836.5ecc98","type":"comment","z":"1c582dd7.4317d2","name":"Single ","info":"","x":152.00000381469727,"y":160.0000114440918,"wires":[]},{"id":"d6f1ad98.ace04","type":"comment","z":"1c582dd7.4317d2","name":"Batch","info":"","x":150,"y":120,"wires":[]},{"id":"3c683314.11dadc","type":"sunrise","z":"f54f0743.8aa018","name":"","lat":"30.26684","lon":"-97.75297","start":"sunrise","end":"sunset","x":220.4921875,"y":649.4375,"wires":[[],[]]}]
mallond

Flow Info

created 3 months ago

Node Types

Core
  • catch (x1)
  • comment (x2)
  • debug (x3)
  • function (x5)
  • http in (x2)
  • http request (x1)
  • http response (x3)
  • inject (x1)
  • template (x2)
Other
  • subflow (x2)
  • subflow:38b8793a.268cc6 (x1)
  • subflow:52d21b9c.584754 (x1)
  • sunrise (x1)
  • swagger-doc (x1)
  • tab (x3)

Tags

  • tada
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option