forked from node-red/node-red-nodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mqlight.html
144 lines (136 loc) · 5.56 KB
/
mqlight.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<script type="text/x-red" data-template-name="mqlight in">
<div class="form-row">
<label for="node-input-service"><i class="fa fa-globe"></i> Service</label>
<input type="text" id="node-input-service">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="nodered/news">
</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>
</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: ""},
topic: {value: ""},
share: {value:""},
service: {type: "mqlight service", required: true}
},
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" : "";
}
});
})();
</script>
<script type="text/x-red" data-template-name="mqlight out">
<div class="form-row">
<label for="node-input-service"><i class="fa fa-globe"></i> Service</label>
<input type="text" id="node-input-service">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="nodered/news">
</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>
</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: ""},
topic: {value: ""},
service: {type: "mqlight service", required: true}
},
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" : "";
}
});
})();
</script>
<script type="text/x-red" data-template-name="mqlight service">
<div class="form-row node-input-service">
<label for="node-config-input-service"><i class="fa fa-globe"></i> Service</label>
<input type="text" id="node-config-input-service" placeholder="amqp://localhost">
</div>
<div class="form-row">
<label for="node-config-input-clientid"><i class="fa fa-tag"></i> ID</label>
<input type="text" id="node-config-input-clientid" placeholder="Leave blank for auto generated">
</div>
<div class="form-row">
<label for="node-config-input-user"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-config-input-user">
</div>
<div class="form-row">
<label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
<input type="password" id="node-config-input-password">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('mqlight service',{
category: 'config',
defaults: {
service: {value: "amqp://localhost", required: true},
clientid: {value: ""}
},
credentials: {
user: {type: "text"},
password: {type: "password"}
},
label: function() {
if (this.service === "") {
this.service = "localhost";
}
return (this.clientid ? this.clientid + "@" : "") + this.service;
}
});
</script>