Merge branch 'master' into stop-start-flows

This commit is contained in:
Stephen McLaughlin 2022-06-09 22:29:09 +01:00 committed by GitHub
commit d83516584d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 385 additions and 348 deletions

View File

@ -907,7 +907,8 @@
"uknownNodes": "未知のノード",
"unusedSubflows": "未使用のサブフロー",
"hiddenFlows": "非表示のフロー",
"modifiedNodes": "修正したノードやフロー"
"modifiedNodes": "修正したノードやフロー",
"thisFlow": "現在のフロー"
}
},
"expressionEditor": {

View File

@ -17,7 +17,7 @@
"tip14": "[shift] を押しながらノードを [click] すると、接続された全てのノードを選択できます。",
"tip15": "[ctrl] を押しながらノードを [click] すると、選択/非選択を切り替えできます。",
"tip16": "{{core:show-previous-tab}} や {{core:show-next-tab}} で、タブの切り替えができます。",
"tip17": "ノードのプロティ設定画面にて {{core:confirm-edit-tray}} を押すと、変更を確定できます。また、 {{core:cancel-edit-tray}} を押すと、変更を取り消せます。",
"tip17": "ノードのプロティ設定画面にて {{core:confirm-edit-tray}} を押すと、変更を確定できます。また、 {{core:cancel-edit-tray}} を押すと、変更を取り消せます。",
"tip18": "ノードを選択し、 {{core:edit-selected-node}} を押すとプロパティ設定画面が表示されます。"
}
}

View File

