UNPKG

node-red-contrib-ibm-mq

Version:

IBM MQ read/write nodes

152 lines (151 loc) 7.26 kB
<script type="text/x-red" data-template-name="ibm-mq-read"> <div class="form-row"> <label for="node-input-name"><i class="fa icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-url"><i class="fa fa-globe"></i> Service URL</label> <input type="text" id="node-input-url" value="http://localhost:8080/eventbus/"> </div> <div class="form-row"> <label for="node-input-host"><i class="fa fa-globe"></i> MQ Host</label> <input type="text" id="node-input-host" value="172.0.0.1"> </div> <div class="form-row"> <label for="node-input-port"><i class="fa fa-sign-in"></i> Port</label> <input id="node-input-port" style="width: 60px;" value="1414"> </div> <div class="form-row"> <label for="node-input-channel"><i class="fa fa-random"></i> Channel</label> <input type="text" id="node-input-channel"> </div> <div class="form-row"> <label for="node-input-user"><i class="fa fa-user"></i> Username</label> <input type="text" id="node-input-user" dir=""> </div> <div class="form-row"> <label for="node-input-pass"><i class="fa fa-lock"></i> Password</label> <input type="password" id="node-input-pass"> </div> <div class="form-row"> <label for="node-input-qmname"><i class="fa icon-tag"></i> Queue Manager Name</label> <input type="text" id="node-input-qmname" placeholder="MyQueueManagerName"> </div> <div class="form-row"> <label for="node-input-qname"><i class="icon-tag"></i> Queue Name</label> <input type="text" id="node-input-qname" placeholder="MyQueueName"> </div> <div class="form-row"> <label for="node-input-ccsid"><i class="icon-tag"></i> CCSID</label> <input type="text" id="node-input-ccsid" style="width: 60px;" placeholder="1098"> </div> <div class="form-row"> <label><i class="fa fa-check-square-o"></i> Autostart</label> <input type="checkbox" id="node-input-active" style="display:inline-block; width:auto; vertical-align:top;"> &nbsp;Active </div> <div class="form-row"> <label for="node-input-count"><i class="fa fa-th"></i> Count</label> <input id="node-input-count" style="width: 60px;" value="1"> </div> </script> <script type="text/x-red" data-help-name="ibm-mq-read"> <p>A node capable of get string messages from IBM Websphere MQ and send them on its output</p> <p>Node properties help & tips</p> <ul> <li><p>It's the best idea to choose a unique and meaningful name in your graph.</p></li> <li><p>"Service URL" is something like "http://localhost:8080/eventbus/" and related to your "Vertx" engine</p></li> <li><p>"MQ Host", "Port", "Channel", "Username", "Password", "Queue Manager Named", "Queue Name" and "CCSID" come from IBM Websphere MQ ("CCSID" is code page number used to read message from MQ)</p></li> <li><p>"Auto start" option makes node to start reading as soon as deployment completion</p></li> <li><p>"Count" is determining the number of messages have been read from MQ (Messages comes in an array. It is a number between 1 and 10000</p></li> </ul> </script> <script type="text/javascript"> RED.nodes.registerType('ibm-mq-read', { category: 'input', color: '#a6bbcf', defaults: { url: {value: "http://localhost:8080/eventbus/"}, host: {value: "172.0.0.1", required: false}, port: {value: 1414, required: false, validate: RED.validators.number()}, channel: {value: "", required: true}, user: {value: "", required: true}, pass: {value: "", required: true}, qmname: {value: "", required: true}, qname: {value: "", required: true}, ccsid: {value: "1098"}, count: {value: "1"}, active: {value: true}, name: {value: "", required: false} }, inputs: 0, outputs: 1, icon: "ibmmq.png", label: function () { return this.name || "ibm-mq"; }, paletteLabel: function () { return "ibm-mq"; }, oneditprepare: function() { var that = this; console.log("onedit prepare"); $("#node-input-count").spinner({ min: 1, max: 10000 }); }, button: { toggle: "active", /* enabled: function() { return !this.changed },*/ onclick: function () { var label = this.name || "ibm-mq"; var node = this; $.ajax({ url: "ibm-mq/" + this.id + "/" + (this.active ? "enable" : "disable"), type: "POST", success: function (resp, textStatus, xhr) { var historyEvent = { t: 'edit', node: node, changes: { active: !node.active }, dirty: node.dirty, changed: node.changed }; node.changed = true; node.dirty = true; RED.nodes.dirty(true); RED.history.push(historyEvent); //RED.view.redraw(); RED.view.redraw(); console.log(xhr.status); if (xhr.status == 200) { RED.notify(node._("debug.notification.activated", {label: label}), "success"); } else if (xhr.status == 201) { RED.notify(node._("debug.notification.deactivated", {label: label}), "success"); } }, error: function (jqXHR, textStatus, errorThrown) { console.log(jqXHR.status); if (jqXHR.status == 404) { RED.notify(node._("common.notification.error", {message: node._("common.notification.errors.not-deployed")}), "error"); } else if (jqXHR.status === 0) { RED.notify(node._("common.notification.error", {message: node._("common.notification.errors.no-response")}), "error"); } else { RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.unexpected", { status: errorThrown.status, message: errorThrown.response }) }), "error"); } } }); } } }); </script>