UNPKG

node-red-contrib-motechat

Version:

ultranet topic and payload communication

98 lines (94 loc) 3.41 kB
<script type="text/x-red" data-template-name="call"> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="call"> </div> <div class="form-row"> <label for="node-input-DDN"><i class="icon-tag"></i> DDN</label> <input type="text" id="node-input-DDN" placeholder=""> </div> <div class="form-row"> <label for="node-input-topic"><i class="fa fa-tag"></i> Topic</label> <input type="text" id="node-input-topic" placeholder=""/> </div> <div class="form-row"> <label for="node-input-func"><i class="fa fa-dot-circle-o"></i> Function</label> <input type="text" id="node-input-func" placeholder=""/> </div> </script> <script type="text/javascript"> RED.nodes.registerType('call', { category: 'motechat', color: '#A5C2DB', defaults: { DDN: { value: 'DDN', validate: RED.validators.typedInput("DDNType") }, DDNType : { value: 'msg'}, topic: { value: 'topic', validate: RED.validators.typedInput("topicType") }, topicType: { value: 'msg' }, func: { value: '', validate: RED.validators.typedInput("funcType")}, funcType : { value: 'str' }, name: { value: 'call' } }, inputs: 1, outputs: 2, icon: "call.png", label: function() { return this.name || "call"; }, oneditprepare: function() { const defaultTyeps = ['msg','flow','global','str'] $("#node-input-DDN").typedInput({ default: 'str', types: defaultTyeps }) $("#node-input-topic").typedInput({ default: 'str', types: defaultTyeps }) $("#node-input-func").typedInput({ default: 'str', types: defaultTyeps }) $("#node-input-DDN").typedInput('type', this.DDNType) $("#node-input-topic").typedInput('type', this.topicType) $("#node-input-func").typedInput('type', this.funcType ) }, oneditsave: function () { this.DDNType = $("#node-input-DDN").typedInput('type'); this.topicType = $("#node-input-topic").typedInput('type'); this.funcType = $("#node-input-func").typedInput('type'); } }); </script> <script type="text/x-red" data-help-name="call"> <p>Motechat call node.</p> <h3>Inputs</h3> <dl class="message-properties"> <dt>payload <span class="property-type">string | json object</span> </dt> <dd>The payload of message to send to the topics.</dd> <dt class="optional">name <span class="property-type">string</span> </dt> <dd>The name of the node.</dd> <dt class="optional">DDN <span class="property-type">string</span> </dt> <dd>The DDN.</dd> <dt class="optional">topic <span class="property-type">string</span> </dt> <dd>The topic.</dd> <dt class="optional"> function <span class="property-type">string</span> </dt> <dd>The function that be called. This function is published by the topic.</dd> </dl> <h3>Outputs</h3> <dl class="message-properties"> <dt>hostDDN <span class="property-type">string</span> </dt> <dd>The host DDN.</dd> <dt>name <span class="property-type">string</span> </dt> <dd>The name of the node.</dd> <dt>payload <span class="property-type">object</span> </dt> <dd>It contains1 the topic's DDN, and the <code>Reply</code> object that contains <code>ErrCode</code> and <code>ErrMsg</code></dd> </dl> </script>