node-red-contrib-digital-factory
Version:
Node-Red nodes for Supply Chain Wizard's Digital Factory Platform
69 lines (50 loc) • 2.41 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('DF Device Hub',{
category: 'config',
defaults: {
deviceIdType: { value: 'str' },
deviceId: { value: '', validate: RED.validators.typedInput("deviceIdType"), required:true},
},
label: function() {
return this.deviceId;
},
oneditprepare: function() {
$("#node-config-input-deviceIdType").val(this.deviceIdType);
$("#node-config-input-deviceId").typedInput({
default: 'str',
typeField: $("#node-config-input-deviceIdType"),
types:['global','env','str']
});
$("#node-config-input-deviceId").typedInput('type',this.deviceIdType);
$("#node-config-input-deviceKeyType").val(this.deviceKeyType);
$("#node-config-input-deviceKey").typedInput({
default: 'str',
typeField: $("#node-config-input-deviceKeyType"),
types:['global','env','str']
});
$("#node-config-input-deviceKey").typedInput('type',this.deviceKeyType);
},
credentials: {
deviceKeyType: { value: 'str' },
deviceKey: { value: '', validate: RED.validators.typedInput("deviceKeyType"), required:true},
}
});
</script>
<script type="text/x-red" data-template-name="DF Device Hub">
<div class="form-row">
<label for="node-config-input-deviceId"><i class="icon-tag"></i>Device Id</label>
<input type="text" id="node-config-input-deviceId" placeholder="Device Id">
<input type="hidden" id="node-input-deviceIdType">
</div>
<div class="form-row">
<label for="node-config-input-deviceKey"><i class="icon-tag"></i>Device Key</label>
<input type="text" id="node-config-input-deviceKey" placeholder="Device Key">
<input type="hidden" id="node-config-input-deviceKeyType">
</div>
</script>
<script type="text/x-red" data-help-name="DF Device Hub">
<p>Use this page to enter your Digital Factory Device Hub credentials</p>
<p><b>Device Id :</b> Unique identifier for this installation<br>
<b>Device Key :</b> Key to be used<br>
</p>
</script>