node-red-contrib-snap4city-user
Version:
Nodes for Snap4city project, targeted to standard user (no developer)
84 lines (77 loc) • 3.02 kB
HTML
<!--/* NODE-RED-CONTRIB-SNAP4CITY-USER
Copyright (C) 2018 DISIT Lab http://www.disit.org - University of Florence
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */-->
<script type="text/x-red" data-template-name="sigfox in">
<div class="form-row">
<label style="width:120px" for="node-input-device">
<i class="fa fa-globe"></i> Device type ID</label>
<input type="text" autocomplete="off" id="node-input-device" placeholder="e.g. 279f14e1500579390a2f40ca">
</div>
<div class="form-row">
<label style="width:120px" for="node-input-name">
<i class="fa fa-tag"></i> Name</label>
<input type="text" autocomplete="off" id="node-input-name" placeholder="Name">
</div>
<div id="node-input-tip" class="form-tips">Path relative to
<code>
<span id="node-input-path"></span>
</code>.</div>
</script>
<script type="text/x-red" data-help-name="sigfox in">
<p>Provides an input node for Sigfox http POST device type callbacks.</p>
<p>Callbacks must be first configured using Sigfox web interface.</p>
<p>
<b>Note: </b>This node sends an http response. Further handling is not required.
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('sigfox in', {
category: 'S4CSigfox',
color: "rgb(231, 231, 174)",
defaults: {
name: {
value: ""
},
device: {
value: "",
required: true
},
},
inputs: 0,
outputs: 1,
icon: "bridge.png",
label: function () {
if (this.name) {
return this.name;
} else if (this.device) {
return "sigfox [" + this.device + "]";
} else {
return "sigfox";
}
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function () {
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) == "/") {
root = root.slice(0, -1);
}
if (root == "") {
$("#node-input-tip").hide();
} else {
$("#node-input-path").html(root);
$("#node-input-tip").show();
}
}
});
</script>