move name field to top for a bunch of nodes

This commit is contained in:
Dave Conway-Jones
2023-11-28 17:56:07 +00:00
parent 54dc363490
commit 5371f9bb92
40 changed files with 177 additions and 177 deletions

View File

@@ -1,5 +1,9 @@
<script type="text/html" data-template-name="stomp in">
<div class="form-row">
<label for="node-input-name" style="width: 110px;"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-server" style="width: 110px;"><i class="fa fa-bookmark"></i> Server</label>
<input type="text" id="node-input-server">
@@ -17,13 +21,9 @@
</select>
</div>
<div class="form-tips" style="margin-bottom: 12px;">
Enabling the ACK (acknowledgment) will set the <code>ack</code> header to <code>client</code> while subscribing to topics.
Enabling the ACK (acknowledgment) will set the <code>ack</code> header to <code>client</code> while subscribing to topics.
This means the items on the broker queue will not be dequeue'd unless an ACK message is sent using the <code>ack</code> node.
</div>
<div class="form-row">
<label for="node-input-name" style="width: 110px;"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/html" data-help-name="stomp in">
@@ -61,6 +61,10 @@
</script>
<script type="text/html" data-template-name="stomp out">
<div class="form-row">
<label for="node-input-name" style="width: 110px;"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-server" style="width: 110px;"><i class="fa fa-bookmark"></i> Server</label>
<input type="text" id="node-input-server">
@@ -69,10 +73,6 @@
<label for="node-input-topic" style="width: 110px;"><i class="fa fa-envelope"></i> Destination</label>
<input type="text" id="node-input-topic" placeholder="topic or queue">
</div>
<div class="form-row">
<label for="node-input-name" style="width: 110px;"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips" style="margin-bottom: 12px;">The <b>Destination</b> field is optional. If not set uses the <code>msg.topic</code>
property of the message.</div>
</script>
@@ -113,6 +113,10 @@
</script>
<script type="text/html" data-template-name="stomp-server">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
<div class="form-row node-input-server">
<label for="node-config-input-server"><i class="fa fa-bookmark"></i> Server</label>
<input class="input-append-left" type="text" id="node-config-input-server" placeholder="localhost" style="width: 45%;" >
@@ -150,10 +154,6 @@
<div class="form-tips" style="margin-bottom: 12px;">
Reconnection timings are calculated using exponential backoff. The first reconnection happens immediately, the second reconnection happens at +delay ms, the third at + 2*delay ms, etc.
</div>
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
</script>
<script type="text/javascript">
@@ -179,6 +179,10 @@
</script>
<script type="text/html" data-template-name="stomp ack">
<div class="form-row">
<label for="node-input-name" style="width: 110px;"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-server" style="width: 110px;"><i class="fa fa-bookmark"></i> Server</label>
<input type="text" id="node-input-server">
@@ -187,10 +191,6 @@
<label for="node-input-topic" style="width: 110px;"><i class="fa fa-envelope"></i> Destination</label>
<input type="text" id="node-input-topic" placeholder="topic or queue">
</div>
<div class="form-row">
<label for="node-input-name" style="width: 110px;"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/html" data-help-name="stomp ack">

View File

@@ -1,4 +1,4 @@
/* jshint ignore:start */
module.exports = function(RED) {
"use strict";
var StompClient = require('stomp-client');
@@ -136,7 +136,7 @@ module.exports = function(RED) {
*/
node.register = function(stompNode, callback = () => {}) {
node.users[stompNode.id] = stompNode;
if (!node.connected) {
node.connectedCallbacks.push(callback);
}
@@ -158,7 +158,7 @@ module.exports = function(RED) {
* Remove registered STOMP processing nodes from the connection.
* @param { StompInNode | StompOutNode | StompAckNode } stompNode The STOMP processing node to unregister
* @param { Boolean } autoDisconnect Automatically disconnect from the STOM server when no processing nodes registered to the connection
* @param { Function } callback
* @param { Function } callback
*/
node.deregister = function(stompNode, autoDisconnect, callback = () => {}) {
delete node.users[stompNode.id];
@@ -179,7 +179,7 @@ module.exports = function(RED) {
/**
* Connect to the STOMP server.
* @param {Function} callback
* @param {Function} callback
*/
node.connect = function(callback = () => {}) {
if (node.canConnect()) {
@@ -195,7 +195,7 @@ module.exports = function(RED) {
}
node.client = new StompClient(node.options);
node.client.on("connect", function(sessionId) {
node.closing = false;
node.connecting = false;
@@ -206,7 +206,7 @@ module.exports = function(RED) {
setStatusConnected(node, true);
callback();
});
node.client.on("reconnect", function(sessionId, numOfRetries) {
node.closing = false;
node.connecting = false;
@@ -246,7 +246,7 @@ module.exports = function(RED) {
/**
* Disconnect from the STOMP server.
* @param {Function} callback
* @param {Function} callback
*/
node.disconnect = function(callback = () => {}) {
const waitDisconnect = (client, timeout) => {
@@ -295,7 +295,7 @@ module.exports = function(RED) {
* Subscribe to a given STOMP queue.
* @param { String} queue The queue to subscribe to
* @param { "auto" | "client" | "client-individual" } clientAck Can be `auto`, `client` or `client-individual` (the latter only starting from STOMP v1.1)
* @param { Function } callback
* @param { Function } callback
*/
node.subscribe = function(queue, acknowledgment, callback) {
node.log(`Subscribe to: ${queue}`);
@@ -308,7 +308,7 @@ module.exports = function(RED) {
const headers = {
id: node.subscriptionIds[queue],
// Only set client-individual if not v1.0
ack: acknowledgment === "client-individual" && node.options.protocolVersion === "1.0" ? "client" : acknowledgment
ack: acknowledgment === "client-individual" && node.options.protocolVersion === "1.0" ? "client" : acknowledgment
}
node.client.subscribe(queue, headers, function(body, responseHeaders) {
@@ -544,4 +544,5 @@ module.exports = function(RED) {
//JavaScript does not protect the property name hasOwnProperty
//Object.prototype.hasOwnProperty.call is the recommended/safer test
return Object.prototype.hasOwnProperty.call(obj, propName);
}
}
/* jshint ignore:end */

View File

@@ -1,6 +1,6 @@
{
"name" : "node-red-node-stomp",
"version" : "1.0.5",
"version" : "1.0.6",
"description" : "A Node-RED node to publish and subscribe to/from a Stomp server",
"dependencies" : {
"stomp-client" : "^0.9.0"