UNPKG

node-red-contrib-openfaas

Version:

Call your OpenFaaS function from Node RED

72 lines (69 loc) 2.53 kB
<script type="text/javascript"> RED.nodes.registerType('openfaas',{ category: 'function', color: '#a6bbcf', defaults: { name: {value:""} }, inputs:1, outputs:1, icon: "function.png", color: "#C0DEED", label: function() { return this.name || "OpenFaaS function"; }, // oneditprepare: function(ev) { // jQuery(function($) { // var urlfield = $("#node-input-server") // var url = urlfield.val() ? urlfield.val() : urlfield.attr('placeholder') // console.warn(url); // $.getJSON(url) // .then(function(list){ // console.warn(list); // }) // .catch(function(e){ // console.warn(e); // }) // }) // } }); </script> <script type="text/x-red" data-template-name="openfaas"> <div class="form-row"> <label for="node-input-name"><i class=""></i> Function Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-server"><i class=""></i> Server</label> <input type="text" id="node-input-server" placeholder="http://127.0.0.1:8080"> </div> <!-- <div class="form-row"> <label for="node-input-image"><i class=""></i> Image</label> <input type="text" id="node-input-image" placeholder="Image name"> </div> <div class="form-row"> <label for="node-input-language"><i class=""></i> Language</label> <select id="node-input-language" placeholder=""> <option>csharp</option> <option>go-armhf</option> <option>go</option> <option>node</option> <option>node-arm64</option> <option>node-armhf</option> <option>node</option> <option>python-armhf</option> <option>python</option> <option>python3</option> <option>ruby</option> </select> </div> <div class="form-row"> <label for="node-input-body"><i class=""></i> Function body</label> <textarea id="node-input-body" placeholder="" style="width:100%;height:240px;"></textarea> </div> --> </script> <script type="text/x-red" data-help-name="openfaas"> <p>Invoke a function by `name` as deployed in OpenFaas</p> </script>