node-red-contrib-motechat
Version:
ultranet topic and payload communication
57 lines (54 loc) • 1.9 kB
HTML
<script type="text/x-red" data-template-name="xobj">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row display">
<label for="node-input-types">Type</label>
<input type="text" id="node-input-types" placeholder="type">
</div>
<div class="form-row display">
<label for="node-input-func">Func</label>
<select type="text" id="node-input-func" style="display: inline-block; vertical-align: top;" >
<option value="xobj://get" id="find-func" style="font-style: italic;">Get</option>
<option value="xobj://set" id="insert-func" style="font-style: italic;">Set</option>
</select>
</div>
</script>
<script type="text/javascript">
function uniqueId () {
var idStrLen = 32;
var idStr = (Math.floor((Math.random() * 25)) + 10).toString(36);
idStr += (new Date()).getTime().toString(36) ;
do {
idStr += (Math.floor((Math.random() * 35))).toString(36);
} while (idStr.length < idStrLen);
return (idStr);
}
RED.nodes.registerType('xobj', {
category: 'object',
color: '#91e6df',
defaults: {
name: { value: 'xobj' },
types: { value: 'nrstorage'},
func: { value: "xobj://set" }
},
inputs: 1,
outputs: 2,
icon: "db.png",
label: function () {
return this.name || "xobj";
}
});
</script>
<script type="text/x-red" data-help-name="xobj">
<p>Calls a Obj-mms method based on the selected operator.</p>
<br>
<p>* Find *</p>
<p>Queries a collection using the 'msg.payload' as the query statement .</p>
<p>{ "data" : { "property1" : "value1", "property2": "value2" } }</p>
<br>
<p>* Insert *</p>
<p>Creates or Update a obj.</p>
<p>{ "property1" : "value1", "property2": "value2" }</p>
</script>