UNPKG

prisme-flow

Version:

prisme platform flow engine

235 lines (219 loc) 10.3 kB
<!-- Created by prisme.io on 09/06/2017. @author <a href="mailto:hello@prisme.io">savane vamara</a> (prisme.io) --> <script type="text/x-red" data-template-name="influxdb"> <div class="form-row"> <label for="node-config-input-hostname"><i class="fa fa-server"></i> <span>Host</span></label> <input class="input-append-left" type="text" id="node-config-input-hostname" placeholder="localhost" style="width: 40%;" > <label for="node-config-input-port" style="margin-left: 10px; width: 35px; "> <span>Port</span></label> <input type="text" id="node-config-input-port" style="width:45px"> </div> <div class="form-row"> <label for="node-config-input-database"><i class="fa fa-database"></i> <span>Database</span></label> <input type="text" id="node-config-input-database"> </div> <div class="form-row"> <label for="node-config-input-username"><i class="fa fa-user"></i> <span>Username</span></label> <input type="text" id="node-config-input-username"> </div> <div class="form-row"> <label for="node-config-input-password"><i class="fa fa-lock"></i> <span>Password</span></label> <input type="password" id="node-config-input-password"> </div> <div class="form-row"> <input type="checkbox" id="node-config-input-usetls" style="display: inline-block; width: auto; vertical-align: top;"> <label for="node-config-input-usetls" style="width: auto">Enable secure (SSL/TLS) connection</label> <div id="node-config-row-tls" class="hide"> <label style="width: auto; margin-left: 20px; margin-right: 10px;" for="node-config-input-tls"><span>TLS Configuration</span></label><input style="width: 300px;" type="text" id="node-config-input-tls"> </div> </div> <div class="form-row"> <label for="node-config-input-name"><i class="fa fa-tag"></i> <span>Name</span></label> <input type="text" id="node-config-input-name"> </div> </script> <script type="text/javascript"> RED.nodes.registerType('influxdb', { category: 'config', color: "rgb(218, 196, 180)", defaults: { hostname: {value: "127.0.0.1", required: true}, port: {value: 8086, required: true}, protocol: {value: "http", required: true}, database: {value: "", required: true}, name: {value: ""}, usetls: {value: false}, tls: {type:"tls-config",required: false} }, credentials: { username: {type: "text"}, password: {type: "password"} }, label: function() { return this.name || this.hostname + ":" + this.port + "/" + this.database; }, oneditprepare: function() { if (typeof this.usetls === 'undefined') { this.usetls = false; $("#node-config-input-usetls").prop("checked",false); } function updateTLSOptions() { if ($("#node-config-input-usetls").is(':checked')) { $("#node-config-row-tls").show(); } else { $("#node-config-row-tls").hide(); } } updateTLSOptions(); $("#node-config-input-usetls").on("click",function() { updateTLSOptions(); }); } }); </script> <script type="text/x-red" data-template-name="influxdb out"> <div class="form-row"> <label for="node-input-influxdb"><i class="fa fa-server"></i> <span>Server</span></label> <input type="text" id="node-input-influxdb"> </div> <div class="form-row"> <label for="node-input-measurement"><i style="width: 10px;" class="fa fa-rss"></i> <span>Measurement</span></label> <input type="text" id="node-input-measurement"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label> <input type="text" id="node-input-name"> </div> <div class="form-tips" id="node-warning" style="display: none"><span>If no measurement is specified, ensure msg.measurement contains the measurement name</span></div> </script> <script type="text/x-red" data-help-name="influxdb out"> <p>A simple influxdb output node to write values and tags to an influxdb measurement.</p> <p>The fields and tags to write are in <b>msg.payload</b>. If <b>msg.payload</b> is a string, number, or boolean, it will be written as a single value to the specified measurement (called <i>value</i>).</p> <p>If <b>msg.payload</b> is an object containing multiple properties, the fields will be written to the measurement.</p> <p>If <b>msg.payload</b> is an array containing two objects, the first object will be written as the set of named fields, the second is the set of named tags.</p> <p>Finally, if <b>msg.payload</b> is an array of arrays, it will be written as a series of points containing fields and tags.</p> <p>If the <i>measurement</i> field is not set in the node configuration, the user can send in data with a specified measurement name in <b>msg.measurement</b> to overwrite the <i>measurement</i> field in the configuration of the node.</p> </script> <script type="text/javascript"> RED.nodes.registerType('influxdb out', { category: 'storage-output', color: "rgb(218, 196, 180)", defaults: { influxdb: {type: "influxdb", required: true}, name: {value: ""}, measurement: {value: ""} }, inputs: 1, outputs: 0, icon: "influxdb.png", align: "right", label: function() { var influxNode = RED.nodes.node(this.influxdb); return this.name || (influxNode ? influxNode.label() + " " + this.measurement: "influxdb"); }, labelStyle: function() { return this.name ? "node_label_italic" : ""; }, oneditprepare: function() { $("#node-input-measurement").change(function () { if($("#node-input-measurement").val() === "") { $("#node-warning").show(); } else { $("#node-warning").hide(); } }); } }); </script> <script type="text/x-red" data-template-name="influxdb batch"> <div class="form-row"> <label for="node-input-influxdb"><i class="fa fa-server"></i> <span>Server</span></label> <input type="text" id="node-input-influxdb"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label> <input type="text" id="node-input-name"> </div> <div class="form-tips" id="node-warning" style="display: none"><span>If no measurement is specified, ensure msg.measurement contains the measurement name </span></div> </script> <script type="text/x-red" data-help-name="influxdb batch"> <p>A influxdb output node to write multiple points (fields and tags) to multiple influxdb measurements.</p> <p>The <b>msg.payload</b> needs to be an array of <i>point</i> objects.</p> <p>The <b>measurement</b> property of a point contains the name of the measurement for the point. The <b>fields</b> property will contain the fields of the point. If supplied, the <b>tags</b> property will contain the tags for the point. To set the time for the point, supply a <b>timestamp</b> property.</p> </script> <script type="text/javascript"> RED.nodes.registerType('influxdb batch', { category: 'storage-output', color: "rgb(218, 196, 180)", paletteLabel: 'influx batch', defaults: { influxdb: {type: "influxdb", required: true}, name: {value: ""} }, inputs: 1, outputs: 0, icon: "influxdb.png", align: "right", label: function() { var influxNode = RED.nodes.node(this.influxdb); return this.name || (influxNode ? influxNode.label() : "influxdb batch"); }, labelStyle: function() { return this.name ? "node_label_italic" : ""; } }); </script> <script type="text/x-red" data-template-name="influxdb in"> <div class="form-row"> <label for="node-input-influxdb"><i class="fa fa-server"></i> <span>Server</span></label> <input type="text" id="node-input-influxdb"> </div> <div class="form-row"> <label for="node-input-query"><i class="fa fa-briefcase"></i> <span>Query</span></label> <input type="text" id="node-input-query"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label> <input type="text" id="node-input-name"> </div> <div class="form-tips" id="node-warning" style="display: none"><span>if no measurement is specified, ensure msg.measurement contains the measurement name</span></div> </script> <script type="text/x-red" data-help-name="influxdb in"> <p>Allows basic queries to be made to an influxdb time series database.</p> <p>The query can be specified in the configuration property or using the property <b>msg.query</b>. The results will be returned in <b>msg.payload</b>.</p> </script> <script type="text/javascript"> RED.nodes.registerType('influxdb in', { category: 'storage-input', color: "rgb(218, 196, 180)", defaults: { influxdb: {type: "influxdb", required: true}, name: {value: ""}, query: {value: ""}, }, inputs: 1, outputs: 1, icon: "influxdb.png", label: function() { var influxNode = RED.nodes.node(this.influxdb); return this.name || (influxNode ? influxNode.label() + " " + this.query: "influxdb"); }, labelStyle: function() { return this.name ? "node_label_italic" : ""; }, oneditprepare: function() { $("#node-input-query").change(function () { if($("#node-input-query").val() === "") { $("#node-warning").show(); } else { $("#node-warning").hide(); } }); } }); </script>