prisme-flow
Version:
prisme platform flow engine
60 lines (50 loc) • 1.81 kB
HTML
<!--
Created by prisme.io on 09/06/2017.
@author <a href="mailto:hello@prisme.io">savane vamara</a> (prisme.io)
-->
<script type="text/javascript">
RED.nodes.registerType('objectid',{
category: 'utility',
color: '#3FADB5',
defaults: {
name: { value: "" },
property: { value: "payload", validate: RED.validators.typedInput('propertyType') },
propertyType: { value: "msg" }
},
inputs:1,
outputs:1,
icon: "objectid.png",
label: function() {
return this.name || "objectid";
},
oneditprepare: function() {
var node = this;
$("#node-input-property").typedInput({
default: this.propertyType || 'msg',
types: [ 'msg' ]
});
},
oneditsave: function() {
this.propertyType = $("#node-input-property").typedInput('type');
// note; Not sure how to force a default, put aside for now.
// this.property = this.property || 'payload';
}
});
</script>
<script type="text/x-red" data-template-name="objectid">
<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">
<label for="node-input-property"><i class="fa fa-list"></i> Property</label>
<input type="text" id="node-input-property" />
</div>
</script>
<script type="text/x-red" data-help-name="objectid">
<p>This small node-red node is used to create an ObjectID for mongodb.</p></br>
<p>The selected property in `msg` will be converted to an ObjectID,
you can input a 24 char hexstring and create an ObjectID from it.</p>
<p>For example: <code>msg._id = "572dbc06f307c8682045c55c"</code></p>
<p>If the target property is null, a random id is created.</p>
</script>