1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3571 from node-red/master

Pull master into dev
This commit is contained in:
Nick O'Leary 2022-05-03 09:36:32 +01:00 committed by GitHub
commit 65c7855afd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 8 deletions

View File

@ -212,6 +212,7 @@ $node-icon-background-color-opacity: 0.05;
$node-icon-border-color: #000; $node-icon-border-color: #000;
$node-icon-border-color-opacity: 0.1; $node-icon-border-color-opacity: 0.1;
$node-config-background: #f3f3f3;
$node-link-port-background: #eee; $node-link-port-background: #eee;

View File

@ -58,7 +58,7 @@ ul.red-ui-sidebar-node-config-list {
.red-ui-palette-icon-container { .red-ui-palette-icon-container {
font-size: 12px; font-size: 12px;
line-height: 30px; line-height: 30px;
background-color: $secondary-background-selected; background-color: $node-icon-background-color;
border-top-right-radius: 4px; border-top-right-radius: 4px;
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
a { a {
@ -67,10 +67,10 @@ ul.red-ui-sidebar-node-config-list {
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
color: $secondary-text-color; color: $node-port-label-color;
&:hover { &:hover {
text-decoration: none; text-decoration: none;
background: $secondary-background-hover; background: $node-port-background-hover;
} }
} }
} }
@ -78,7 +78,7 @@ ul.red-ui-sidebar-node-config-list {
.red-ui-palette-node-config { .red-ui-palette-node-config {
width: 160px; width: 160px;
height: 30px; height: 30px;
background: $primary-background; background: $node-config-background;
color: $primary-text-color; color: $primary-text-color;
cursor: pointer; cursor: pointer;
} }

View File

@ -16,7 +16,7 @@
.red-ui-typedInput-container { .red-ui-typedInput-container {
border: 1px solid $form-input-border-color; border: 1px solid $form-input-border-color;
border-radius: 4px; border-radius: 5px;
height: 34px; height: 34px;
line-height: 14px; line-height: 14px;
display: inline-flex; display: inline-flex;

View File

@ -512,6 +512,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: {
@ -641,6 +642,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);
@ -750,6 +752,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");

View File

@ -477,8 +477,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;
@ -812,6 +816,7 @@ module.exports = function(RED) {
} }
} }
}; };
node.disconnect = function (callback) { node.disconnect = function (callback) {
const _callback = function () { const _callback = function () {
if(node.connected || node.connecting) { if(node.connected || node.connecting) {
@ -994,7 +999,7 @@ module.exports = function(RED) {
node.client.removeAllListeners(); node.client.removeAllListeners();
} }
done(); done();
}, true); });
}); });
} }

View File

@ -112,6 +112,10 @@ if (parsedArgs.settings) {
// Consider compatibility for older versions // Consider compatibility for older versions
settingsFile = path.join(process.env.HOMEPATH,".node-red","settings.js"); settingsFile = path.join(process.env.HOMEPATH,".node-red","settings.js");
} else { } else {
if (!parsedArgs.userDir && !(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH)) {
console.log("Could not find user directory. Ensure $HOME is set for the current user, or use --userDir option")
process.exit(1)
}
var userDir = parsedArgs.userDir || path.join(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,".node-red"); var userDir = parsedArgs.userDir || path.join(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,".node-red");
var userSettingsFile = path.join(userDir,"settings.js"); var userSettingsFile = path.join(userDir,"settings.js");
if (fs.existsSync(userSettingsFile)) { if (fs.existsSync(userSettingsFile)) {