node-red-bluemix-nodes
Version:
A collection of extra Node-RED nodes for IBM Bluemix.
152 lines (142 loc) • 6.58 kB
HTML
<!--
Copyright 2013,2014 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="mqlight in">
<div class="form-row">
<label for="node-input-service"><i class="icon-folder-close"></i> Service</label>
<select type="text" id="node-input-service" style="display: inline-block; width: 70%;">
</select>
</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="news/nodered">
</div>
<div class="form-row">
<label for="node-input-share"><i class="fa fa-tag"></i> Share</label>
<input type="text" id="node-input-share">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips" id="node-missing-service-warning" style="display: none"><i class="fa fa-warning"></i><b> Warning:</b> There are no MQ Light services connected</div>
</script>
<script type="text/x-red" data-help-name="mqlight in">
<p>Provides an MQ Light receive client.</p>
<p>Subscribes the client to a destination based on the supplied topic and (optional) share arguments.</p>
<p>Topic can contain any character in the Unicode character set, with # representing a multilevel wildcard and + a
single level wildcard as described <a href="https://developer.ibm.com/messaging/mq-light/wildcard-topicpatterns/">here</a>.
<p>Share identifies a shared destination for which messages are anycast between connected subscribers. If left blank,
it defaults to a private destination.</p>
<p>Received messages will be sent on in <code>msg.payload</code> with their topic sent in <code>msg.topic</code>
and the share, if specified, sent in <code>msg.share</code>.</p>
</script>
<script type="text/javascript">
(function() {
RED.nodes.registerType('mqlight in', {
category: 'input',
defaults: {
name: {value: ""},
service: {value: "", required: true},
topic: {value: ""},
share: {value:""}
},
color: "#6da7d1",
inputs: 0,
outputs: 1,
icon: "mqlightin.png",
label: function() {
if (this.topic) {
return this.topic+(this.share?" ["+this.share+"]":"");
} else {
return this.name || "mqlight";
}
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function() {
$.getJSON('mqlight/vcap/', function(services) {
if (services.length === 0) {
$("#node-missing-service-warning").show();
} else {
var select = $('#node-input-service');
for (var i = 0; i < services.length; ++i) {
var name = services[i];
var option = "<option value=\"" + name + "\">" + name + "</option>";
select.append(option);
}
}
});
}
});
})();
</script>
<script type="text/x-red" data-template-name="mqlight out">
<div class="form-row">
<label for="node-input-service"><i class="icon-folder-close"></i> Service</label>
<select type="text" id="node-input-service" style="display: inline-block; vertical-align:top; width: 70%;">
</select>
</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="news/nodered">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips" id="node-missing-service-warning" style="display: none"><i class="fa fa-warning"></i><b> Warning:</b> There are no MQ Light services connected</div>
</script>
<script type="text/x-red" data-help-name="mqlight out">
<p>Provides an MQ Light send client.</p>
<p>Sends the value passed in on <code>msg.payload</code> to the specified topic.</p>
<p>The topic can be passed in on <code>msg.topic</code>, however the topic in the node must be blank for this to take
effect. If the topic is set in the node <code>msg.topic</code> will be overridden.</p>
</script>
<script type="text/javascript">
(function() {
RED.nodes.registerType('mqlight out', {
category: 'output',
defaults: {
name: {value: ""},
service: {value: "", required: true},
topic: {value: ""}
},
color: "#6da7d1",
inputs: 1,
outputs: 0,
align: "right",
icon: "mqlightin.png",
label: function() {
return this.name || this.topic || "mqlight";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function() {
$.getJSON('mqlight/vcap/', function(services) {
if (services.length === 0) {
$("#node-missing-service-warning").show();
} else {
var select = $('#node-input-service');
for (var i = 0; i < services.length; ++i) {
var name = services[i];
var option = "<option value=\"" + name + "\">" + name + "</option>";
select.append(option);
}
}
});
}
});
})();
</script>