mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3562 from Steve-Mcl/mqttv5-userprops
MQTT Node - save and restore v5 config user props
This commit is contained in:
commit
3a7a606f6a
@ -480,6 +480,7 @@
|
|||||||
willRetain: {value:false},
|
willRetain: {value:false},
|
||||||
willPayload: {value:""},
|
willPayload: {value:""},
|
||||||
willMsg: { value: {}},
|
willMsg: { value: {}},
|
||||||
|
userProps: { value: ""},
|
||||||
sessionExpiry: {value:0}
|
sessionExpiry: {value:0}
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
@ -609,6 +610,7 @@
|
|||||||
default: !this.userProps ? 'none':'json',
|
default: !this.userProps ? 'none':'json',
|
||||||
types: [typedInputNoneOpt, 'json']
|
types: [typedInputNoneOpt, 'json']
|
||||||
});
|
});
|
||||||
|
$("#node-config-input-userProps").typedInput('value',this.userProps);
|
||||||
if (typeof this.keepalive === 'undefined') {
|
if (typeof this.keepalive === 'undefined') {
|
||||||
this.keepalive = 15;
|
this.keepalive = 15;
|
||||||
$("#node-config-input-keepalive").val(this.keepalive);
|
$("#node-config-input-keepalive").val(this.keepalive);
|
||||||
@ -718,6 +720,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (v5) {
|
if (v5) {
|
||||||
|
this.userProps = "";
|
||||||
|
const userPropsType = $("#node-config-input-userProps").typedInput("type");
|
||||||
|
if(userPropsType == "json") {
|
||||||
|
const userProps = $("#node-config-input-userProps").val();
|
||||||
|
if (userProps && typeof userProps === "string") {
|
||||||
|
this.userProps = userProps.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
this.birthMsg = saveV5Message("birth");
|
this.birthMsg = saveV5Message("birth");
|
||||||
this.closeMsg = saveV5Message("close");
|
this.closeMsg = saveV5Message("close");
|
||||||
this.willMsg = saveV5Message("will");
|
this.willMsg = saveV5Message("will");
|
||||||
|
@ -415,8 +415,12 @@ module.exports = function(RED) {
|
|||||||
setIfHasProperty(opts, node, "topicAliasMaximum", init);
|
setIfHasProperty(opts, node, "topicAliasMaximum", init);
|
||||||
setIfHasProperty(opts, node, "maximumPacketSize", init);
|
setIfHasProperty(opts, node, "maximumPacketSize", init);
|
||||||
setIfHasProperty(opts, node, "receiveMaximum", init);
|
setIfHasProperty(opts, node, "receiveMaximum", init);
|
||||||
setIfHasProperty(opts, node, "userProperties", init);//https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901116
|
//https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901116
|
||||||
setIfHasProperty(opts, node, "userPropertiesType", init);
|
if (hasProperty(opts, "userProperties")) {
|
||||||
|
node.userProperties = opts.userProperties;
|
||||||
|
} else if (hasProperty(opts, "userProps")) {
|
||||||
|
node.userProperties = opts.userProps;
|
||||||
|
}
|
||||||
|
|
||||||
function createLWT(topic, payload, qos, retain, v5opts, v5SubPropName) {
|
function createLWT(topic, payload, qos, retain, v5opts, v5SubPropName) {
|
||||||
let message = undefined;
|
let message = undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user