@ -363,14 +363,22 @@ RED.library = (function() {
options.onconfirm(item);
}
});
var itemTools = $("<div>").css({position: "absolute",bottom:"6px",right:"8px"});
var itemTools = null;
if (options.folderTools) {
dirList.on('treelistselect', function(event, item) {
if (item.writable !== false && item.treeList) {
if (itemTools) {
itemTools.remove();
}
itemTools = $("<div>").css({position: "absolute",bottom:"6px",right:"8px"});
var menuButton = $('<button class="red-ui-button red-ui-button-small" type="button"><i class="fa fa-ellipsis-h"></i></button>')
.on("click", function(evt) {
evt.preventDefault();
evt.stopPropagation();
var elementPos = menuButton.offset();
var menuOptionMenu = RED.menu.init({id:"red-ui-library-browser-menu",
var menuOptionMenu
= RED.menu.init({id:"red-ui-library-browser-menu",
options: [
{id:"red-ui-library-browser-menu-addFolder",label:RED._("library.newFolder"), onselect: function() {
var defaultFolderName = "new-folder";
@ -460,9 +468,7 @@ RED.library = (function() {
}).show();
}).appendTo(itemTools);
if (options.folderTools) {
dirList.on('treelistselect', function(event, item) {
if (item.writable !== false && item.treeList) {
itemTools.appendTo(item.treeList.label);
}
});

View File

@ -526,6 +526,23 @@ RED.view = (function() {
nn.x = mousePos[0];
nn.y = mousePos[1];
var minX = nn.w/2 -5;
if (nn.x < minX) {
nn.x = minX;
}
var minY = nn.h/2 -5;
if (nn.y < minY) {
nn.y = minY;
}
var maxX = space_width -nn.w/2 +5;
if (nn.x > maxX) {
nn.x = maxX;
}
var maxY = space_height -nn.h +5;
if (nn.y > maxY) {
nn.y = maxY;
}
if (snapGrid) {
var gridOffset = RED.view.tools.calculateGridSnapOffsets(nn);
nn.x -= gridOffset.x;

View File

@ -131,6 +131,7 @@
width: 120px;
background-size: contain;
position: relative;
z-index: 4;
&:not(.red-ui-palette-node-config):not(.red-ui-palette-node-small):first-child {
margin-top: 15px;
}

View File

@ -109,9 +109,10 @@ module.exports = function(RED) {
if (!property) return;
if (valueType === "jsonata") {
if (p.exp) {
if (p.v) {
try {
var val = RED.util.evaluateJSONataExpression(p.exp, msg);
var exp = RED.util.prepareJSONataExpression(p.v, node);
var val = RED.util.evaluateJSONataExpression(exp, msg);
RED.util.setMessageProperty(msg, property, val, true);
}
catch (err) {

View File

@ -237,7 +237,7 @@
}).text(label).appendTo(encSel);
$("#node-input-filename").typedInput({
default: "msg",
types:[{ value: "str", label:"", icon:"red/images/typedInput/az.svg"}, "msg", "jsonata", "env"],
types: ["str", "msg", "jsonata", "env"],
typeField: $("#node-input-filenameType")
});
if(typeof node.filenameType == 'undefined') {
@ -342,7 +342,7 @@
}).text(label).appendTo(encSel);
$("#node-input-filename").typedInput({
default: "msg",
types:[{ value: "str", label:"", icon:"red/images/typedInput/az.svg"}, "msg", "jsonata", "env"],
types: ["str", "msg", "jsonata", "env"],
typeField: $("#node-input-filenameType")
});
if(typeof node.filenameType == 'undefined') {

2
packages/node_modules/@node-red/nodes/locales/en-US/messages.json vendored Executable file → Normal file
View File

@ -494,7 +494,6 @@
"invalid-action-alreadyconnected": "Disconnect from broker before connecting",
"invalid-action-badsubscription": "msg.topic is missing or invalid",
"invalid-client-id": "Missing Client ID"
}
},
"httpin": {
@ -646,7 +645,6 @@
"connection-closed": "connection closed from __host__:__port__",
"connections": "__count__ connection",
"connections_plural": "__count__ connections"
},
"errors": {
"connection-lost": "connection lost to __host__:__port__",

View File

@ -8,7 +8,6 @@
"httpStatic": "HTTP Static : __path__"
}
},
"server": {
"loading": "Loading palette nodes",
"palette-editor": {
@ -61,7 +60,6 @@
"function-required": "httpsRefreshInterval requires https property to be a function"
}
},
"api": {
"flows": {
"error-save": "Error saving flows: __message__",
@ -79,13 +77,11 @@
"error-enable": "Failed to enable node:"
}
},
"comms": {
"error": "Communication channel error: __message__",
"error-server": "Communication server error: __message__",
"error-send": "Communication send error: __message__"
},
"settings": {
"user-not-available": "Cannot save user settings: __message__",
"not-available": "Settings not available",
@ -150,7 +146,6 @@
}
}
},
"storage": {
"index": {
"forbidden-flow-name": "forbidden flow name"
@ -180,7 +175,6 @@
}
}
},
"context": {
"log-store-init": "Context store : '__name__' [__info__]",
"error-loading-module": "Error loading context store: __message__",
@ -195,5 +189,4 @@
"error-write": "Error writing context: __message__"
}
}
}

View File

@ -641,7 +641,12 @@ function evaluateNodeProperty(value, type, node, msg, callback) {
result = Date.now();
} else if (type === 'bin') {
var data = JSON.parse(value);
if (Array.isArray(data) || (typeof(data) === "string")) {
result = Buffer.from(data);
}
else {
throw createError("INVALID_BUFFER_DATA", "Not string or array");
}
} else if (type === 'msg' && msg) {
try {
result = getMessageProperty(msg,value);

View File

@ -906,6 +906,7 @@ describe('inject node', function() {
msg.should.have.property("str1", "1"); //injected prop
msg.should.have.property("num1", 1); //injected prop
msg.should.have.property("bool1", true); //injected prop
msg.should.have.property("jsonata1", "AB"); //injected prop
helper.clearFlows().then(function() {
done();
@ -919,6 +920,7 @@ describe('inject node', function() {
{p:"str1", v:"1", vt:"str"}, //new prop
{p:"num1", v:"1", vt:"num"}, //new prop
{p:"bool1", v:"true", vt:"bool"}, //new prop
{p:"jsonata1", v:'"A" & "B"', vt:"jsonata"}, //new prop
]})
.expect(200).end(function(err) {
if (err) {

View File

@ -388,6 +388,19 @@ describe("@node-red/util/util", function() {
result[0].should.eql(1);
result[1].should.eql(2);
});
it('throws an error if buffer data is not array or string', function (done) {
try {
var result = util.evaluateNodeProperty('12','bin');
done("should throw an error");
} catch (err) {
if (err.code === "INVALID_BUFFER_DATA") {
done();
}
else {
done("should throw an error");
}
}
});
it('returns msg property',function() {
var result = util.evaluateNodeProperty('foo.bar','msg',{},{foo:{bar:"123"}});
result.should.eql("123");