dockerized_openAger/nodered/rootfs/data/node_modules/node-red-contrib-influxdb/influxdb.html

397 lines
20 KiB
HTML
Raw Permalink Normal View History

2020-10-17 16:42:50 +00:00
<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 data-i18n="influxdb.label.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 data-i18n="influxdb.label.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 data-i18n="influxdb.label.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 data-i18n="node-red:common.label.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 data-i18n="node-red:common.label.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" data-i18n="influxdb.label.use-tls"></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 data-i18n="influxdb.label.tls-config"></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 data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-config-input-name" data-i18n="[placeholder]node-red:common.label.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 data-i18n="influxdb.label.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 data-i18n="influxdb.label.measurement"></span></label>
<input type="text" id="node-input-measurement">
</div>
<div class="form-row">
<input type="checkbox" id="advanced-options-checkbox" style="display: inline-block; width: auto; vertical-align: top;">
<label for="advanced-options-checkbox" style="width: 70%;"><span data-i18n="influxdb.label.use-advanced-query"></span></label>
<div id="advanced-options-div" class="hide" style="margin-left: 20px; margin-top: 10px;">
<div class="form-row">
<label for="node-input-precision" style="width:35%"><i class="fa fa-clock-o"></i> <span data-i18n="influxdb.label.time-precision"></span></label>
<select type="text" id="node-input-precision" style="width:55%">
<option value="">Default</option>
<option value="n">Nanoseconds (n)</option>
<option value="u">Microseconds (u)</option>
<option value="ms">Milliseconds (ms)</option>
<option value="s">Seconds (s)</option>
<option value="m">Minute (m)</option>
<option value="h">Hour (h)</option>
<option value="d">Day (d)</option>
<option value="w">Week (w)</option>
</select>
</div>
<div class="form-row">
<label for="node-input-retentionPolicy" style="width:35%"><i class="fa fa-gavel"></i> <span data-i18n="influxdb.label.retention-policy"></span></label>
<input type="text" style="width:55%" id="node-input-retentionPolicy">
</div>
</div>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]influxdb.tip"></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>
<p>Check <i>Advanced Query Options</i> to specify a time precision and retention policy for the insertion.<p>
<p>The advanced query options <i>Time Precision</i> and <i>Retention Policy</i> can be overwritten using
message properties <b>msg.precision</b> and <b>msg.retentionPolicy</b>.</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: ""},
precision: {value: ""},
retentionPolicy: {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();
}
});
$("#advanced-options-checkbox").change( function () {
if ($('#advanced-options-checkbox').is(":checked")) {
$("#advanced-options-div").show();
} else {
$("#advanced-options-div").hide();
}
});
// show advanced options if a query option is set on startup
if (($('#node-input-precision').val() === "")
&& ($('#node-input-retentionPolicy').val() === "")) {
$("#advanced-options-div").hide();
} else {
$('#advanced-options-checkbox').prop('checked', true);
$("#advanced-options-div").show();
}
},
oneditsave: function() {
// reset inputs if we are not using advanced options
if (!$("#advanced-options-checkbox").is(':checked')) {
$("#node-input-precision").val("");
$("#node-input-retentionPolicy").val("");
}
}
});
</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 data-i18n="influxdb.label.server"></span></label>
<input type="text" id="node-input-influxdb">
</div>
<div class="form-row">
<input type="checkbox" id="advanced-options-checkbox" style="display: inline-block; width: auto; vertical-align: top;">
<label for="advanced-options-checkbox" style="width: 70%;"><span data-i18n="influxdb.label.use-advanced-query"></span></label>
<div id="advanced-options-div" class="hide" style="margin-left: 20px; margin-top: 10px;">
<div class="form-row">
<label for="node-input-precision" style="width:35%"><i class="fa fa-clock-o"></i> <span data-i18n="influxdb.label.time-precision"></span></label>
<select type="text" id="node-input-precision" style="width:55%">
<option value="">Default</option>
<option value="n">Nanoseconds (n)</option>
<option value="u">Microseconds (u)</option>
<option value="ms">Milliseconds (ms)</option>
<option value="s">Seconds (s)</option>
<option value="m">Minute (m)</option>
<option value="h">Hour (h)</option>
<option value="d">Day (d)</option>
<option value="w">Week (w)</option>
</select>
</div>
<div class="form-row">
<label for="node-input-retentionPolicy" style="width:35%"><i class="fa fa-gavel"></i> <span data-i18n="influxdb.label.retention-policy"></span></label>
<input type="text" style="width:55%" id="node-input-retentionPolicy">
</div>
</div>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]influxdb.tip"></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>
<p>Check <i>Advanced Query Options</i> to specify a time precision and retention policy for the insertion.<p>
<p>The advanced query options <i>Time Precision</i> and <i>Retention Policy</i> can be overwritten using
message properties <b>msg.precision</b> and <b>msg.retentionPolicy</b>.</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},
precision: {value: ""},
retentionPolicy: {value: ""},
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" : "";
},
oneditprepare: function() {
$("#advanced-options-checkbox").change( function () {
if ($('#advanced-options-checkbox').is(":checked")) {
$("#advanced-options-div").show();
} else {
$("#advanced-options-div").hide();
}
});
// show advanced options if a query option is set on startup
if (($('#node-input-precision').val() === "")
&& ($('#node-input-retentionPolicy').val() === "")) {
$("#advanced-options-div").hide();
} else {
$('#advanced-options-checkbox').prop('checked', true);
$("#advanced-options-div").show();
}
},
oneditsave: function() {
// reset inputs if we are not using advanced options
if (!$("#advanced-options-checkbox").is(':checked')) {
$("#node-input-precision").val("");
$("#node-input-retentionPolicy").val("");
}
}
});
</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 data-i18n="influxdb.label.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 data-i18n="influxdb.label.query"></span></label>
<input type="text" id="node-input-query">
</div>
<div class="form-row">
<input type="checkbox" id="node-input-rawOutput" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-rawOutput"><span data-i18n="influxdb.label.use-raw-output"></span></label>
</div>
<div class="form-row">
<input type="checkbox" id="advanced-options-checkbox" style="display: inline-block; width: auto; vertical-align: top;">
<label for="advanced-options-checkbox" style="width: 70%;"><span data-i18n="influxdb.label.use-advanced-query"></span></label>
<div id="advanced-options-div" class="hide" style="margin-left: 20px; margin-top: 10px;">
<div class="form-row">
<label for="node-input-precision" style="width:35%"><i class="fa fa-clock-o"></i> <span data-i18n="influxdb.label.time-precision"></span></label>
<select type="text" id="node-input-precision" style="width:55%">
<option value="">Default</option>
<option value="n">Nanoseconds (n)</option>
<option value="u">Microseconds (u)</option>
<option value="ms">Milliseconds (ms)</option>
<option value="s">Seconds (s)</option>
<option value="m">Minute (m)</option>
<option value="h">Hour (h)</option>
<option value="d">Day (d)</option>
<option value="w">Week (w)</option>
</select>
</div>
<div class="form-row">
<label for="node-input-retentionPolicy" style="width:35%"><i class="fa fa-gavel"></i> <span data-i18n="influxdb.label.retention-policy"></span></label>
<input type="text" style="width:55%" id="node-input-retentionPolicy">
</div>
</div>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]influxdb.querytip"></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>
<p>To output the results of the query in the raw output format returned by InfluxDb,
check the <i>Raw Output</i> checkbox.</p>
<p>Check <i>Advanced Query Options</i> to specify a time precision and retention policy for the query.<p>
<p>The raw output configuration can be overwritten by the message property <b>msg.rawOutput</b>. </p>
<p>The advanced query options <i>Time Precision</i> and <i>Retention Policy</i> can be overwritten using
message properties <b>msg.precision</b> and <b>msg.retentionPolicy</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: ""},
rawOutput: {value: false},
precision: {value: ""},
retentionPolicy: {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();
}
});
$("#advanced-options-checkbox").change( function () {
if ($('#advanced-options-checkbox').is(":checked")) {
$("#advanced-options-div").show();
} else {
$("#advanced-options-div").hide();
}
});
// show advanced options if a query option is set on startup
if (($('#node-input-precision').val() === "")
&& ($('#node-input-retentionPolicy').val() === "")) {
$("#advanced-options-div").hide();
} else {
$('#advanced-options-checkbox').prop('checked', true);
$("#advanced-options-div").show();
}
},
oneditsave: function() {
// reset inputs if we are not using advanced options
if (!$("#advanced-options-checkbox").is(':checked')) {
$("#node-input-precision").val("");
$("#node-input-retentionPolicy").val("");
}
}
});
</script>