mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
69 Commits
add-tls-op
...
link-effec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1a706f811 | ||
|
|
c27dd336d9 | ||
|
|
5e9ff98c49 | ||
|
|
50cb074172 | ||
|
|
510a09ecba | ||
|
|
f86e743cce | ||
|
|
cb96fb735e | ||
|
|
459a52d31d | ||
|
|
44ef9a13d6 | ||
|
|
0bb3652a63 | ||
|
|
6a82d683a9 | ||
|
|
fad708e8de | ||
|
|
c6a38b8355 | ||
|
|
ee84eb666b | ||
|
|
6d2793cac6 | ||
|
|
86d518fc2e | ||
|
|
25dba1a6d5 | ||
|
|
af949c62c2 | ||
|
|
ea20342d76 | ||
|
|
7732d52583 | ||
|
|
c801bc5e6b | ||
|
|
ea43729063 | ||
|
|
e26bae8027 | ||
|
|
555f155cad | ||
|
|
f8c47f59bc | ||
|
|
f3997128b9 | ||
|
|
154a4e23dd | ||
|
|
52e4e0e569 | ||
|
|
30f2b96c68 | ||
|
|
58c94b7773 | ||
|
|
83203d5f5d | ||
|
|
f77d161643 | ||
|
|
6580b139c0 | ||
|
|
2743c7c6ac | ||
|
|
062f76214e | ||
|
|
ce98ed98a2 | ||
|
|
dce9d93f6c | ||
|
|
f7e35a6cbe | ||
|
|
931335220f | ||
|
|
3ce35a8a4b | ||
|
|
9ac4e5cf6a | ||
|
|
bd77d7eec3 | ||
|
|
b5e48aa509 | ||
|
|
b14c42b6a4 | ||
|
|
44616c6872 | ||
|
|
aaa2b4c3db | ||
|
|
8974d8e4df | ||
|
|
699063cbb0 | ||
|
|
e76000b713 | ||
|
|
332b372e31 | ||
|
|
cb3fcb7bfa | ||
|
|
bef641609e | ||
|
|
24b52f09df | ||
|
|
942b17b807 | ||
|
|
cf19d7f3ad | ||
|
|
ebd62a4112 | ||
|
|
9af7357ca4 | ||
|
|
0dbc35c252 | ||
|
|
828888490a | ||
|
|
91cb6ba73b | ||
|
|
4ee4d32b2e | ||
|
|
8df630a2f5 | ||
|
|
2cad42870e | ||
|
|
43651135f3 | ||
|
|
ecaf866613 | ||
|
|
5ea3329b36 | ||
|
|
7bb7149f4c | ||
|
|
5856d043ca | ||
|
|
a9b12e5172 |
@@ -146,7 +146,7 @@ function authenticateUserToken(req) {
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}).catch(reject);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -163,6 +163,9 @@ TokensStrategy.prototype.authenticate = function(req) {
|
||||
authenticateUserToken(req).then(user => {
|
||||
this.success(user,{scope:user.permissions});
|
||||
}).catch(err => {
|
||||
if (err) {
|
||||
log.trace("token authentication failure: "+err.stack?err.stack:err)
|
||||
}
|
||||
this.fail(401);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ function init(settings,_server,storage,runtimeAPI) {
|
||||
auth.getToken,
|
||||
auth.errorHandler
|
||||
);
|
||||
} else if (settings.adminAuth.tokens) {
|
||||
adminApp.use(passport.initialize());
|
||||
}
|
||||
adminApp.post("/auth/revoke",auth.needsPermission(""),auth.revoke,apiUtil.errorHandler);
|
||||
}
|
||||
|
||||
@@ -894,6 +894,8 @@
|
||||
"addTitle": "add an item"
|
||||
},
|
||||
"search": {
|
||||
"history": "Search history",
|
||||
"clear": "clear all",
|
||||
"empty": "No matches found",
|
||||
"addNode": "add a node..."
|
||||
},
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
"hideOtherFlows": "他のフローを非表示",
|
||||
"showAllFlows": "全てのフローを表示",
|
||||
"hideAllFlows": "全てのフローを非表示",
|
||||
"hiddenFlows": "__count__ 個の非表示のフロー一覧",
|
||||
"hiddenFlows_plural": "__count__ 個の非表示のフロー一覧",
|
||||
"showLastHiddenFlow": "最後に非表示にしたフローを表示",
|
||||
"listFlows": "フロー一覧",
|
||||
"listSubflows": "サブフロー一覧",
|
||||
@@ -669,7 +671,8 @@
|
||||
"unusedConfigNodes": "未使用の設定ノード",
|
||||
"invalidNodes": "不正なノード",
|
||||
"uknownNodes": "未知のノード",
|
||||
"unusedSubflows": "未使用のサブフロー"
|
||||
"unusedSubflows": "未使用のサブフロー",
|
||||
"hiddenFlows": "非表示のフロー"
|
||||
}
|
||||
},
|
||||
"help": {
|
||||
|
||||
@@ -684,6 +684,13 @@ RED.history = (function() {
|
||||
peek: function() {
|
||||
return undoHistory[undoHistory.length-1];
|
||||
},
|
||||
replace: function(ev) {
|
||||
if (undoHistory.length === 0) {
|
||||
RED.history.push(ev);
|
||||
} else {
|
||||
undoHistory[undoHistory.length-1] = ev;
|
||||
}
|
||||
},
|
||||
clear: function() {
|
||||
undoHistory = [];
|
||||
redoHistory = [];
|
||||
|
||||
@@ -38,7 +38,9 @@
|
||||
},
|
||||
"red-ui-workspace": {
|
||||
"backspace": "core:delete-selection",
|
||||
"ctrl-backspace": "core:delete-selection-and-reconnect",
|
||||
"delete": "core:delete-selection",
|
||||
"ctrl-delete": "core:delete-selection-and-reconnect",
|
||||
"enter": "core:edit-selected-node",
|
||||
"ctrl-enter": "core:go-to-selection",
|
||||
"ctrl-c": "core:copy-selection-to-internal-clipboard",
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
**/
|
||||
RED.nodes = (function() {
|
||||
|
||||
var PORT_TYPE_INPUT = 1;
|
||||
var PORT_TYPE_OUTPUT = 0;
|
||||
|
||||
var node_defs = {};
|
||||
var linkTabMap = {};
|
||||
|
||||
@@ -591,7 +594,9 @@ RED.nodes = (function() {
|
||||
}
|
||||
allNodes.addNode(n);
|
||||
if (!nodeLinks[n.id]) {
|
||||
nodeLinks[n.id] = {in:[],out:[]};
|
||||
nodeLinks[n.id] = {
|
||||
inCount:[],outCount:[],in:[],out:[]
|
||||
};
|
||||
}
|
||||
}
|
||||
RED.events.emit('nodes:add',n);
|
||||
@@ -601,15 +606,19 @@ RED.nodes = (function() {
|
||||
if (l.source) {
|
||||
// Possible the node hasn't been added yet
|
||||
if (!nodeLinks[l.source.id]) {
|
||||
nodeLinks[l.source.id] = {in:[],out:[]};
|
||||
nodeLinks[l.source.id] = {inCount:[],outCount:[],in:[],out:[]};
|
||||
}
|
||||
nodeLinks[l.source.id].out.push(l);
|
||||
nodeLinks[l.source.id].outCount[l.sourcePort] = (nodeLinks[l.source.id].outCount[l.sourcePort] || 0) + 1
|
||||
l.source.dirty = true;
|
||||
}
|
||||
if (l.target) {
|
||||
if (!nodeLinks[l.target.id]) {
|
||||
nodeLinks[l.target.id] = {in:[],out:[]};
|
||||
nodeLinks[l.target.id] = {inCount:[],outCount:[],in:[],out:[]};
|
||||
}
|
||||
nodeLinks[l.target.id].in.push(l);
|
||||
nodeLinks[l.target.id].inCount[0] = (nodeLinks[l.target.id].inCount[0] || 0) + 1
|
||||
l.target.dirty = true;
|
||||
}
|
||||
if (l.source.z === l.target.z && linkTabMap[l.source.z]) {
|
||||
linkTabMap[l.source.z].push(l);
|
||||
@@ -758,15 +767,19 @@ RED.nodes = (function() {
|
||||
if (index != -1) {
|
||||
links.splice(index,1);
|
||||
if (l.source && nodeLinks[l.source.id]) {
|
||||
l.source.dirty = true;
|
||||
var sIndex = nodeLinks[l.source.id].out.indexOf(l)
|
||||
if (sIndex !== -1) {
|
||||
nodeLinks[l.source.id].out.splice(sIndex,1)
|
||||
nodeLinks[l.source.id].outCount[l.sourcePort]--
|
||||
}
|
||||
}
|
||||
if (l.target && nodeLinks[l.target.id]) {
|
||||
l.target.dirty = true;
|
||||
var tIndex = nodeLinks[l.target.id].in.indexOf(l)
|
||||
if (tIndex !== -1) {
|
||||
nodeLinks[l.target.id].in.splice(tIndex,1)
|
||||
nodeLinks[l.target.id].inCount[0]--
|
||||
}
|
||||
}
|
||||
if (l.source.z === l.target.z && linkTabMap[l.source.z]) {
|
||||
@@ -2458,6 +2471,144 @@ RED.nodes = (function() {
|
||||
return helpContent;
|
||||
}
|
||||
|
||||
function getNodeIslands(nodes) {
|
||||
var selectedNodes = new Set(nodes);
|
||||
// Maps node => island index
|
||||
var nodeToIslandIndex = new Map();
|
||||
// Maps island index => [nodes in island]
|
||||
var islandIndexToNodes = new Map();
|
||||
var internalLinks = new Set();
|
||||
nodes.forEach((node, index) => {
|
||||
nodeToIslandIndex.set(node,index);
|
||||
islandIndexToNodes.set(index, [node]);
|
||||
var inboundLinks = RED.nodes.getNodeLinks(node, PORT_TYPE_INPUT);
|
||||
var outboundLinks = RED.nodes.getNodeLinks(node, PORT_TYPE_OUTPUT);
|
||||
inboundLinks.forEach(l => {
|
||||
if (selectedNodes.has(l.source)) {
|
||||
internalLinks.add(l)
|
||||
}
|
||||
})
|
||||
outboundLinks.forEach(l => {
|
||||
if (selectedNodes.has(l.target)) {
|
||||
internalLinks.add(l)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
internalLinks.forEach(l => {
|
||||
let source = l.source;
|
||||
let target = l.target;
|
||||
if (nodeToIslandIndex.get(source) !== nodeToIslandIndex.get(target)) {
|
||||
let sourceIsland = nodeToIslandIndex.get(source);
|
||||
let islandToMove = nodeToIslandIndex.get(target);
|
||||
let nodesToMove = islandIndexToNodes.get(islandToMove);
|
||||
nodesToMove.forEach(n => {
|
||||
nodeToIslandIndex.set(n,sourceIsland);
|
||||
islandIndexToNodes.get(sourceIsland).push(n);
|
||||
})
|
||||
islandIndexToNodes.delete(islandToMove);
|
||||
}
|
||||
})
|
||||
const result = [];
|
||||
islandIndexToNodes.forEach((nodes,index) => {
|
||||
result.push(nodes);
|
||||
})
|
||||
return result;
|
||||
}
|
||||
|
||||
function detachNodes(nodes) {
|
||||
let allSelectedNodes = [];
|
||||
nodes.forEach(node => {
|
||||
if (node.type === 'group') {
|
||||
let groupNodes = RED.group.getNodes(node,true,true);
|
||||
allSelectedNodes = allSelectedNodes.concat(groupNodes);
|
||||
} else {
|
||||
allSelectedNodes.push(node);
|
||||
}
|
||||
})
|
||||
if (allSelectedNodes.length > 0 ) {
|
||||
const nodeIslands = RED.nodes.getNodeIslands(allSelectedNodes);
|
||||
let removedLinks = [];
|
||||
let newLinks = [];
|
||||
let createdLinkIds = new Set();
|
||||
|
||||
nodeIslands.forEach(nodes => {
|
||||
let selectedNodes = new Set(nodes);
|
||||
let allInboundLinks = [];
|
||||
let allOutboundLinks = [];
|
||||
// Identify links that enter or exit this island of nodes
|
||||
nodes.forEach(node => {
|
||||
var inboundLinks = RED.nodes.getNodeLinks(node, PORT_TYPE_INPUT);
|
||||
var outboundLinks = RED.nodes.getNodeLinks(node, PORT_TYPE_OUTPUT);
|
||||
inboundLinks.forEach(l => {
|
||||
if (!selectedNodes.has(l.source)) {
|
||||
allInboundLinks.push(l)
|
||||
}
|
||||
})
|
||||
outboundLinks.forEach(l => {
|
||||
if (!selectedNodes.has(l.target)) {
|
||||
allOutboundLinks.push(l)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
// Identify the links to restore
|
||||
allInboundLinks.forEach(inLink => {
|
||||
// For Each inbound link,
|
||||
// - get source node.
|
||||
// - trace through to all outbound links
|
||||
let sourceNode = inLink.source;
|
||||
let targetNodes = new Set();
|
||||
let visited = new Set();
|
||||
let stack = [inLink.target];
|
||||
while (stack.length > 0) {
|
||||
let node = stack.pop(stack);
|
||||
visited.add(node)
|
||||
let links = RED.nodes.getNodeLinks(node, PORT_TYPE_OUTPUT);
|
||||
links.forEach(l => {
|
||||
if (visited.has(l.target)) {
|
||||
return
|
||||
}
|
||||
visited.add(l.target);
|
||||
if (selectedNodes.has(l.target)) {
|
||||
// internal link
|
||||
stack.push(l.target)
|
||||
} else {
|
||||
targetNodes.add(l.target)
|
||||
}
|
||||
})
|
||||
}
|
||||
targetNodes.forEach(target => {
|
||||
let linkId = `${sourceNode.id}[${inLink.sourcePort}] -> ${target.id}`
|
||||
if (!createdLinkIds.has(linkId)) {
|
||||
createdLinkIds.add(linkId);
|
||||
let link = {
|
||||
source: sourceNode,
|
||||
sourcePort: inLink.sourcePort,
|
||||
target: target
|
||||
}
|
||||
let existingLinks = RED.nodes.filterLinks(link)
|
||||
if (existingLinks.length === 0) {
|
||||
newLinks.push(link);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 2. delete all those links
|
||||
allInboundLinks.forEach(l => { RED.nodes.removeLink(l); removedLinks.push(l)})
|
||||
allOutboundLinks.forEach(l => { RED.nodes.removeLink(l); removedLinks.push(l)})
|
||||
})
|
||||
|
||||
newLinks.forEach(l => RED.nodes.addLink(l));
|
||||
return {
|
||||
newLinks,
|
||||
removedLinks
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
RED.events.on("registry:node-type-added",function(type) {
|
||||
@@ -2539,7 +2690,7 @@ RED.nodes = (function() {
|
||||
add: addNode,
|
||||
remove: removeNode,
|
||||
clear: clear,
|
||||
|
||||
detachNodes: detachNodes,
|
||||
moveNodesForwards: moveNodesForwards,
|
||||
moveNodesBackwards: moveNodesBackwards,
|
||||
moveNodesToFront: moveNodesToFront,
|
||||
@@ -2551,7 +2702,34 @@ RED.nodes = (function() {
|
||||
|
||||
addLink: addLink,
|
||||
removeLink: removeLink,
|
||||
|
||||
getNodeLinks: function(id, portType) {
|
||||
if (typeof id !== 'string') {
|
||||
id = id.id;
|
||||
}
|
||||
if (nodeLinks[id]) {
|
||||
if (portType === 1) {
|
||||
// Return cloned arrays so they can be safely modified by caller
|
||||
return [].concat(nodeLinks[id].in)
|
||||
} else {
|
||||
return [].concat(nodeLinks[id].out)
|
||||
}
|
||||
}
|
||||
return [];
|
||||
},
|
||||
getNodeLinkCount: function(id,portType,index) {
|
||||
// We *could* just let callers use `getNodeLinks` and get the
|
||||
// the length for themselves. However, that function creates
|
||||
// a clone of the array - which is needless work if all you
|
||||
// want is the length
|
||||
if (nodeLinks[id]) {
|
||||
if (portType === 1) {
|
||||
return nodeLinks[id].inCount[index] || 0
|
||||
} else {
|
||||
return nodeLinks[id].outCount[index] || 0
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
addWorkspace: addWorkspace,
|
||||
removeWorkspace: removeWorkspace,
|
||||
getWorkspaceOrder: function() { return workspacesOrder },
|
||||
@@ -2625,6 +2803,7 @@ RED.nodes = (function() {
|
||||
getAllFlowNodes: getAllFlowNodes,
|
||||
getAllUpstreamNodes: getAllUpstreamNodes,
|
||||
getAllDownstreamNodes: getAllDownstreamNodes,
|
||||
getNodeIslands: getNodeIslands,
|
||||
createExportableNodeSet: createExportableNodeSet,
|
||||
createCompleteNodeSet: createCompleteNodeSet,
|
||||
updateConfigNodeUsers: updateConfigNodeUsers,
|
||||
|
||||
@@ -71,6 +71,7 @@ RED.clipboard = (function() {
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
RED.view.focus();
|
||||
}
|
||||
},
|
||||
{ // red-ui-clipboard-dialog-download
|
||||
@@ -81,6 +82,7 @@ RED.clipboard = (function() {
|
||||
var data = $("#red-ui-clipboard-dialog-export-text").val();
|
||||
downloadData("flows.json", data);
|
||||
$( this ).dialog( "close" );
|
||||
RED.view.focus();
|
||||
}
|
||||
},
|
||||
{ // red-ui-clipboard-dialog-export
|
||||
@@ -95,6 +97,7 @@ RED.clipboard = (function() {
|
||||
$( this ).dialog( "close" );
|
||||
copyText(flowData);
|
||||
RED.notify(RED._("clipboard.nodesExported"),{id:"clipboard"});
|
||||
RED.view.focus();
|
||||
} else {
|
||||
var flowToExport = $("#red-ui-clipboard-dialog-export-text").val();
|
||||
var selectedPath = activeLibraries[activeTab].getSelected();
|
||||
@@ -110,6 +113,7 @@ RED.clipboard = (function() {
|
||||
contentType: "application/json; charset=utf-8"
|
||||
}).done(function() {
|
||||
$(dialog).dialog( "close" );
|
||||
RED.view.focus();
|
||||
RED.notify(RED._("library.exportedToLibrary"),"success");
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
if (xhr.status === 401) {
|
||||
@@ -171,6 +175,7 @@ RED.clipboard = (function() {
|
||||
}
|
||||
}
|
||||
$( this ).dialog( "close" );
|
||||
RED.view.focus();
|
||||
}
|
||||
},
|
||||
{ // red-ui-clipboard-dialog-import-conflict
|
||||
@@ -203,6 +208,7 @@ RED.clipboard = (function() {
|
||||
// console.table(pendingImportConfig.importNodes.map(function(n) { return {id:n.id,type:n.type,result:importMap[n.id]}}))
|
||||
RED.view.importNodes(newNodes, pendingImportConfig.importOptions);
|
||||
$( this ).dialog( "close" );
|
||||
RED.view.focus();
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -578,7 +578,7 @@ RED.tabs = (function() {
|
||||
|
||||
function findPreviousVisibleTab(li) {
|
||||
if (!li) {
|
||||
li = ul.find("li.active").parent();
|
||||
li = ul.find("li.active");
|
||||
}
|
||||
var previous = li.prev();
|
||||
while(previous.length > 0 && previous.hasClass("hide-tab")) {
|
||||
@@ -588,9 +588,9 @@ RED.tabs = (function() {
|
||||
}
|
||||
function findNextVisibleTab(li) {
|
||||
if (!li) {
|
||||
li = ul.find("li.active").parent();
|
||||
li = ul.find("li.active");
|
||||
}
|
||||
var next = ul.find("li.active").next();
|
||||
var next = li.next();
|
||||
while(next.length > 0 && next.hasClass("hide-tab")) {
|
||||
next = next.next();
|
||||
}
|
||||
|
||||
@@ -333,6 +333,16 @@ RED.deploy = (function() {
|
||||
var unknownNodes = [];
|
||||
var invalidNodes = [];
|
||||
|
||||
RED.nodes.eachConfig(function(node) {
|
||||
if (!node.valid && !node.d) {
|
||||
invalidNodes.push(getNodeInfo(node));
|
||||
}
|
||||
if (node.type === "unknown") {
|
||||
if (unknownNodes.indexOf(node.name) == -1) {
|
||||
unknownNodes.push(node.name);
|
||||
}
|
||||
}
|
||||
});
|
||||
RED.nodes.eachNode(function(node) {
|
||||
if (!node.valid && !node.d) {
|
||||
invalidNodes.push(getNodeInfo(node));
|
||||
|
||||
@@ -81,7 +81,8 @@
|
||||
clearTimeout: true,
|
||||
setInterval: true,
|
||||
clearInterval: true
|
||||
}
|
||||
},
|
||||
extraLibs: options.extraLibs
|
||||
});
|
||||
if (options.cursor) {
|
||||
expressionEditor.gotoLine(options.cursor.row+1,options.cursor.column,false);
|
||||
|
||||
@@ -55,7 +55,9 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!isSameObj(old_env, new_env)) {
|
||||
if (!old_env && new_env.length === 0) {
|
||||
delete node.env;
|
||||
} else if (!isSameObj(old_env, new_env)) {
|
||||
editState.changes.env = node.env;
|
||||
if (new_env.length === 0) {
|
||||
delete node.env;
|
||||
|
||||
@@ -590,12 +590,14 @@ RED.group = (function() {
|
||||
markDirty(group);
|
||||
}
|
||||
|
||||
function getNodes(group,recursive) {
|
||||
function getNodes(group,recursive,excludeGroup) {
|
||||
var nodes = [];
|
||||
group.nodes.forEach(function(n) {
|
||||
nodes.push(n);
|
||||
if (n.type !== 'group' || !excludeGroup) {
|
||||
nodes.push(n);
|
||||
}
|
||||
if (recursive && n.type === 'group') {
|
||||
nodes = nodes.concat(getNodes(n,recursive))
|
||||
nodes = nodes.concat(getNodes(n,recursive,excludeGroup))
|
||||
}
|
||||
})
|
||||
return nodes;
|
||||
|
||||
@@ -22,6 +22,7 @@ RED.search = (function() {
|
||||
var selected = -1;
|
||||
var visible = false;
|
||||
|
||||
var searchHistory = [];
|
||||
var index = {};
|
||||
var currentResults = [];
|
||||
var previousActiveElement;
|
||||
@@ -205,6 +206,20 @@ RED.search = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
function populateSearchHistory() {
|
||||
if (searchHistory.length > 0) {
|
||||
searchResults.editableList('addItem',{
|
||||
historyHeader: true
|
||||
});
|
||||
searchHistory.forEach(function(entry) {
|
||||
searchResults.editableList('addItem',{
|
||||
history: true,
|
||||
value: entry
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
function createDialog() {
|
||||
dialog = $("<div>",{id:"red-ui-search",class:"red-ui-search"}).appendTo("#red-ui-main-container");
|
||||
var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(dialog);
|
||||
@@ -213,7 +228,12 @@ RED.search = (function() {
|
||||
change: function() {
|
||||
searchResults.editableList('empty');
|
||||
selected = -1;
|
||||
currentResults = search($(this).val());
|
||||
var value = $(this).val();
|
||||
if (value === "") {
|
||||
populateSearchHistory();
|
||||
return;
|
||||
}
|
||||
currentResults = search(value);
|
||||
if (currentResults.length > 0) {
|
||||
for (i=0;i<Math.min(currentResults.length,25);i++) {
|
||||
searchResults.editableList('addItem',currentResults[i])
|
||||
@@ -285,7 +305,12 @@ RED.search = (function() {
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} if ($(children[selected]).hasClass("red-ui-search-history")) {
|
||||
var object = $(children[selected]).find(".red-ui-editableList-item-content").data('data');
|
||||
if (object) {
|
||||
searchInput.searchBox('value',object.value)
|
||||
}
|
||||
} else if (!$(children[selected]).hasClass("red-ui-search-historyHeader")) {
|
||||
if (currentResults.length > 0) {
|
||||
reveal(currentResults[Math.max(0,selected)].node);
|
||||
}
|
||||
@@ -301,7 +326,32 @@ RED.search = (function() {
|
||||
addItem: function(container,i,object) {
|
||||
var node = object.node;
|
||||
var div;
|
||||
if (object.more) {
|
||||
if (object.historyHeader) {
|
||||
container.parent().addClass("red-ui-search-historyHeader")
|
||||
$('<div>',{class:"red-ui-search-empty"}).text(RED._("search.history")).appendTo(container);
|
||||
$('<button type="button" class="red-ui-button red-ui-button-small"></button>').text(RED._("search.clear")).appendTo(container).on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
searchHistory = [];
|
||||
searchResults.editableList('empty');
|
||||
});
|
||||
} else if (object.history) {
|
||||
container.parent().addClass("red-ui-search-history")
|
||||
div = $('<a>',{href:'#',class:"red-ui-search-result"}).appendTo(container);
|
||||
div.text(object.value);
|
||||
div.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
searchInput.searchBox('value',object.value)
|
||||
searchInput.focus();
|
||||
})
|
||||
$('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-remove"></i></button>').appendTo(container).on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
var index = searchHistory.indexOf(object.value);
|
||||
searchHistory.splice(index,1);
|
||||
searchResults.editableList('removeItem', object);
|
||||
});
|
||||
|
||||
|
||||
} else if (object.more) {
|
||||
container.parent().addClass("red-ui-search-more")
|
||||
div = $('<a>',{href:'#',class:"red-ui-search-result red-ui-search-empty"}).appendTo(container);
|
||||
div.text(RED._("palette.editor.more",{count:object.more.results.length-object.more.start}));
|
||||
@@ -356,6 +406,12 @@ RED.search = (function() {
|
||||
}
|
||||
|
||||
function reveal(node) {
|
||||
var searchVal = searchInput.val();
|
||||
var existingIndex = searchHistory.indexOf(searchVal);
|
||||
if (existingIndex > -1) {
|
||||
searchHistory.splice(existingIndex,1);
|
||||
}
|
||||
searchHistory.unshift(searchInput.val());
|
||||
hide();
|
||||
RED.view.reveal(node.id);
|
||||
}
|
||||
@@ -374,9 +430,14 @@ RED.search = (function() {
|
||||
|
||||
if (dialog === null) {
|
||||
createDialog();
|
||||
} else {
|
||||
searchResults.editableList('empty');
|
||||
}
|
||||
dialog.slideDown(300);
|
||||
searchInput.searchBox('value',v)
|
||||
if (!v || v === "") {
|
||||
populateSearchHistory();
|
||||
}
|
||||
RED.events.emit("search:open");
|
||||
visible = true;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,7 @@ RED.state = {
|
||||
PANNING: 10,
|
||||
SELECTING_NODE: 11,
|
||||
GROUP_DRAGGING: 12,
|
||||
GROUP_RESIZE: 13
|
||||
GROUP_RESIZE: 13,
|
||||
DETACHED_DRAGGING: 14,
|
||||
SLICING: 15
|
||||
}
|
||||
|
||||
@@ -725,6 +725,90 @@ RED.view.tools = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function wireSeriesOfNodes() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
if (selection.nodes.length > 1) {
|
||||
var i = 0;
|
||||
var newLinks = [];
|
||||
while (i < selection.nodes.length - 1) {
|
||||
var nodeA = selection.nodes[i];
|
||||
var nodeB = selection.nodes[i+1];
|
||||
if (nodeA.outputs > 0 && nodeB.inputs > 0) {
|
||||
var existingLinks = RED.nodes.filterLinks({
|
||||
source: nodeA,
|
||||
target: nodeB,
|
||||
sourcePort: 0
|
||||
})
|
||||
if (existingLinks.length === 0) {
|
||||
var newLink = {
|
||||
source: nodeA,
|
||||
target: nodeB,
|
||||
sourcePort: 0
|
||||
}
|
||||
RED.nodes.addLink(newLink);
|
||||
newLinks.push(newLink);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (newLinks.length > 0) {
|
||||
RED.history.push({
|
||||
t: 'add',
|
||||
links: newLinks,
|
||||
dirty: RED.nodes.dirty()
|
||||
})
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wireNodeToMultiple() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
if (selection.nodes.length > 1) {
|
||||
var sourceNode = selection.nodes[0];
|
||||
if (sourceNode.outputs === 0) {
|
||||
return;
|
||||
}
|
||||
var i = 1;
|
||||
var newLinks = [];
|
||||
while (i < selection.nodes.length) {
|
||||
var targetNode = selection.nodes[i];
|
||||
if (targetNode.inputs > 0) {
|
||||
var existingLinks = RED.nodes.filterLinks({
|
||||
source: sourceNode,
|
||||
target: targetNode,
|
||||
sourcePort: Math.min(sourceNode.outputs-1,i-1)
|
||||
})
|
||||
if (existingLinks.length === 0) {
|
||||
var newLink = {
|
||||
source: sourceNode,
|
||||
target: targetNode,
|
||||
sourcePort: Math.min(sourceNode.outputs-1,i-1)
|
||||
}
|
||||
RED.nodes.addLink(newLink);
|
||||
newLinks.push(newLink);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (newLinks.length > 0) {
|
||||
RED.history.push({
|
||||
t: 'add',
|
||||
links: newLinks,
|
||||
dirty: RED.nodes.dirty()
|
||||
})
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
RED.actions.add("core:show-selected-node-labels", function() { setSelectedNodeLabelState(true); })
|
||||
@@ -783,7 +867,8 @@ RED.view.tools = (function() {
|
||||
RED.actions.add("core:distribute-selection-horizontally", function() { distributeSelection('h') })
|
||||
RED.actions.add("core:distribute-selection-vertically", function() { distributeSelection('v') })
|
||||
|
||||
|
||||
RED.actions.add("core:wire-series-of-nodes", function() { wireSeriesOfNodes() })
|
||||
RED.actions.add("core:wire-node-to-multiple", function() { wireNodeToMultiple() })
|
||||
|
||||
// RED.actions.add("core:add-node", function() { addNode() })
|
||||
},
|
||||
|
||||
@@ -37,6 +37,8 @@ RED.view = (function() {
|
||||
node_height = 30,
|
||||
dblClickInterval = 650;
|
||||
|
||||
var ARROW_HEADS = false;
|
||||
|
||||
var touchLongPressTimeout = 1000,
|
||||
startTouchDistance = 0,
|
||||
startTouchCenter = [],
|
||||
@@ -63,7 +65,6 @@ RED.view = (function() {
|
||||
var activeGroups = [];
|
||||
var dirtyGroups = {};
|
||||
|
||||
var selected_link = null;
|
||||
var mousedown_link = null;
|
||||
var mousedown_node = null;
|
||||
var mousedown_group = null;
|
||||
@@ -75,6 +76,8 @@ RED.view = (function() {
|
||||
var mouse_mode = 0;
|
||||
var mousedown_group_handle = null;
|
||||
var lasso = null;
|
||||
var slicePath = null;
|
||||
var slicePathLast = null;
|
||||
var ghostNode = null;
|
||||
var showStatus = false;
|
||||
var lastClickNode = null;
|
||||
@@ -129,6 +132,14 @@ RED.view = (function() {
|
||||
if (!setIds.has(node.id)) {
|
||||
set.push({n:node});
|
||||
setIds.add(node.id);
|
||||
var links = RED.nodes.getNodeLinks(node.id,PORT_TYPE_INPUT).concat(RED.nodes.getNodeLinks(node.id,PORT_TYPE_OUTPUT))
|
||||
for (var i=0,l=links.length;i<l;i++) {
|
||||
var link = links[i]
|
||||
if (link.source === node && setIds.has(link.target.id) ||
|
||||
link.target === node && setIds.has(link.source.id)) {
|
||||
selectedLinks.add(link)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -145,6 +156,10 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
var links = RED.nodes.getNodeLinks(node.id,PORT_TYPE_INPUT).concat(RED.nodes.getNodeLinks(node.id,PORT_TYPE_OUTPUT))
|
||||
for (var i=0,l=links.length;i<l;i++) {
|
||||
selectedLinks.remove(links[i]);
|
||||
}
|
||||
}
|
||||
},
|
||||
clear: function() {
|
||||
@@ -159,6 +174,31 @@ RED.view = (function() {
|
||||
return api;
|
||||
})();
|
||||
|
||||
var selectedLinks = (function() {
|
||||
var links = new Set();
|
||||
return {
|
||||
add: function(link) {
|
||||
links.add(link);
|
||||
link.selected = true;
|
||||
},
|
||||
remove: function(link) {
|
||||
links.delete(link);
|
||||
link.selected = false;
|
||||
},
|
||||
clear: function() {
|
||||
links.forEach(function(link) { link.selected = false })
|
||||
links.clear();
|
||||
},
|
||||
length: function() {
|
||||
return links.size;
|
||||
},
|
||||
forEach: function(func) { links.forEach(func) },
|
||||
has: function(link) { return links.has(link) },
|
||||
toArray: function() { return Array.from(links) }
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
chart = $("#red-ui-workspace-chart");
|
||||
@@ -193,6 +233,12 @@ RED.view = (function() {
|
||||
}
|
||||
} else if (mouse_mode === RED.state.PANNING && d3.event.buttons !== 4) {
|
||||
resetMouseVars();
|
||||
} else if (slicePath) {
|
||||
if (d3.event.buttons !== 2) {
|
||||
slicePath.remove();
|
||||
slicePath = null;
|
||||
resetMouseVars()
|
||||
}
|
||||
}
|
||||
})
|
||||
.on("touchend", function() {
|
||||
@@ -412,26 +458,56 @@ RED.view = (function() {
|
||||
var historyEvent = result.historyEvent;
|
||||
var nn = result.node;
|
||||
|
||||
RED.nodes.add(nn);
|
||||
|
||||
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
|
||||
if (showLabel !== undefined && (nn._def.hasOwnProperty("showLabel")?nn._def.showLabel:true) && !nn._def.defaults.hasOwnProperty("l")) {
|
||||
nn.l = showLabel;
|
||||
}
|
||||
|
||||
var helperOffset = d3.touches(ui.helper.get(0))[0]||d3.mouse(ui.helper.get(0));
|
||||
var helperWidth = ui.helper.width();
|
||||
var helperHeight = ui.helper.height();
|
||||
var mousePos = d3.touches(this)[0]||d3.mouse(this);
|
||||
|
||||
mousePos[1] += this.scrollTop + ((nn.h/2)-helperOffset[1]);
|
||||
mousePos[0] += this.scrollLeft + ((nn.w/2)-helperOffset[0]);
|
||||
try {
|
||||
var isLink = (nn.type === "link in" || nn.type === "link out")
|
||||
var hideLabel = nn.hasOwnProperty('l')?!nn.l : isLink;
|
||||
|
||||
var label = RED.utils.getNodeLabel(nn, nn.type);
|
||||
var labelParts = getLabelParts(label, "red-ui-flow-node-label");
|
||||
if (hideLabel) {
|
||||
nn.w = node_height;
|
||||
nn.h = Math.max(node_height,(nn.outputs || 0) * 15);
|
||||
} else {
|
||||
nn.w = Math.max(node_width,20*(Math.ceil((labelParts.width+50+(nn._def.inputs>0?7:0))/20)) );
|
||||
nn.h = Math.max(6+24*labelParts.lines.length,(nn.outputs || 0) * 15, 30);
|
||||
}
|
||||
} catch(err) {
|
||||
}
|
||||
|
||||
mousePos[1] += this.scrollTop + ((helperHeight/2)-helperOffset[1]);
|
||||
mousePos[0] += this.scrollLeft + ((helperWidth/2)-helperOffset[0]);
|
||||
mousePos[1] /= scaleFactor;
|
||||
mousePos[0] /= scaleFactor;
|
||||
|
||||
if (snapGrid) {
|
||||
mousePos[0] = gridSize*(Math.ceil(mousePos[0]/gridSize));
|
||||
mousePos[1] = gridSize*(Math.ceil(mousePos[1]/gridSize));
|
||||
}
|
||||
nn.x = mousePos[0];
|
||||
nn.y = mousePos[1];
|
||||
|
||||
if (snapGrid) {
|
||||
var gridOffset = [0,0];
|
||||
var offsetLeft = nn.x-(gridSize*Math.round((nn.x-nn.w/2)/gridSize)+nn.w/2);
|
||||
var offsetRight = nn.x-(gridSize*Math.round((nn.x+nn.w/2)/gridSize)-nn.w/2);
|
||||
if (Math.abs(offsetLeft) < Math.abs(offsetRight)) {
|
||||
gridOffset[0] = offsetLeft
|
||||
} else {
|
||||
gridOffset[0] = offsetRight
|
||||
}
|
||||
gridOffset[1] = nn.y-(gridSize*Math.round(nn.y/gridSize));
|
||||
nn.x -= gridOffset[0];
|
||||
nn.y -= gridOffset[1];
|
||||
}
|
||||
|
||||
var spliceLink = $(ui.helper).data("splice");
|
||||
if (spliceLink) {
|
||||
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp/showQuickAddDialog
|
||||
@@ -452,7 +528,6 @@ RED.view = (function() {
|
||||
historyEvent.removedLinks = [spliceLink];
|
||||
}
|
||||
|
||||
RED.nodes.add(nn);
|
||||
|
||||
var group = $(ui.helper).data("group");
|
||||
if (group) {
|
||||
@@ -502,6 +577,8 @@ RED.view = (function() {
|
||||
RED.actions.add("core:cut-selection-to-internal-clipboard",function(){copySelection();deleteSelection();});
|
||||
RED.actions.add("core:paste-from-internal-clipboard",function(){importNodes(clipboard,{generateIds: true});});
|
||||
|
||||
RED.actions.add("core:detach-selected-nodes", function() { detachSelectedNodes() })
|
||||
|
||||
RED.events.on("view:selection-changed", function(selection) {
|
||||
var hasSelection = (selection.nodes && selection.nodes.length > 0);
|
||||
var hasMultipleSelection = hasSelection && selection.nodes.length > 1;
|
||||
@@ -524,6 +601,7 @@ RED.view = (function() {
|
||||
})
|
||||
|
||||
RED.actions.add("core:delete-selection",deleteSelection);
|
||||
RED.actions.add("core:delete-selection-and-reconnect",function() { deleteSelection(true) });
|
||||
RED.actions.add("core:edit-selected-node",editSelection);
|
||||
RED.actions.add("core:go-to-selection",function() {
|
||||
if (movingSet.length() > 0) {
|
||||
@@ -759,8 +837,9 @@ RED.view = (function() {
|
||||
} else {
|
||||
scale = 0.4-0.2*(Math.max(0,(node_width-Math.min(Math.abs(dx),Math.abs(dy)))/node_width));
|
||||
}
|
||||
var result;
|
||||
if (dx*sc > 0) {
|
||||
return "M "+origX+" "+origY+
|
||||
result = "M "+origX+" "+origY+
|
||||
" C "+(origX+sc*(node_width*scale))+" "+(origY+scaleY*node_height)+" "+
|
||||
(destX-sc*(scale)*node_width)+" "+(destY-scaleY*node_height)+" "+
|
||||
destX+" "+destY
|
||||
@@ -801,7 +880,7 @@ RED.view = (function() {
|
||||
}
|
||||
cp[2][0] = topX;
|
||||
}
|
||||
return "M "+origX+" "+origY+
|
||||
result = "M "+origX+" "+origY+
|
||||
" C "+
|
||||
cp[0][0]+" "+cp[0][1]+" "+
|
||||
cp[1][0]+" "+cp[1][1]+" "+
|
||||
@@ -816,6 +895,7 @@ RED.view = (function() {
|
||||
cp[4][0]+" "+cp[4][1]+" "+
|
||||
destX+" "+destY
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function addNode(type,x,y) {
|
||||
@@ -909,7 +989,7 @@ RED.view = (function() {
|
||||
return;
|
||||
}
|
||||
if (!mousedown_node && !mousedown_link && !mousedown_group) {
|
||||
selected_link = null;
|
||||
selectedLinks.clear();
|
||||
updateSelection();
|
||||
}
|
||||
if (mouse_mode === 0) {
|
||||
@@ -918,19 +998,18 @@ RED.view = (function() {
|
||||
lasso = null;
|
||||
}
|
||||
}
|
||||
if (mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) {
|
||||
if (d3.event.metaKey || d3.event.ctrlKey) {
|
||||
d3.event.stopPropagation();
|
||||
clearSelection();
|
||||
point = d3.mouse(this);
|
||||
var clickedGroup = getGroupAt(point[0],point[1]);
|
||||
if (drag_lines.length > 0) {
|
||||
clickedGroup = clickedGroup || RED.nodes.group(drag_lines[0].node.g)
|
||||
}
|
||||
showQuickAddDialog({position:point, group:clickedGroup});
|
||||
if ((mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) && (d3.event.touches || d3.event.button === 0) && (d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
// Trigger quick add dialog
|
||||
d3.event.stopPropagation();
|
||||
clearSelection();
|
||||
point = d3.mouse(this);
|
||||
var clickedGroup = getGroupAt(point[0],point[1]);
|
||||
if (drag_lines.length > 0) {
|
||||
clickedGroup = clickedGroup || RED.nodes.group(drag_lines[0].node.g)
|
||||
}
|
||||
}
|
||||
if (mouse_mode === 0 && !(d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
showQuickAddDialog({position:point, group:clickedGroup});
|
||||
} else if (mouse_mode === 0 && (d3.event.touches || d3.event.button === 0) && !(d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
// Tigger lasso
|
||||
if (!touchStartTime) {
|
||||
point = d3.mouse(this);
|
||||
lasso = eventLayer.append("rect")
|
||||
@@ -945,6 +1024,13 @@ RED.view = (function() {
|
||||
.attr("class","nr-ui-view-lasso");
|
||||
d3.event.preventDefault();
|
||||
}
|
||||
} else if (mouse_mode === 0 && d3.event.button === 2 && (d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
clearSelection();
|
||||
mouse_mode = RED.state.SLICING;
|
||||
point = d3.mouse(this);
|
||||
slicePath = eventLayer.append("path").attr("class","nr-ui-view-slice").attr("d",`M${point[0]} ${point[1]}`)
|
||||
slicePathLast = point;
|
||||
RED.view.redraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1341,6 +1427,17 @@ RED.view = (function() {
|
||||
.attr("height",h)
|
||||
;
|
||||
return;
|
||||
} else if (mouse_mode === RED.state.SLICING) {
|
||||
if (slicePath) {
|
||||
var delta = Math.max(1,Math.abs(slicePathLast[0]-mouse_position[0]))*Math.max(1,Math.abs(slicePathLast[1]-mouse_position[1]))
|
||||
if (delta > 20) {
|
||||
var currentPath = slicePath.attr("d")
|
||||
currentPath += " L"+mouse_position[0]+" "+mouse_position[1]
|
||||
slicePath.attr("d",currentPath);
|
||||
slicePathLast = mouse_position
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||
@@ -1348,7 +1445,7 @@ RED.view = (function() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mouse_mode != RED.state.QUICK_JOINING && mouse_mode != RED.state.IMPORT_DRAGGING && !mousedown_node && !mousedown_group && selected_link == null) {
|
||||
if (mouse_mode != RED.state.QUICK_JOINING && mouse_mode != RED.state.IMPORT_DRAGGING && mouse_mode != RED.state.DETACHED_DRAGGING && !mousedown_node && !mousedown_group && selectedLinks.length() === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1372,16 +1469,18 @@ RED.view = (function() {
|
||||
// Get all the wires we need to detach.
|
||||
var links = [];
|
||||
var existingLinks = [];
|
||||
if (selected_link &&
|
||||
((mousedown_port_type === PORT_TYPE_OUTPUT &&
|
||||
selected_link.source === mousedown_node &&
|
||||
selected_link.sourcePort === mousedown_port_index
|
||||
) ||
|
||||
(mousedown_port_type === PORT_TYPE_INPUT &&
|
||||
selected_link.target === mousedown_node
|
||||
))
|
||||
) {
|
||||
existingLinks = [selected_link];
|
||||
if (selectedLinks.length() > 0) {
|
||||
selectedLinks.forEach(function(link) {
|
||||
if (((mousedown_port_type === PORT_TYPE_OUTPUT &&
|
||||
link.source === mousedown_node &&
|
||||
link.sourcePort === mousedown_port_index
|
||||
) ||
|
||||
(mousedown_port_type === PORT_TYPE_INPUT &&
|
||||
link.target === mousedown_node
|
||||
))) {
|
||||
existingLinks.push(link);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
var filter;
|
||||
if (mousedown_port_type === PORT_TYPE_OUTPUT) {
|
||||
@@ -1419,7 +1518,7 @@ RED.view = (function() {
|
||||
} else if (mousedown_node && !quickAddLink) {
|
||||
showDragLines([{node:mousedown_node,port:mousedown_port_index,portType:mousedown_port_type}]);
|
||||
}
|
||||
selected_link = null;
|
||||
selectedLinks.clear();
|
||||
}
|
||||
mousePos = mouse_position;
|
||||
for (i=0;i<drag_lines.length;i++) {
|
||||
@@ -1451,7 +1550,7 @@ RED.view = (function() {
|
||||
RED.nodes.filterLinks({ target: node.n }).length === 0;
|
||||
}
|
||||
}
|
||||
} else if (mouse_mode == RED.state.MOVING_ACTIVE || mouse_mode == RED.state.IMPORT_DRAGGING) {
|
||||
} else if (mouse_mode == RED.state.MOVING_ACTIVE || mouse_mode == RED.state.IMPORT_DRAGGING || mouse_mode == RED.state.DETACHED_DRAGGING) {
|
||||
mousePos = mouse_position;
|
||||
var minX = 0;
|
||||
var minY = 0;
|
||||
@@ -1515,8 +1614,16 @@ RED.view = (function() {
|
||||
gridOffset[0] = node.n.x-(gridSize*Math.floor(node.n.x/gridSize))-gridSize/2;
|
||||
gridOffset[1] = node.n.y-(gridSize*Math.floor(node.n.y/gridSize))-gridSize/2;
|
||||
} else {
|
||||
gridOffset[0] = node.n.x-(gridSize*Math.floor((node.n.x-node.n.w/2)/gridSize)+node.n.w/2);
|
||||
gridOffset[1] = node.n.y-(gridSize*Math.floor(node.n.y/gridSize));
|
||||
var offsetLeft = node.n.x-(gridSize*Math.round((node.n.x-node.n.w/2)/gridSize)+node.n.w/2);
|
||||
var offsetRight = node.n.x-(gridSize*Math.round((node.n.x+node.n.w/2)/gridSize)-node.n.w/2);
|
||||
// gridOffset[0] = node.n.x-(gridSize*Math.floor((node.n.x-node.n.w/2)/gridSize)+node.n.w/2);
|
||||
if (Math.abs(offsetLeft) < Math.abs(offsetRight)) {
|
||||
gridOffset[0] = offsetLeft
|
||||
} else {
|
||||
gridOffset[0] = offsetRight
|
||||
}
|
||||
gridOffset[1] = node.n.y-(gridSize*Math.round(node.n.y/gridSize));
|
||||
// console.log(offsetLeft, offsetRight);
|
||||
}
|
||||
if (gridOffset[0] !== 0 || gridOffset[1] !== 0) {
|
||||
for (i = 0; i<movingSet.length(); i++) {
|
||||
@@ -1736,6 +1843,11 @@ RED.view = (function() {
|
||||
} else if (mouse_mode == RED.state.DEFAULT && mousedown_link == null && !d3.event.ctrlKey && !d3.event.metaKey ) {
|
||||
clearSelection();
|
||||
updateSelection();
|
||||
} else if (slicePath) {
|
||||
deleteSelection();
|
||||
slicePath.remove();
|
||||
slicePath = null;
|
||||
RED.view.redraw(true);
|
||||
}
|
||||
if (mouse_mode == RED.state.MOVING_ACTIVE) {
|
||||
if (movingSet.length() > 0) {
|
||||
@@ -1807,10 +1919,30 @@ RED.view = (function() {
|
||||
// movingSet.add(mousedown_node);
|
||||
// }
|
||||
// }
|
||||
if (mouse_mode == RED.state.MOVING || mouse_mode == RED.state.MOVING_ACTIVE) {
|
||||
if (mouse_mode == RED.state.MOVING || mouse_mode == RED.state.MOVING_ACTIVE || mouse_mode == RED.state.DETACHED_DRAGGING) {
|
||||
// if (mousedown_node) {
|
||||
// delete mousedown_node.gSelected;
|
||||
// }
|
||||
if (mouse_mode === RED.state.DETACHED_DRAGGING) {
|
||||
var ns = [];
|
||||
for (var j=0;j<movingSet.length();j++) {
|
||||
var n = movingSet.get(j);
|
||||
if (n.ox !== n.n.x || n.oy !== n.n.y) {
|
||||
ns.push({n:n.n,ox:n.ox,oy:n.oy,moved:n.n.moved});
|
||||
n.n.dirty = true;
|
||||
n.n.moved = true;
|
||||
}
|
||||
}
|
||||
var detachEvent = RED.history.peek();
|
||||
// The last event in the stack *should* be a multi-event from
|
||||
// where the links were added/removed
|
||||
var historyEvent = {t:"move",nodes:ns,dirty:RED.nodes.dirty()}
|
||||
if (detachEvent.t === "multi") {
|
||||
detachEvent.events.push(historyEvent)
|
||||
} else {
|
||||
RED.history.push(historyEvent)
|
||||
}
|
||||
}
|
||||
for (i=0;i<movingSet.length();i++) {
|
||||
var node = movingSet.get(i);
|
||||
delete node.ox;
|
||||
@@ -1855,10 +1987,29 @@ RED.view = (function() {
|
||||
if (mouse_mode === RED.state.MOVING || mouse_mode === RED.state.MOVING_ACTIVE) {
|
||||
return;
|
||||
}
|
||||
if (mouse_mode === RED.state.IMPORT_DRAGGING) {
|
||||
if (mouse_mode === RED.state.DETACHED_DRAGGING) {
|
||||
for (var j=0;j<movingSet.length();j++) {
|
||||
var n = movingSet.get(j);
|
||||
n.n.x = n.ox;
|
||||
n.n.y = n.oy;
|
||||
}
|
||||
clearSelection();
|
||||
RED.history.pop();
|
||||
mouse_mode = 0;
|
||||
} else if (mouse_mode === RED.state.IMPORT_DRAGGING) {
|
||||
clearSelection();
|
||||
RED.history.pop();
|
||||
mouse_mode = 0;
|
||||
} else if (mouse_mode === RED.state.SLICING) {
|
||||
if (slicePath) {
|
||||
slicePath.remove();
|
||||
slicePath = null;
|
||||
resetMouseVars()
|
||||
}
|
||||
clearSelection();
|
||||
} else if (lasso) {
|
||||
lasso.remove();
|
||||
lasso = null;
|
||||
} else if (activeGroup) {
|
||||
exitActiveGroup()
|
||||
} else {
|
||||
@@ -1870,6 +2021,7 @@ RED.view = (function() {
|
||||
if (mouse_mode === RED.state.SELECTING_NODE && selectNodesOptions.single) {
|
||||
return;
|
||||
}
|
||||
selectedLinks.clear();
|
||||
|
||||
if (activeGroup) {
|
||||
var ag = activeGroup;
|
||||
@@ -1941,7 +2093,6 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
selected_link = null;
|
||||
if (mouse_mode !== RED.state.SELECTING_NODE) {
|
||||
updateSelection();
|
||||
}
|
||||
@@ -1956,7 +2107,7 @@ RED.view = (function() {
|
||||
n.n.selected = false;
|
||||
}
|
||||
movingSet.clear();
|
||||
selected_link = null;
|
||||
selectedLinks.clear();
|
||||
if (activeGroup) {
|
||||
activeGroup.active = false
|
||||
activeGroup.dirty = true;
|
||||
@@ -2050,12 +2201,16 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (activeFlowLinks.length === 0 && selected_link !== null && selected_link.link) {
|
||||
activeLinks.push(selected_link);
|
||||
activeLinkNodes[selected_link.source.id] = selected_link.source;
|
||||
selected_link.source.dirty = true;
|
||||
activeLinkNodes[selected_link.target.id] = selected_link.target;
|
||||
selected_link.target.dirty = true;
|
||||
if (activeFlowLinks.length === 0 && selectedLinks.length() > 0) {
|
||||
selectedLinks.forEach(function(link) {
|
||||
if (link.link) {
|
||||
activeLinks.push(link);
|
||||
activeLinkNodes[link.source.id] = link.source;
|
||||
link.source.dirty = true;
|
||||
activeLinkNodes[link.target.id] = link.target;
|
||||
link.target.dirty = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
selection.flows = workspaceSelection;
|
||||
@@ -2066,6 +2221,10 @@ RED.view = (function() {
|
||||
return value.map(function(n) { return n.id })
|
||||
} else if (key === 'link') {
|
||||
return value.source.id+":"+value.sourcePort+":"+value.target.id;
|
||||
} else if (key === 'links') {
|
||||
return value.map(function(link) {
|
||||
return link.source.id+":"+link.sourcePort+":"+link.target.id;
|
||||
});
|
||||
}
|
||||
return value;
|
||||
});
|
||||
@@ -2087,7 +2246,7 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
function deleteSelection() {
|
||||
function deleteSelection(reconnectWires) {
|
||||
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||
return;
|
||||
}
|
||||
@@ -2135,7 +2294,7 @@ RED.view = (function() {
|
||||
updateActiveNodes();
|
||||
updateSelection();
|
||||
redraw();
|
||||
} else if (movingSet.length() > 0 || selected_link != null) {
|
||||
} else if (movingSet.length() > 0 || selectedLinks.length() > 0) {
|
||||
var result;
|
||||
var node;
|
||||
var removedNodes = [];
|
||||
@@ -2145,6 +2304,16 @@ RED.view = (function() {
|
||||
var removedSubflowInputs = [];
|
||||
var removedSubflowStatus;
|
||||
var subflowInstances = [];
|
||||
var historyEvents = [];
|
||||
|
||||
if (reconnectWires) {
|
||||
var reconnectResult = RED.nodes.detachNodes(movingSet.nodes())
|
||||
var addedLinks = reconnectResult.newLinks;
|
||||
if (addedLinks.length > 0) {
|
||||
historyEvents.push({ t:'add', links: addedLinks })
|
||||
}
|
||||
removedLinks = removedLinks.concat(reconnectResult.removedLinks)
|
||||
}
|
||||
|
||||
var startDirty = RED.nodes.dirty();
|
||||
var startChanged = false;
|
||||
@@ -2234,71 +2403,71 @@ RED.view = (function() {
|
||||
RED.nodes.dirty(true);
|
||||
}
|
||||
}
|
||||
var historyEvent;
|
||||
|
||||
if (selected_link && selected_link.link) {
|
||||
var sourceId = selected_link.source.id;
|
||||
var targetId = selected_link.target.id;
|
||||
var sourceIdIndex = selected_link.target.links.indexOf(sourceId);
|
||||
var targetIdIndex = selected_link.source.links.indexOf(targetId);
|
||||
|
||||
historyEvent = {
|
||||
t:"multi",
|
||||
events: [
|
||||
{
|
||||
if (selectedLinks.length() > 0) {
|
||||
selectedLinks.forEach(function(link) {
|
||||
if (link.link) {
|
||||
var sourceId = link.source.id;
|
||||
var targetId = link.target.id;
|
||||
var sourceIdIndex = link.target.links.indexOf(sourceId);
|
||||
var targetIdIndex = link.source.links.indexOf(targetId);
|
||||
historyEvents.push({
|
||||
t: "edit",
|
||||
node: selected_link.source,
|
||||
changed: selected_link.source.changed,
|
||||
node: link.source,
|
||||
changed: link.source.changed,
|
||||
changes: {
|
||||
links: $.extend(true,{},{v:selected_link.source.links}).v
|
||||
links: $.extend(true,{},{v:link.source.links}).v
|
||||
}
|
||||
},
|
||||
{
|
||||
})
|
||||
historyEvents.push({
|
||||
t: "edit",
|
||||
node: selected_link.target,
|
||||
changed: selected_link.target.changed,
|
||||
node: link.target,
|
||||
changed: link.target.changed,
|
||||
changes: {
|
||||
links: $.extend(true,{},{v:selected_link.target.links}).v
|
||||
links: $.extend(true,{},{v:link.target.links}).v
|
||||
}
|
||||
}
|
||||
})
|
||||
link.source.changed = true;
|
||||
link.target.changed = true;
|
||||
link.target.links.splice(sourceIdIndex,1);
|
||||
link.source.links.splice(targetIdIndex,1);
|
||||
link.source.dirty = true;
|
||||
link.target.dirty = true;
|
||||
|
||||
],
|
||||
dirty:RED.nodes.dirty()
|
||||
}
|
||||
RED.nodes.dirty(true);
|
||||
selected_link.source.changed = true;
|
||||
selected_link.target.changed = true;
|
||||
selected_link.target.links.splice(sourceIdIndex,1);
|
||||
selected_link.source.links.splice(targetIdIndex,1);
|
||||
selected_link.source.dirty = true;
|
||||
selected_link.target.dirty = true;
|
||||
|
||||
} else {
|
||||
if (selected_link) {
|
||||
RED.nodes.removeLink(selected_link);
|
||||
removedLinks.push(selected_link);
|
||||
}
|
||||
RED.nodes.dirty(true);
|
||||
historyEvent = {
|
||||
t:"delete",
|
||||
nodes:removedNodes,
|
||||
links:removedLinks,
|
||||
groups: removedGroups,
|
||||
subflowOutputs:removedSubflowOutputs,
|
||||
subflowInputs:removedSubflowInputs,
|
||||
subflow: {
|
||||
id: activeSubflow?activeSubflow.id:undefined,
|
||||
instances: subflowInstances
|
||||
},
|
||||
dirty:startDirty
|
||||
};
|
||||
if (removedSubflowStatus) {
|
||||
historyEvent.subflow.status = removedSubflowStatus;
|
||||
}
|
||||
} else {
|
||||
RED.nodes.removeLink(link);
|
||||
removedLinks.push(link);
|
||||
}
|
||||
})
|
||||
}
|
||||
RED.nodes.dirty(true);
|
||||
var historyEvent = {
|
||||
t:"delete",
|
||||
nodes:removedNodes,
|
||||
links:removedLinks,
|
||||
groups: removedGroups,
|
||||
subflowOutputs:removedSubflowOutputs,
|
||||
subflowInputs:removedSubflowInputs,
|
||||
subflow: {
|
||||
id: activeSubflow?activeSubflow.id:undefined,
|
||||
instances: subflowInstances
|
||||
},
|
||||
dirty:startDirty
|
||||
};
|
||||
if (removedSubflowStatus) {
|
||||
historyEvent.subflow.status = removedSubflowStatus;
|
||||
}
|
||||
if (historyEvents.length > 0) {
|
||||
historyEvents.unshift(historyEvent);
|
||||
RED.history.push({
|
||||
t:"multi",
|
||||
events: historyEvents
|
||||
})
|
||||
} else {
|
||||
RED.history.push(historyEvent);
|
||||
}
|
||||
RED.history.push(historyEvent);
|
||||
|
||||
selected_link = null;
|
||||
selectedLinks.clear();
|
||||
updateActiveNodes();
|
||||
updateSelection();
|
||||
redraw();
|
||||
@@ -2375,6 +2544,28 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function detachSelectedNodes() {
|
||||
var selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
const {newLinks, removedLinks} = RED.nodes.detachNodes(selection.nodes);
|
||||
if (removedLinks.length || newLinks.length) {
|
||||
RED.history.push({
|
||||
t: "multi",
|
||||
events: [
|
||||
{ t:'delete', links: removedLinks },
|
||||
{ t:'add', links: newLinks }
|
||||
],
|
||||
dirty: RED.nodes.dirty()
|
||||
})
|
||||
RED.nodes.dirty(true)
|
||||
}
|
||||
prepareDrag([selection.nodes[0].x,selection.nodes[0].y]);
|
||||
mouse_mode = RED.state.DETACHED_DRAGGING;
|
||||
RED.view.redraw(true);
|
||||
}
|
||||
}
|
||||
|
||||
function calculateTextWidth(str, className) {
|
||||
var result = convertLineBreakCharacter(str);
|
||||
var width = 0;
|
||||
@@ -2461,7 +2652,7 @@ RED.view = (function() {
|
||||
activeHoverGroup.hovered = false;
|
||||
activeHoverGroup = null;
|
||||
}
|
||||
d3.select(".red-ui-flow-link-splice").classed("red-ui-flow-link-splice",false);
|
||||
d3.selectAll(".red-ui-flow-link-splice").classed("red-ui-flow-link-splice",false);
|
||||
if (spliceTimer) {
|
||||
clearTimeout(spliceTimer);
|
||||
spliceTimer = null;
|
||||
@@ -2709,10 +2900,13 @@ RED.view = (function() {
|
||||
} else {
|
||||
resetMouseVars();
|
||||
}
|
||||
selected_link = select_link;
|
||||
mousedown_link = select_link;
|
||||
if (select_link) {
|
||||
selectedLinks.clear();
|
||||
selectedLinks.add(select_link);
|
||||
updateSelection();
|
||||
} else {
|
||||
selectedLinks.clear();
|
||||
}
|
||||
}
|
||||
redraw();
|
||||
@@ -2721,7 +2915,10 @@ RED.view = (function() {
|
||||
|
||||
resetMouseVars();
|
||||
hideDragLines();
|
||||
selected_link = select_link;
|
||||
if (select_link) {
|
||||
selectedLinks.clear();
|
||||
selectedLinks.add(select_link);
|
||||
}
|
||||
mousedown_link = select_link;
|
||||
if (select_link) {
|
||||
updateSelection();
|
||||
@@ -2894,10 +3091,13 @@ RED.view = (function() {
|
||||
msn.dx = msn.n.x-mouse[0];
|
||||
msn.dy = msn.n.y-mouse[1];
|
||||
}
|
||||
|
||||
mouse_offset = d3.mouse(document.body);
|
||||
if (isNaN(mouse_offset[0])) {
|
||||
mouse_offset = d3.touches(document.body)[0];
|
||||
try {
|
||||
mouse_offset = d3.mouse(document.body);
|
||||
if (isNaN(mouse_offset[0])) {
|
||||
mouse_offset = d3.touches(document.body)[0];
|
||||
}
|
||||
} catch(err) {
|
||||
mouse_offset = [0,0]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2978,7 +3178,7 @@ RED.view = (function() {
|
||||
//var touch0 = d3.event;
|
||||
//var pos = [touch0.pageX,touch0.pageY];
|
||||
//RED.touch.radialMenu.show(d3.select(this),pos);
|
||||
if (mouse_mode == RED.state.IMPORT_DRAGGING) {
|
||||
if (mouse_mode == RED.state.IMPORT_DRAGGING || mouse_mode == RED.state.DETACHED_DRAGGING) {
|
||||
var historyEvent = RED.history.peek();
|
||||
if (activeSpliceLink) {
|
||||
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
|
||||
@@ -3016,6 +3216,18 @@ RED.view = (function() {
|
||||
activeHoverGroup = null;
|
||||
}
|
||||
|
||||
if (mouse_mode == RED.state.DETACHED_DRAGGING) {
|
||||
var ns = [];
|
||||
for (var j=0;j<movingSet.length();j++) {
|
||||
var n = movingSet.get(j);
|
||||
if (n.ox !== n.n.x || n.oy !== n.n.y) {
|
||||
ns.push({n:n.n,ox:n.ox,oy:n.oy,moved:n.n.moved});
|
||||
n.n.dirty = true;
|
||||
n.n.moved = true;
|
||||
}
|
||||
}
|
||||
RED.history.replace({t:"multi",events:[historyEvent,{t:"move",nodes:ns}],dirty: historyEvent.dirty})
|
||||
}
|
||||
|
||||
updateSelection();
|
||||
RED.nodes.dirty(true);
|
||||
@@ -3184,7 +3396,9 @@ RED.view = (function() {
|
||||
// }
|
||||
// } else
|
||||
if (d3.event.shiftKey) {
|
||||
clearSelection();
|
||||
if (!(d3.event.ctrlKey||d3.event.metaKey)) {
|
||||
clearSelection();
|
||||
}
|
||||
var clickPosition = (d3.event.offsetX/scaleFactor - mousedown_node.x)
|
||||
var edgeDelta = (mousedown_node.w/2) - Math.abs(clickPosition);
|
||||
var cnodes;
|
||||
@@ -3212,7 +3426,7 @@ RED.view = (function() {
|
||||
mousedown_node.selected = true;
|
||||
movingSet.add(mousedown_node);
|
||||
}
|
||||
selected_link = null;
|
||||
// selectedLinks.clear();
|
||||
if (d3.event.button != 2) {
|
||||
mouse_mode = RED.state.MOVING;
|
||||
var mouse = d3.touches(this)[0]||d3.mouse(this);
|
||||
@@ -3338,19 +3552,35 @@ RED.view = (function() {
|
||||
d3.event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
mousedown_link = d;
|
||||
clearSelection();
|
||||
selected_link = mousedown_link;
|
||||
updateSelection();
|
||||
redraw();
|
||||
focusView();
|
||||
d3.event.stopPropagation();
|
||||
if (d3.event.metaKey || d3.event.ctrlKey) {
|
||||
d3.select(this).classed("red-ui-flow-link-splice",true);
|
||||
var point = d3.mouse(this);
|
||||
var clickedGroup = getGroupAt(point[0],point[1]);
|
||||
showQuickAddDialog({position:point, splice:selected_link, group:clickedGroup});
|
||||
}
|
||||
if (d3.event.button === 2) {
|
||||
return
|
||||
}
|
||||
mousedown_link = d;
|
||||
|
||||
if (!(d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
clearSelection();
|
||||
}
|
||||
if (d3.event.metaKey || d3.event.ctrlKey) {
|
||||
if (!selectedLinks.has(mousedown_link)) {
|
||||
selectedLinks.add(mousedown_link);
|
||||
} else {
|
||||
if (selectedLinks.length() !== 1) {
|
||||
selectedLinks.remove(mousedown_link);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectedLinks.add(mousedown_link);
|
||||
}
|
||||
updateSelection();
|
||||
redraw();
|
||||
focusView();
|
||||
d3.event.stopPropagation();
|
||||
if (!mousedown_link.link && movingSet.length() === 0 && (d3.event.touches || d3.event.button === 0) && selectedLinks.length() === 1 && selectedLinks.has(mousedown_link) && (d3.event.metaKey || d3.event.ctrlKey)) {
|
||||
d3.select(this).classed("red-ui-flow-link-splice",true);
|
||||
var point = d3.mouse(this);
|
||||
var clickedGroup = getGroupAt(point[0],point[1]);
|
||||
showQuickAddDialog({position:point, splice:mousedown_link, group:clickedGroup});
|
||||
}
|
||||
}
|
||||
function linkTouchStart(d) {
|
||||
if (mouse_mode === RED.state.SELECTING_NODE) {
|
||||
@@ -3359,7 +3589,8 @@ RED.view = (function() {
|
||||
}
|
||||
mousedown_link = d;
|
||||
clearSelection();
|
||||
selected_link = mousedown_link;
|
||||
selectedLinks.clear();
|
||||
selectedLinks.add(mousedown_link);
|
||||
updateSelection();
|
||||
redraw();
|
||||
focusView();
|
||||
@@ -3595,7 +3826,7 @@ RED.view = (function() {
|
||||
function showTouchMenu(obj,pos) {
|
||||
var mdn = mousedown_node;
|
||||
var options = [];
|
||||
options.push({name:"delete",disabled:(movingSet.length()===0 && selected_link === null),onselect:function() {deleteSelection();}});
|
||||
options.push({name:"delete",disabled:(movingSet.length()===0 && selectedLinks.length() === 0),onselect:function() {deleteSelection();}});
|
||||
options.push({name:"cut",disabled:(movingSet.length()===0),onselect:function() {copySelection();deleteSelection();}});
|
||||
options.push({name:"copy",disabled:(movingSet.length()===0),onselect:function() {copySelection();}});
|
||||
options.push({name:"paste",disabled:(clipboard.length===0),onselect:function() {importNodes(clipboard, {generateIds: true, touchImport: true});}});
|
||||
@@ -3904,6 +4135,11 @@ RED.view = (function() {
|
||||
|
||||
}
|
||||
|
||||
node[0][0].__portGroup__ = document.createElementNS("http://www.w3.org/2000/svg","g");
|
||||
node[0][0].__portGroup__.__data__ = d;
|
||||
nodeContents.appendChild(node[0][0].__portGroup__);
|
||||
|
||||
|
||||
var mainRect = document.createElementNS("http://www.w3.org/2000/svg","rect");
|
||||
mainRect.__data__ = d;
|
||||
mainRect.setAttribute("class", "red-ui-flow-node "+(d.type == "unknown"?"red-ui-flow-node-unknown":""));
|
||||
@@ -4107,7 +4343,7 @@ RED.view = (function() {
|
||||
this.__textGroup__.setAttribute("transform", "translate(38,"+yp+")");
|
||||
}
|
||||
|
||||
var inputPorts = thisNode.selectAll(".red-ui-flow-port-input");
|
||||
var inputPorts = d3.select(this.__portGroup__).selectAll(".red-ui-flow-port-input");
|
||||
if ((!isLink || (showAllLinkPorts === -1 && !activeLinkNodes[d.id])) && d.inputs === 0 && !inputPorts.empty()) {
|
||||
inputPorts.each(function(d,i) {
|
||||
RED.hooks.trigger("viewRemovePort",{
|
||||
@@ -4118,8 +4354,9 @@ RED.view = (function() {
|
||||
portIndex: 0
|
||||
})
|
||||
}).remove();
|
||||
this.__inputs__ = [];
|
||||
} else if (((isLink && (showAllLinkPorts===PORT_TYPE_INPUT||activeLinkNodes[d.id]))|| d.inputs === 1) && inputPorts.empty()) {
|
||||
var inputGroup = thisNode.append("g").attr("class","red-ui-flow-port-input");
|
||||
var inputGroup = d3.select(this.__portGroup__).append("g").attr("class","red-ui-flow-port-input");
|
||||
var inputGroupPorts;
|
||||
|
||||
if (d.type === "link in") {
|
||||
@@ -4128,7 +4365,8 @@ RED.view = (function() {
|
||||
.attr("r",5)
|
||||
.attr("class","red-ui-flow-port red-ui-flow-link-port")
|
||||
} else {
|
||||
inputGroupPorts = inputGroup.append("rect").attr("class","red-ui-flow-port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10)
|
||||
inputGroupPorts = inputGroup.append("path").attr("class","red-ui-flow-port-background").attr("d","M5 -1.5 h -16 v 13 h 16 z")
|
||||
inputGroup.append("path").attr("class","red-ui-flow-port red-ui-flow-port-shape").attr("d","M5 0 h -3 c -4 0 -4 0 -4 4 v 2 c 0 4 0 4 4 4 h 3 z ")
|
||||
}
|
||||
inputGroup[0][0].__port__ = inputGroupPorts[0][0];
|
||||
inputGroupPorts[0][0].__data__ = this.__data__;
|
||||
@@ -4140,6 +4378,8 @@ RED.view = (function() {
|
||||
.on("touchend",function(d){portMouseUp(d,PORT_TYPE_INPUT,0);d3.event.preventDefault();} )
|
||||
.on("mouseover",function(d){portMouseOver(d3.select(this),d,PORT_TYPE_INPUT,0);})
|
||||
.on("mouseout",function(d) {portMouseOut(d3.select(this),d,PORT_TYPE_INPUT,0);});
|
||||
|
||||
this.__inputs__.push(inputGroup[0][0]);
|
||||
RED.hooks.trigger("viewAddPort",{node:d,el: this, port: inputGroup[0][0], portType: "input", portIndex: 0})
|
||||
}
|
||||
var numOutputs = d.outputs;
|
||||
@@ -4176,15 +4416,19 @@ RED.view = (function() {
|
||||
portPort.setAttribute("cy",5);
|
||||
portPort.setAttribute("r",5);
|
||||
portPort.setAttribute("class","red-ui-flow-port red-ui-flow-link-port");
|
||||
portGroup.appendChild(portPort);
|
||||
} else {
|
||||
portPort = document.createElementNS("http://www.w3.org/2000/svg","rect");
|
||||
portPort.setAttribute("rx",3);
|
||||
portPort.setAttribute("ry",3);
|
||||
portPort.setAttribute("width",10);
|
||||
portPort.setAttribute("height",10);
|
||||
portPort.setAttribute("class","red-ui-flow-port");
|
||||
|
||||
portPort = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
portPort.setAttribute("d","M5 -1.5 h 16 v 13 h -16 z ");
|
||||
portPort.setAttribute("class","red-ui-flow-port-background");
|
||||
portGroup.appendChild(portPort);
|
||||
|
||||
var visiblePort = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
visiblePort.setAttribute("d","M5 0 h 4 c 4 0 4 0 4 4 v 2 c 0 4 0 4 -4 4 h -4 z ");
|
||||
visiblePort.setAttribute("class","red-ui-flow-port red-ui-flow-port-shape");
|
||||
portGroup.appendChild(visiblePort);
|
||||
}
|
||||
portGroup.appendChild(portPort);
|
||||
portGroup.__port__ = portPort;
|
||||
portPort.__data__ = this.__data__;
|
||||
portPort.__portType__ = PORT_TYPE_OUTPUT;
|
||||
@@ -4196,7 +4440,7 @@ RED.view = (function() {
|
||||
portPort.addEventListener("mouseover", portMouseOverProxy);
|
||||
portPort.addEventListener("mouseout", portMouseOutProxy);
|
||||
|
||||
this.appendChild(portGroup);
|
||||
this.__portGroup__.appendChild(portGroup);
|
||||
this.__outputs__.push(portGroup);
|
||||
RED.hooks.trigger("viewAddPort",{node:d,el: this, port: portGroup, portType: "output", portIndex: portIndex})
|
||||
} else {
|
||||
@@ -4287,6 +4531,14 @@ RED.view = (function() {
|
||||
// });
|
||||
}
|
||||
|
||||
for (var i=0,l=this.__outputs__.length;i<l;i++) {
|
||||
this.__outputs__[i].classList.toggle("red-ui-flow-port-connected",RED.nodes.getNodeLinkCount(d.id,PORT_TYPE_OUTPUT,i) > 0 )
|
||||
}
|
||||
for (var i=0,l=this.__inputs__.length;i<l;i++) {
|
||||
this.__inputs__[i].classList.toggle("red-ui-flow-port-connected",RED.nodes.getNodeLinkCount(d.id,PORT_TYPE_INPUT,i) > 0 )
|
||||
}
|
||||
|
||||
|
||||
if (d.dirtyStatus) {
|
||||
redrawStatus(d,this);
|
||||
}
|
||||
@@ -4332,6 +4584,13 @@ RED.view = (function() {
|
||||
d3.select(pathBack)
|
||||
.on("mousedown",linkMouseDown)
|
||||
.on("touchstart",linkTouchStart)
|
||||
.on("mousemove", function(d) {
|
||||
if (mouse_mode === RED.state.SLICING) {
|
||||
selectedLinks.add(d)
|
||||
l.classed("red-ui-flow-link-splice",true)
|
||||
redraw()
|
||||
}
|
||||
})
|
||||
|
||||
var pathOutline = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
pathOutline.__data__ = d;
|
||||
@@ -4352,7 +4611,7 @@ RED.view = (function() {
|
||||
link.exit().remove();
|
||||
link.each(function(d) {
|
||||
var link = d3.select(this);
|
||||
if (d.added || d===selected_link || d.selected || dirtyNodes[d.source.id] || dirtyNodes[d.target.id]) {
|
||||
if (d.added || d.selected || dirtyNodes[d.source.id] || dirtyNodes[d.target.id]) {
|
||||
var numOutputs = d.source.outputs || 1;
|
||||
var sourcePort = d.sourcePort || 0;
|
||||
var y = -((numOutputs-1)/2)*13 +13*sourcePort;
|
||||
@@ -4360,22 +4619,19 @@ RED.view = (function() {
|
||||
d.y1 = d.source.y+y;
|
||||
d.x2 = d.target.x-d.target.w/2;
|
||||
d.y2 = d.target.y;
|
||||
|
||||
// return "M "+d.x1+" "+d.y1+
|
||||
// " C "+(d.x1+scale*node_width)+" "+(d.y1+scaleY*node_height)+" "+
|
||||
// (d.x2-scale*node_width)+" "+(d.y2-scaleY*node_height)+" "+
|
||||
// d.x2+" "+d.y2;
|
||||
var path = generateLinkPath(d.x1,d.y1,d.x2,d.y2,1);
|
||||
var targetOffset = ARROW_HEADS?(d.link?16:13):0
|
||||
var path = generateLinkPath(d.x1+5,d.y1,d.x2-targetOffset,d.y2,1);
|
||||
if (/NaN/.test(path)) {
|
||||
path = ""
|
||||
}
|
||||
this.__pathBack__.setAttribute("d",path);
|
||||
this.__pathOutline__.setAttribute("d",path);
|
||||
this.__pathLine__.setAttribute("d",path);
|
||||
this.__pathLine__.setAttribute("d",path + (ARROW_HEADS?"m0 0, l 0 -2 l 3 2 l -3 2 z":""));
|
||||
this.__pathLine__.classList.toggle("red-ui-flow-node-disabled",!!(d.source.d || d.target.d));
|
||||
this.__pathLine__.classList.toggle("red-ui-flow-subflow-link", !d.link && activeSubflow);
|
||||
}
|
||||
this.classList.toggle("red-ui-flow-link-selected", !!(d===selected_link||d.selected));
|
||||
|
||||
this.classList.toggle("red-ui-flow-link-selected", !!d.selected);
|
||||
|
||||
var connectedToUnknown = !!(d.target.type == "unknown" || d.source.type == "unknown");
|
||||
this.classList.toggle("red-ui-flow-link-unknown",!!(d.target.type == "unknown" || d.source.type == "unknown"))
|
||||
@@ -5083,8 +5339,9 @@ RED.view = (function() {
|
||||
if (allNodes.size > 0) {
|
||||
selection.nodes = Array.from(allNodes);
|
||||
}
|
||||
if (selected_link != null) {
|
||||
selection.link = selected_link;
|
||||
if (selectedLinks.length() > 0) {
|
||||
selection.links = selectedLinks.toArray();
|
||||
selection.link = selection.links[0];
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
|
||||
@@ -208,10 +208,20 @@ RED.workspaces = (function() {
|
||||
},
|
||||
onhide: function(tab) {
|
||||
hideStack.push(tab.id);
|
||||
|
||||
var hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||
hiddenTabs[tab.id] = true;
|
||||
RED.settings.setLocal("hiddenTabs",JSON.stringify(hiddenTabs));
|
||||
|
||||
RED.events.emit("workspace:hide",{workspace: tab.id})
|
||||
},
|
||||
onshow: function(tab) {
|
||||
removeFromHideStack(tab.id);
|
||||
|
||||
var hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||
delete hiddenTabs[tab.id];
|
||||
RED.settings.setLocal("hiddenTabs",JSON.stringify(hiddenTabs));
|
||||
|
||||
RED.events.emit("workspace:show",{workspace: tab.id})
|
||||
},
|
||||
minimumActiveTabWidth: 150,
|
||||
@@ -542,9 +552,6 @@ RED.workspaces = (function() {
|
||||
}
|
||||
if (workspace_tabs.contains(id)) {
|
||||
workspace_tabs.hideTab(id);
|
||||
var hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||
hiddenTabs[id] = true;
|
||||
RED.settings.setLocal("hiddenTabs",JSON.stringify(hiddenTabs));
|
||||
}
|
||||
},
|
||||
isHidden: function(id) {
|
||||
@@ -572,9 +579,6 @@ RED.workspaces = (function() {
|
||||
}
|
||||
workspace_tabs.activateTab(id);
|
||||
}
|
||||
var hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}");
|
||||
delete hiddenTabs[id];
|
||||
RED.settings.setLocal("hiddenTabs",JSON.stringify(hiddenTabs));
|
||||
},
|
||||
refresh: function() {
|
||||
RED.nodes.eachWorkspace(function(ws) {
|
||||
|
||||
@@ -196,6 +196,12 @@ $view-background: $secondary-background;
|
||||
$view-select-mode-background: $secondary-background-selected;
|
||||
$view-grid-color: #eee;
|
||||
|
||||
$link-color: #999;
|
||||
$link-link-color: #aaa;
|
||||
$link-disabled-color: #ccc;
|
||||
$link-link-active-color: #ff7f0e;
|
||||
$link-unknown-color: #f00;
|
||||
|
||||
$node-label-color: #333;
|
||||
$node-port-label-color: #888;
|
||||
$node-border: #999;
|
||||
@@ -203,8 +209,13 @@ $node-border-unknown: #f33;
|
||||
$node-border-placeholder: #aaa;
|
||||
$node-background-placeholder: #eee;
|
||||
|
||||
$node-port-border: $node-border;
|
||||
$node-port-border-connected: $link-color;
|
||||
|
||||
$node-port-background: #d9d9d9;
|
||||
$node-port-background-hover: #eee;
|
||||
$node-port-background-connected: $link-color;
|
||||
|
||||
$node-icon-color: #fff;
|
||||
$node-icon-background-color: rgba(0,0,0,0.05);
|
||||
$node-icon-background-color-fill: #000;
|
||||
@@ -232,12 +243,6 @@ $node-status-colors: (
|
||||
$node-selected-color: #ff7f0e;
|
||||
$port-selected-color: #ff7f0e;
|
||||
|
||||
$link-color: #999;
|
||||
$link-link-color: #aaa;
|
||||
$link-disabled-color: #ccc;
|
||||
$link-link-active-color: #ff7f0e;
|
||||
$link-unknown-color: #f00;
|
||||
|
||||
$clipboard-textarea-background: #F3E7E7;
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,13 @@
|
||||
stroke-dasharray: 10 5;
|
||||
}
|
||||
|
||||
.nr-ui-view-slice {
|
||||
stroke-width: 1px;
|
||||
stroke: $view-lasso-stroke;
|
||||
fill: none;
|
||||
stroke-dasharray: 10 5;
|
||||
}
|
||||
|
||||
.node_label_italic, // deprecated: use red-ui-flow-node-label-italic
|
||||
.red-ui-flow-node-label-italic {
|
||||
font-style: italic;
|
||||
@@ -178,12 +185,29 @@
|
||||
}
|
||||
|
||||
.red-ui-flow-port {
|
||||
stroke: $node-border;
|
||||
stroke: $node-port-border;
|
||||
stroke-width: 1;
|
||||
fill: $node-port-background;
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.red-ui-flow-port-background {
|
||||
opacity: 0;
|
||||
stroke: none;
|
||||
fill: #f00;
|
||||
cursor: crosshair;
|
||||
}
|
||||
.red-ui-flow-port-shape {
|
||||
pointer-events: none;
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.red-ui-flow-port-connected .red-ui-flow-port {
|
||||
fill: $node-port-background-connected;
|
||||
stroke: $node-port-border-connected;
|
||||
}
|
||||
|
||||
|
||||
.red-ui-flow-node-error {
|
||||
fill: $node-status-error-background;
|
||||
stroke: $node-status-error-border;
|
||||
@@ -273,9 +297,10 @@ g.red-ui-flow-node-selected {
|
||||
text-anchor:start;
|
||||
}
|
||||
|
||||
.red-ui-flow-port-hovered {
|
||||
stroke: $port-selected-color;
|
||||
fill: $port-selected-color;
|
||||
.red-ui-flow-port-hovered:not(.red-ui-flow-port-background),
|
||||
.red-ui-flow-port-background.red-ui-flow-port-hovered + .red-ui-flow-port-shape {
|
||||
stroke: $port-selected-color !important;
|
||||
fill: $port-selected-color !important;
|
||||
}
|
||||
|
||||
.red-ui-flow-subflow-port {
|
||||
|
||||
@@ -204,6 +204,28 @@
|
||||
font-style: italic;
|
||||
color: $form-placeholder-color;
|
||||
}
|
||||
.red-ui-search-history {
|
||||
button {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 7px;
|
||||
}
|
||||
|
||||
&:hover button {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
.red-ui-search-historyHeader {
|
||||
button {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 7px;
|
||||
}
|
||||
}
|
||||
.red-ui-search-history-result {
|
||||
|
||||
}
|
||||
|
||||
.red-ui-search-result-action {
|
||||
color: $primary-text-color;
|
||||
|
||||
@@ -73,8 +73,8 @@ export default {
|
||||
},
|
||||
element: "#red-ui-workspace-tabs > li.active",
|
||||
description: {
|
||||
"en-US": '<p>Tabs can now be hidden by clicking their <i class="fa fa-times"></i> icon.</p><p>The Info Sidebar will still list all of your tabs, and tell you which ones are currently hidden.',
|
||||
"ja": '<p><i class="fa fa-times"></i> アイコンをクリックすることで、タブを非表示にできます。</p><p>情報サイドバーには、全てのタブが一覧表示されており、現在非表示になっているタブを確認できます。'
|
||||
"en-US": '<p>Tabs can now be hidden by clicking their <i class="fa fa-eye-slash"></i> icon.</p><p>The Info Sidebar will still list all of your tabs, and tell you which ones are currently hidden.',
|
||||
"ja": '<p><i class="fa fa-eye-slash"></i> アイコンをクリックすることで、タブを非表示にできます。</p><p>情報サイドバーには、全てのタブが一覧表示されており、現在非表示になっているタブを確認できます。'
|
||||
},
|
||||
interactive: false,
|
||||
prepare() {
|
||||
|
||||
@@ -690,9 +690,9 @@
|
||||
this.topic = "";
|
||||
var result = getProps(items, true);
|
||||
this.props = result.props;
|
||||
if(result.payloadType) { this.payloadType = result.payloadType; };
|
||||
if(result.payload) { this.payload = result.payload; };
|
||||
if(result.topic) { this.topic = result.topic; };
|
||||
if(result.hasOwnProperty('payloadType')) { this.payloadType = result.payloadType; };
|
||||
if(result.hasOwnProperty('payload')) { this.payload = result.payload; };
|
||||
if(result.hasOwnProperty('topic')) { this.topic = result.topic; };
|
||||
},
|
||||
button: {
|
||||
enabled: function() {
|
||||
|
||||
@@ -75,16 +75,12 @@ module.exports = function(RED) {
|
||||
node.repeaterSetup = function () {
|
||||
if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
|
||||
this.repeat = this.repeat * 1000;
|
||||
if (RED.settings.verbose) {
|
||||
this.log(RED._("inject.repeat", this));
|
||||
}
|
||||
this.debug(RED._("inject.repeat", this));
|
||||
this.interval_id = setInterval(function() {
|
||||
node.emit("input", {});
|
||||
}, this.repeat);
|
||||
} else if (this.crontab) {
|
||||
if (RED.settings.verbose) {
|
||||
this.log(RED._("inject.crontab", this));
|
||||
}
|
||||
this.debug(RED._("inject.crontab", this));
|
||||
this.cronjob = scheduleTask(this.crontab,() => { node.emit("input", {})});
|
||||
}
|
||||
};
|
||||
@@ -148,10 +144,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
if (this.interval_id != null) {
|
||||
clearInterval(this.interval_id);
|
||||
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
|
||||
} else if (this.cronjob != null) {
|
||||
this.cronjob.stop();
|
||||
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
|
||||
delete this.cronjob;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -512,6 +512,7 @@
|
||||
return function(e) {
|
||||
e.preventDefault();
|
||||
var value = editor.getValue();
|
||||
var extraLibs = that.libs || [];
|
||||
RED.editor.editJavaScript({
|
||||
value: value,
|
||||
width: "Infinity",
|
||||
@@ -523,7 +524,8 @@
|
||||
setTimeout(function() {
|
||||
editor.focus();
|
||||
},300);
|
||||
}
|
||||
},
|
||||
extraLibs: extraLibs
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,8 +234,7 @@ module.exports = function(RED) {
|
||||
},
|
||||
env: {
|
||||
get: function(envVar) {
|
||||
var flow = node._flow;
|
||||
return flow.getSetting(envVar);
|
||||
return RED.util.getSetting(node, envVar);
|
||||
}
|
||||
},
|
||||
setTimeout: function () {
|
||||
|
||||
@@ -86,7 +86,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
var cmd = arg.shift();
|
||||
/* istanbul ignore else */
|
||||
if (RED.settings.verbose) { node.log(cmd+" ["+arg+"]"); }
|
||||
node.debug(cmd+" ["+arg+"]");
|
||||
child = spawn(cmd,arg,node.spawnOpt);
|
||||
node.status({fill:"blue",shape:"dot",text:"pid:"+child.pid});
|
||||
var unknownCommand = (child.pid === undefined);
|
||||
@@ -136,7 +136,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
else {
|
||||
/* istanbul ignore else */
|
||||
if (RED.settings.verbose) { node.log(arg); }
|
||||
node.debug(arg);
|
||||
child = exec(arg, node.execOpt, function (error, stdout, stderr) {
|
||||
var msg2, msg3;
|
||||
delete msg.payload;
|
||||
@@ -155,7 +155,7 @@ module.exports = function(RED) {
|
||||
if (error.signal) { msg3.payload.signal = error.signal; }
|
||||
if (error.code === null) { node.status({fill:"red",shape:"dot",text:"killed"}); }
|
||||
else { node.status({fill:"red",shape:"dot",text:"error:"+error.code}); }
|
||||
if (RED.settings.verbose) { node.log('error:' + error); }
|
||||
node.debug('error:' + error);
|
||||
}
|
||||
else if (node.oldrc === "false") {
|
||||
msg3 = RED.util.cloneMessage(msg);
|
||||
|
||||
@@ -58,7 +58,7 @@ module.exports = function(RED) {
|
||||
else {
|
||||
var n = parseFloat(value);
|
||||
if (!isNaN(n)) {
|
||||
if ((typeof node.previous[t] === 'undefined') && (this.func === "narrowband")) {
|
||||
if ((typeof node.previous[t] === 'undefined') && (this.func === "narrowband" || this.func === "narrowbandEq")) {
|
||||
if (node.start === '') { node.previous[t] = n; }
|
||||
else { node.previous[t] = node.start; }
|
||||
}
|
||||
|
||||
@@ -302,6 +302,8 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
||||
// var cred = ""
|
||||
if (this.credentials.user || this.credentials.password) {
|
||||
// cred = `${this.credentials.user}:${this.credentials.password}`;
|
||||
if (this.credentials.user === undefined) { this.credentials.user = ""}
|
||||
if (this.credentials.password === undefined) { this.credentials.password = ""}
|
||||
opts.headers.Authorization = "Basic " + Buffer.from(`${this.credentials.user}:${this.credentials.password}`).toString("base64");
|
||||
}
|
||||
// build own basic auth header
|
||||
|
||||
@@ -177,7 +177,8 @@
|
||||
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/)},
|
||||
tls: {type:"tls-config",required: false},
|
||||
wholemsg: {value:"false"},
|
||||
hb: {value: "", validate: RED.validators.number(/*blank allowed*/true) }
|
||||
hb: {value: "", validate: RED.validators.number(/*blank allowed*/true) },
|
||||
subprotocol: {value:"",required: false}
|
||||
},
|
||||
inputs:0,
|
||||
outputs:0,
|
||||
@@ -265,7 +266,10 @@
|
||||
<label for="node-config-input-tls" data-i18n="httpin.tls-config"></label>
|
||||
<input type="text" id="node-config-input-tls">
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-subprotocol"><i class="fa fa-tag"></i> <span data-i18n="websocket.label.subprotocol"></span></label>
|
||||
<input type="text" id="node-config-input-subprotocol">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-wholemsg" data-i18n="websocket.sendrec"></label>
|
||||
<select type="text" id="node-config-input-wholemsg" style="width: 70%;">
|
||||
|
||||
@@ -46,6 +46,12 @@ module.exports = function(RED) {
|
||||
|
||||
// Store local copies of the node configuration (as defined in the .html)
|
||||
node.path = n.path;
|
||||
if (typeof n.subprotocol === "string") {
|
||||
// Split the string on comma and trim each result
|
||||
node.subprotocol = n.subprotocol.split(",").map(v => v.trim())
|
||||
} else {
|
||||
node.subprotocol = [];
|
||||
}
|
||||
node.wholemsg = (n.wholemsg === "true");
|
||||
|
||||
node._inputNodes = []; // collection of nodes that want to receive events
|
||||
@@ -92,7 +98,7 @@ module.exports = function(RED) {
|
||||
tlsNode.addTLSOptions(options);
|
||||
}
|
||||
}
|
||||
var socket = new ws(node.path,options);
|
||||
var socket = new ws(node.path,node.subprotocol,options);
|
||||
socket.setMaxListeners(0);
|
||||
node.server = socket; // keep for closing
|
||||
handleConnection(socket);
|
||||
|
||||
@@ -71,9 +71,7 @@ module.exports = function(RED) {
|
||||
node.error(RED._("file.errors.deletefail",{error:err.toString()}),msg);
|
||||
}
|
||||
else {
|
||||
if (RED.settings.verbose) {
|
||||
node.log(RED._("file.status.deletedfile",{file:filename}));
|
||||
}
|
||||
node.debug(RED._("file.status.deletedfile",{file:filename}));
|
||||
nodeSend(msg);
|
||||
}
|
||||
done();
|
||||
|
||||
156
packages/node_modules/@node-red/nodes/examples/common/link/03 - Link call.json
vendored
Normal file
156
packages/node_modules/@node-red/nodes/examples/common/link/03 - Link call.json
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
[
|
||||
{
|
||||
"id": "62ea32aa.d73aac",
|
||||
"type": "comment",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Example: Link Call Node",
|
||||
"info": "Link call node can call link in node then get result from link out node.",
|
||||
"x": 230,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "c588bc36.87fec",
|
||||
"type": "comment",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓ call link in node",
|
||||
"info": "",
|
||||
"x": 440,
|
||||
"y": 220,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "cd31efb4d2c6967e",
|
||||
"type": "link call",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"links": [
|
||||
"dbc46892c8d14c37"
|
||||
],
|
||||
"timeout": "30",
|
||||
"x": 420,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"c3db64d1d2260340"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "dbc46892c8d14c37",
|
||||
"type": "link in",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"links": [],
|
||||
"x": 315,
|
||||
"y": 340,
|
||||
"wires": [
|
||||
[
|
||||
"e10575d73f2e5352"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "6b61792143b3b0a3",
|
||||
"type": "inject",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"props": [
|
||||
{
|
||||
"p": "payload"
|
||||
},
|
||||
{
|
||||
"p": "topic",
|
||||
"vt": "str"
|
||||
}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 240,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"cd31efb4d2c6967e"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e10575d73f2e5352",
|
||||
"type": "change",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"rules": [
|
||||
{
|
||||
"t": "set",
|
||||
"p": "payload",
|
||||
"pt": "msg",
|
||||
"to": "Hello, World!",
|
||||
"tot": "str"
|
||||
}
|
||||
],
|
||||
"action": "",
|
||||
"property": "",
|
||||
"from": "",
|
||||
"to": "",
|
||||
"reg": false,
|
||||
"x": 450,
|
||||
"y": 340,
|
||||
"wires": [
|
||||
[
|
||||
"cf8438e7137bc0f0"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "cf8438e7137bc0f0",
|
||||
"type": "link out",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"mode": "return",
|
||||
"links": [],
|
||||
"x": 595,
|
||||
"y": 340,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "c3db64d1d2260340",
|
||||
"type": "debug",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 600,
|
||||
"y": 260,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "6d077dfa0987febb",
|
||||
"type": "comment",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑called from link call node",
|
||||
"info": "",
|
||||
"x": 410,
|
||||
"y": 380,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "53b9a0adfd8c4217",
|
||||
"type": "comment",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑return to link call node",
|
||||
"info": "",
|
||||
"x": 680,
|
||||
"y": 380,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": "84222b92.d65d18",
|
||||
"type": "inject",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"props": [
|
||||
{
|
||||
@@ -20,8 +20,8 @@
|
||||
"topic": "",
|
||||
"payload": "Hello, World!",
|
||||
"payloadType": "str",
|
||||
"x": 230,
|
||||
"y": 220,
|
||||
"x": 190,
|
||||
"y": 180,
|
||||
"wires": [
|
||||
[
|
||||
"b4b9f603.739598"
|
||||
@@ -31,25 +31,25 @@
|
||||
{
|
||||
"id": "7b014430.dfd94c",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Write string to a file, then read from the file",
|
||||
"info": "File-in node can read string from a file.",
|
||||
"x": 260,
|
||||
"y": 140,
|
||||
"info": "Read file node can read string from a file.",
|
||||
"x": 220,
|
||||
"y": 100,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "b4b9f603.739598",
|
||||
"type": "file",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"appendNewline": true,
|
||||
"createDir": false,
|
||||
"overwriteFile": "true",
|
||||
"encoding": "none",
|
||||
"x": 420,
|
||||
"y": 220,
|
||||
"x": 380,
|
||||
"y": 180,
|
||||
"wires": [
|
||||
[
|
||||
"6dc01cac.5c4bf4"
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"id": "2587adb9.7e60f2",
|
||||
"type": "debug",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
@@ -68,22 +68,22 @@
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 810,
|
||||
"y": 220,
|
||||
"x": 770,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "6dc01cac.5c4bf4",
|
||||
"type": "file in",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"format": "utf8",
|
||||
"chunk": false,
|
||||
"sendError": false,
|
||||
"encoding": "none",
|
||||
"x": 620,
|
||||
"y": 220,
|
||||
"x": 580,
|
||||
"y": 180,
|
||||
"wires": [
|
||||
[
|
||||
"2587adb9.7e60f2"
|
||||
@@ -93,21 +93,21 @@
|
||||
{
|
||||
"id": "f4b4309a.3b78a",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑read result from file",
|
||||
"info": "",
|
||||
"x": 630,
|
||||
"y": 260,
|
||||
"x": 590,
|
||||
"y": 220,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "672d3693.3cabd8",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓write to /tmp/hello.txt",
|
||||
"info": "",
|
||||
"x": 440,
|
||||
"y": 180,
|
||||
"x": 400,
|
||||
"y": 140,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": "8997398f.c5d628",
|
||||
"type": "inject",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"props": [
|
||||
{
|
||||
@@ -20,8 +20,8 @@
|
||||
"topic": "",
|
||||
"payload": "😀",
|
||||
"payloadType": "str",
|
||||
"x": 210,
|
||||
"y": 480,
|
||||
"x": 170,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"56e32d23.050f44"
|
||||
@@ -31,25 +31,25 @@
|
||||
{
|
||||
"id": "4e598e65.1799d",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Read data in specified encoding",
|
||||
"info": "File-in node can specify encoding of data read from a file.",
|
||||
"x": 230,
|
||||
"y": 400,
|
||||
"info": "Read file node can specify encoding of data read from a file.",
|
||||
"x": 190,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "56e32d23.050f44",
|
||||
"type": "file",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"appendNewline": true,
|
||||
"createDir": false,
|
||||
"overwriteFile": "true",
|
||||
"encoding": "none",
|
||||
"x": 380,
|
||||
"y": 480,
|
||||
"x": 340,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"38fa0579.f2cd8a"
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"id": "d28c8994.99c0a8",
|
||||
"type": "debug",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
@@ -68,22 +68,23 @@
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 770,
|
||||
"y": 480,
|
||||
"x": 730,
|
||||
"y": 260,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "38fa0579.f2cd8a",
|
||||
"type": "file in",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"format": "utf8",
|
||||
"chunk": false,
|
||||
"sendError": false,
|
||||
"encoding": "base64",
|
||||
"x": 580,
|
||||
"y": 480,
|
||||
"allProps": false,
|
||||
"x": 540,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"d28c8994.99c0a8"
|
||||
@@ -93,21 +94,21 @@
|
||||
{
|
||||
"id": "fa22ca20.ae4528",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑read data from file as base64 string",
|
||||
"info": "",
|
||||
"x": 640,
|
||||
"y": 520,
|
||||
"x": 600,
|
||||
"y": 300,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "148e25ad.98891a",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓write to /tmp/hello.txt",
|
||||
"info": "",
|
||||
"x": 400,
|
||||
"y": 440,
|
||||
"x": 360,
|
||||
"y": 220,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": "6a0b1d03.d4cee4",
|
||||
"type": "inject",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"props": [
|
||||
{
|
||||
@@ -20,8 +20,8 @@
|
||||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 220,
|
||||
"y": 740,
|
||||
"x": 160,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"d4b00cb7.a5a23"
|
||||
@@ -31,25 +31,25 @@
|
||||
{
|
||||
"id": "f17ea1d1.8ecc3",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Read data breaking lines into individual messages",
|
||||
"info": "File-in node can break read text into messages with individual lines",
|
||||
"x": 290,
|
||||
"y": 660,
|
||||
"info": "Read file node can break read text into messages with individual lines",
|
||||
"x": 230,
|
||||
"y": 140,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "99ae7806.1d6428",
|
||||
"type": "file",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"appendNewline": true,
|
||||
"createDir": false,
|
||||
"overwriteFile": "true",
|
||||
"encoding": "none",
|
||||
"x": 540,
|
||||
"y": 740,
|
||||
"x": 480,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"70d7892f.d27db8"
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"id": "7ed8282c.92b338",
|
||||
"type": "debug",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
@@ -68,22 +68,22 @@
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 810,
|
||||
"y": 800,
|
||||
"x": 750,
|
||||
"y": 280,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "70d7892f.d27db8",
|
||||
"type": "file in",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"format": "lines",
|
||||
"chunk": false,
|
||||
"sendError": false,
|
||||
"encoding": "none",
|
||||
"x": 620,
|
||||
"y": 800,
|
||||
"x": 560,
|
||||
"y": 280,
|
||||
"wires": [
|
||||
[
|
||||
"7ed8282c.92b338"
|
||||
@@ -93,27 +93,27 @@
|
||||
{
|
||||
"id": "c1b7e05.1d94b2",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑read data from file breaking lines into messages",
|
||||
"info": "",
|
||||
"x": 720,
|
||||
"y": 840,
|
||||
"x": 660,
|
||||
"y": 320,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "a5f647b2.cf27a8",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓write to /tmp/hello.txt",
|
||||
"info": "",
|
||||
"x": 560,
|
||||
"y": 700,
|
||||
"x": 500,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "d4b00cb7.a5a23",
|
||||
"type": "template",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "data",
|
||||
"field": "payload",
|
||||
"fieldType": "msg",
|
||||
@@ -121,8 +121,8 @@
|
||||
"syntax": "plain",
|
||||
"template": "one\ntwo\nthree!",
|
||||
"output": "str",
|
||||
"x": 370,
|
||||
"y": 740,
|
||||
"x": 310,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"99ae7806.1d6428"
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": "bdd57acc.2edc48",
|
||||
"type": "inject",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"props": [
|
||||
{
|
||||
@@ -20,8 +20,8 @@
|
||||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 220,
|
||||
"y": 1040,
|
||||
"x": 180,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"7a069b01.0c2324"
|
||||
@@ -31,25 +31,25 @@
|
||||
{
|
||||
"id": "1fd12220.33953e",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Creating a message stream from lines of data",
|
||||
"info": "File-in node can break read text into messages with individual lines. The messages creates a stream of messages.",
|
||||
"x": 270,
|
||||
"y": 960,
|
||||
"info": "Read file node can break read text into messages with individual lines. The messages creates a stream of messages.",
|
||||
"x": 230,
|
||||
"y": 140,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "ab6eb213.2a08d",
|
||||
"type": "file",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"appendNewline": true,
|
||||
"createDir": false,
|
||||
"overwriteFile": "true",
|
||||
"encoding": "none",
|
||||
"x": 540,
|
||||
"y": 1040,
|
||||
"x": 500,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"b7ed49b0.649fb8"
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"id": "c48d8ae0.9ff3a8",
|
||||
"type": "debug",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
@@ -68,22 +68,22 @@
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 810,
|
||||
"y": 1140,
|
||||
"x": 770,
|
||||
"y": 320,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "b7ed49b0.649fb8",
|
||||
"type": "file in",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"format": "lines",
|
||||
"chunk": false,
|
||||
"sendError": false,
|
||||
"encoding": "none",
|
||||
"x": 280,
|
||||
"y": 1140,
|
||||
"x": 240,
|
||||
"y": 320,
|
||||
"wires": [
|
||||
[
|
||||
"83073ebe.fcce4"
|
||||
@@ -93,27 +93,27 @@
|
||||
{
|
||||
"id": "3c33e69f.6a04ba",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑read data from file breaking lines into messages",
|
||||
"info": "",
|
||||
"x": 380,
|
||||
"y": 1180,
|
||||
"x": 340,
|
||||
"y": 360,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "3598bf7d.5712a",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓write to /tmp/hello.txt",
|
||||
"info": "",
|
||||
"x": 560,
|
||||
"y": 1000,
|
||||
"x": 520,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "7a069b01.0c2324",
|
||||
"type": "template",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "data",
|
||||
"field": "payload",
|
||||
"fieldType": "msg",
|
||||
@@ -121,8 +121,8 @@
|
||||
"syntax": "plain",
|
||||
"template": "Apple\nBanana\nGrape\nOrange",
|
||||
"output": "str",
|
||||
"x": 370,
|
||||
"y": 1040,
|
||||
"x": 330,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"ab6eb213.2a08d"
|
||||
@@ -132,7 +132,7 @@
|
||||
{
|
||||
"id": "8d4ed1d0.821fe",
|
||||
"type": "join",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"mode": "auto",
|
||||
"build": "string",
|
||||
@@ -145,8 +145,8 @@
|
||||
"timeout": "",
|
||||
"count": "",
|
||||
"reduceRight": false,
|
||||
"x": 630,
|
||||
"y": 1140,
|
||||
"x": 590,
|
||||
"y": 320,
|
||||
"wires": [
|
||||
[
|
||||
"c48d8ae0.9ff3a8"
|
||||
@@ -156,7 +156,7 @@
|
||||
{
|
||||
"id": "83073ebe.fcce4",
|
||||
"type": "switch",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "< D",
|
||||
"property": "payload",
|
||||
"propertyType": "msg",
|
||||
@@ -170,8 +170,8 @@
|
||||
"checkall": "true",
|
||||
"repair": true,
|
||||
"outputs": 1,
|
||||
"x": 470,
|
||||
"y": 1140,
|
||||
"x": 430,
|
||||
"y": 320,
|
||||
"wires": [
|
||||
[
|
||||
"8d4ed1d0.821fe"
|
||||
@@ -181,21 +181,21 @@
|
||||
{
|
||||
"id": "2088e195.f7aebe",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓filter data before \"D\"",
|
||||
"info": "",
|
||||
"x": 520,
|
||||
"y": 1100,
|
||||
"x": 480,
|
||||
"y": 280,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "b848cdc7.61e06",
|
||||
"type": "comment",
|
||||
"z": "194a3e4f.a92772",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑join to single string",
|
||||
"info": "",
|
||||
"x": 670,
|
||||
"y": 1180,
|
||||
"x": 630,
|
||||
"y": 360,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": "84222b92.d65d18",
|
||||
"type": "inject",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "5132b95f037524f9",
|
||||
"name": "",
|
||||
"props": [
|
||||
{
|
||||
@@ -20,8 +20,8 @@
|
||||
"topic": "",
|
||||
"payload": "Hello, World!",
|
||||
"payloadType": "str",
|
||||
"x": 230,
|
||||
"y": 200,
|
||||
"x": 150,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"b4b9f603.739598"
|
||||
@@ -31,25 +31,25 @@
|
||||
{
|
||||
"id": "7b014430.dfd94c",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "5132b95f037524f9",
|
||||
"name": "Write string to a file, then read from the file",
|
||||
"info": "File node can write string to a file.",
|
||||
"x": 260,
|
||||
"y": 120,
|
||||
"info": "Write file node can write string from a file.",
|
||||
"x": 180,
|
||||
"y": 140,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "b4b9f603.739598",
|
||||
"type": "file",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "5132b95f037524f9",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"appendNewline": true,
|
||||
"createDir": false,
|
||||
"overwriteFile": "true",
|
||||
"encoding": "none",
|
||||
"x": 420,
|
||||
"y": 200,
|
||||
"x": 340,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"6dc01cac.5c4bf4"
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"id": "2587adb9.7e60f2",
|
||||
"type": "debug",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "5132b95f037524f9",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
@@ -68,22 +68,22 @@
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 810,
|
||||
"y": 200,
|
||||
"x": 730,
|
||||
"y": 220,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "6dc01cac.5c4bf4",
|
||||
"type": "file in",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "5132b95f037524f9",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"format": "utf8",
|
||||
"chunk": false,
|
||||
"sendError": false,
|
||||
"encoding": "none",
|
||||
"x": 620,
|
||||
"y": 200,
|
||||
"x": 540,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"2587adb9.7e60f2"
|
||||
@@ -93,21 +93,21 @@
|
||||
{
|
||||
"id": "f4b4309a.3b78a",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "5132b95f037524f9",
|
||||
"name": "↑read result from file",
|
||||
"info": "",
|
||||
"x": 630,
|
||||
"y": 240,
|
||||
"x": 550,
|
||||
"y": 260,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "672d3693.3cabd8",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "5132b95f037524f9",
|
||||
"name": "↓write to /tmp/hello.txt",
|
||||
"info": "",
|
||||
"x": 440,
|
||||
"y": 160,
|
||||
"x": 360,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": "704479e1.399388",
|
||||
"type": "inject",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"props": [
|
||||
{
|
||||
@@ -25,8 +25,8 @@
|
||||
"topic": "",
|
||||
"payload": "Hello, World!",
|
||||
"payloadType": "str",
|
||||
"x": 230,
|
||||
"y": 400,
|
||||
"x": 190,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"402f3b7e.988014"
|
||||
@@ -36,25 +36,25 @@
|
||||
{
|
||||
"id": "8e876a75.e9beb8",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Write string to a file specied by filename property, the read from the file",
|
||||
"info": "File node can target file using `filename` property.",
|
||||
"x": 350,
|
||||
"y": 320,
|
||||
"info": "Write file node can target file using `filename` property.",
|
||||
"x": 310,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "402f3b7e.988014",
|
||||
"type": "file",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "",
|
||||
"appendNewline": true,
|
||||
"createDir": false,
|
||||
"overwriteFile": "true",
|
||||
"encoding": "none",
|
||||
"x": 390,
|
||||
"y": 400,
|
||||
"x": 350,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"26e077d6.bbcd98"
|
||||
@@ -64,7 +64,7 @@
|
||||
{
|
||||
"id": "97b6b6b2.a54b38",
|
||||
"type": "debug",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
@@ -73,22 +73,22 @@
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 770,
|
||||
"y": 400,
|
||||
"x": 730,
|
||||
"y": 260,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "26e077d6.bbcd98",
|
||||
"type": "file in",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"format": "utf8",
|
||||
"chunk": false,
|
||||
"sendError": false,
|
||||
"encoding": "none",
|
||||
"x": 580,
|
||||
"y": 400,
|
||||
"x": 540,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"97b6b6b2.a54b38"
|
||||
@@ -98,21 +98,21 @@
|
||||
{
|
||||
"id": "85062297.da79",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑read result from file",
|
||||
"info": "",
|
||||
"x": 590,
|
||||
"y": 440,
|
||||
"x": 550,
|
||||
"y": 300,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "7316c4fc.b1dcdc",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓write to file specified by filename property",
|
||||
"info": "",
|
||||
"x": 500,
|
||||
"y": 360,
|
||||
"x": 460,
|
||||
"y": 220,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": "4ac00fb0.d5f52",
|
||||
"type": "inject",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"props": [
|
||||
{
|
||||
@@ -20,8 +20,8 @@
|
||||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 220,
|
||||
"y": 600,
|
||||
"x": 180,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"542cc2f4.92857c"
|
||||
@@ -31,25 +31,25 @@
|
||||
{
|
||||
"id": "671f8295.0e6f6c",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Delete a file",
|
||||
"info": "File node can delete a file.",
|
||||
"x": 170,
|
||||
"y": 540,
|
||||
"info": "Write file node can delete a file.",
|
||||
"x": 130,
|
||||
"y": 160,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "542cc2f4.92857c",
|
||||
"type": "file",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"appendNewline": true,
|
||||
"createDir": false,
|
||||
"overwriteFile": "delete",
|
||||
"encoding": "none",
|
||||
"x": 420,
|
||||
"y": 600,
|
||||
"x": 380,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"a24da523.5babe8"
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"id": "a24da523.5babe8",
|
||||
"type": "debug",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
@@ -68,18 +68,18 @@
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 630,
|
||||
"y": 600,
|
||||
"x": 590,
|
||||
"y": 220,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "51157051.2f62",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓delete a file",
|
||||
"info": "",
|
||||
"x": 390,
|
||||
"y": 560,
|
||||
"x": 350,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
@@ -2,8 +2,8 @@
|
||||
{
|
||||
"id": "e4ef1f5e.7cd82",
|
||||
"type": "inject",
|
||||
"z": "4b63452d.672afc",
|
||||
"name": "",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Base64 encoded string",
|
||||
"props": [
|
||||
{
|
||||
"p": "payload"
|
||||
@@ -20,8 +20,8 @@
|
||||
"topic": "",
|
||||
"payload": "8J+YgA==",
|
||||
"payloadType": "str",
|
||||
"x": 220,
|
||||
"y": 820,
|
||||
"x": 200,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"72b37cc8.177054"
|
||||
@@ -31,25 +31,25 @@
|
||||
{
|
||||
"id": "f5997af4.5a9298",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "Specify encoding of written data",
|
||||
"info": "File node can specify encoding of data.",
|
||||
"x": 230,
|
||||
"y": 740,
|
||||
"info": "Write file node can specify encoding of data.",
|
||||
"x": 170,
|
||||
"y": 140,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "72b37cc8.177054",
|
||||
"type": "file",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"appendNewline": true,
|
||||
"createDir": false,
|
||||
"overwriteFile": "true",
|
||||
"encoding": "base64",
|
||||
"x": 400,
|
||||
"y": 820,
|
||||
"x": 420,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"2da33ec.f45cac2"
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"id": "2e814354.278c8c",
|
||||
"type": "debug",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
@@ -68,22 +68,22 @@
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 790,
|
||||
"y": 820,
|
||||
"x": 810,
|
||||
"y": 220,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "2da33ec.f45cac2",
|
||||
"type": "file in",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "",
|
||||
"filename": "/tmp/hello.txt",
|
||||
"format": "utf8",
|
||||
"chunk": false,
|
||||
"sendError": false,
|
||||
"encoding": "none",
|
||||
"x": 600,
|
||||
"y": 820,
|
||||
"x": 620,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"2e814354.278c8c"
|
||||
@@ -93,21 +93,21 @@
|
||||
{
|
||||
"id": "ec754c99.84bfd",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↓write string with base64 encoding",
|
||||
"info": "",
|
||||
"x": 460,
|
||||
"y": 780,
|
||||
"x": 480,
|
||||
"y": 180,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "3e6704ff.4ce25c",
|
||||
"type": "comment",
|
||||
"z": "4b63452d.672afc",
|
||||
"z": "6312c0588348b2d4",
|
||||
"name": "↑read result from file",
|
||||
"info": "",
|
||||
"x": 610,
|
||||
"y": 860,
|
||||
"x": 630,
|
||||
"y": 260,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
@@ -499,7 +499,8 @@
|
||||
"label": {
|
||||
"type": "Typ",
|
||||
"path": "Pfad",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "Subprotokoll"
|
||||
},
|
||||
"listenon": "Lauschen (listen on)",
|
||||
"connectto": "Verbinden mit",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<dt>msg <span class="property-type">object</span></dt>
|
||||
<dd>A msg object containing information to populate the template.</dd>
|
||||
<dt class="optional">template <span class="property-type">string</span></dt>
|
||||
<dd>A template to be populated from msg.payload. If not configured in the edit panel,
|
||||
<dd>A template to be populated from <code>msg.payload</code>. If not configured in the edit panel,
|
||||
this can be set as a property of msg.</dd>
|
||||
</dl>
|
||||
<h3>Outputs</h3>
|
||||
|
||||
@@ -60,5 +60,5 @@
|
||||
for the next topic.
|
||||
</p>
|
||||
<p><b>Note</b>: In rate limit mode the maximum queue depth can be set by a property in your
|
||||
<i>settings.js</i> file. For example <code>nodeMessageBufferMaxLength: 1000,</code>
|
||||
<i>settings.js</i> file. For example <code>nodeMessageBufferMaxLength: 1000,</code></p>
|
||||
</script>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<h3>Details</h3>
|
||||
<p>In RBE mode this node will block until the <code>msg.payload</code>,
|
||||
(or selected property) value is different to the previous one.
|
||||
If required it can ignore the intial value, so as not to send anything at start.</p>
|
||||
If required it can ignore the initial value, so as not to send anything at start.</p>
|
||||
<p>The <a href="https://en.wikipedia.org/wiki/Deadband" target="_blank">Deadband</a> modes will block the incoming value
|
||||
<i>unless</i> its change is greater or greater-equal than ± the band gap away from a previous value.</p>
|
||||
<p>The Narrowband modes will block the incoming value,
|
||||
@@ -37,5 +37,5 @@
|
||||
ignoring any values out of range, or the previous input value, which resets the set point, thus allowing
|
||||
gradual drift (deadband), or a step change (narrowband).</p>
|
||||
<p><b>Note:</b> This works on a per <code>msg.topic</code> basis, though this can be changed to another property if desired.
|
||||
This means that a single rbe node can handle multiple different topics at the same time.</p>
|
||||
This means that a single filter node can handle multiple different topics at the same time.</p>
|
||||
</script>
|
||||
|
||||
@@ -530,7 +530,8 @@
|
||||
"label": {
|
||||
"type": "Type",
|
||||
"path": "Path",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "Subprotocol"
|
||||
},
|
||||
"listenon": "Listen on",
|
||||
"connectto": "Connect to",
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<dt class="optional">topic <span class="property-type">string|object|array</span></dt>
|
||||
<dd>For the <code>"subscribe"</code> and <code>"unsubscribe"</code> actions, this property
|
||||
provides the topic. It can be set as either:<ul>
|
||||
<li>a String continaing the topic filter</li>
|
||||
<li>a String containing the topic filter</li>
|
||||
<li>an Object containing <code>topic</code> and <code>qos</code> properties</li>
|
||||
<li>an array of either strings or objects to handle multiple topics in one</li>
|
||||
</ul>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<dd>In case any redirects occurred while processing the request, this property is the final redirected url.
|
||||
Otherwise, the url of the original request.</dd>
|
||||
<dt>responseCookies <span class="property-type">object</span></dt>
|
||||
<dd>If the response includes cookies, this propery is an object of name/value pairs for each cookie.</dd>
|
||||
<dd>If the response includes cookies, this property is an object of name/value pairs for each cookie.</dd>
|
||||
<dt>redirectList <span class="property-type">array</span></dt>
|
||||
<dd>If the request was redirected one or more times, the accumulated information will be added to this property. `location` is the next redirect destination. `cookies` is the cookies returned from the redirect source.</dd>
|
||||
</dl>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</p>
|
||||
<p>When operating in this mode, the node will not set the <code>msg.parts.count</code>
|
||||
property as it does not know how many messages to expect in the stream. This
|
||||
means it cannot be used with the <b>join</b> node in its automatic mode</p>
|
||||
means it cannot be used with the <b>join</b> node in its automatic mode.</p>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="join">
|
||||
|
||||
@@ -46,4 +46,6 @@
|
||||
<code>{{global[store].名前}}</code>を用います。
|
||||
</p>
|
||||
<p><b>注: </b>デフォルトでは、<i>mustache</i>形式は置換対象のHTML要素をエスケープします。これを抑止するには<code>{{{三重}}}</code>括弧形式を使います。</p>
|
||||
<p>もし、コンテンツの中で<code>{{ }}</code>を出力する必要がある場合は、テンプレートで使われる記号文字を変えることもできます。例えば、<code>[[ ]]</code>を代わりに用いるには、テンプレートの先頭に以下の行を追加します。</p>
|
||||
<pre>{{=[[ ]]=}}</pre>
|
||||
</script>
|
||||
|
||||
@@ -25,11 +25,14 @@
|
||||
<dt class="optional">reset</dt>
|
||||
<dd>受信メッセージでこのプロパティを任意の値に設定すると、ノードが保持する全ての未送信メッセージをクリアします。</dd>
|
||||
<dt class="optional">flush</dt>
|
||||
<dd>受信メッセージでこのプロパティを任意の値に設定すると、ノードが保持する全ての未送信メッセージを直ちに送信します。</dd>
|
||||
<dd>本プロパティに数値が設定されたメッセージを受信すると、直ちに指定された数のメッセージを送信します。もし他の型(例えば真偽型)が設定されている場合は、ノードが保持している全ての未送信メッセージを直ちに送信します。</dd>
|
||||
<dt class="optional">toFront</dt>
|
||||
<dd>流量制御モードにおいて、本プロパティに真偽型<code>true</code>が設定されたメッセージを受け取ると、キューの先頭に追加され、その後に送信されます。<code>msg.flush=1</code>と組み合わせて用いると、すぐに再送信できます。</dd>
|
||||
</dl>
|
||||
<h3>詳細</h3>
|
||||
<p>メッセージを遅延させるように設定する場合、遅延時間は固定値、範囲内の乱数値、メッセージ毎の動的な指定値のいずれかを指定できます。</p>
|
||||
<p>メッセージを遅延させるように設定する場合、遅延時間は固定値、範囲内の乱数値、メッセージ毎の動的な指定値のいずれかを指定できます。各メッセージは、到着時刻に基づいて、他のメッセージとは独立して遅延されます。</p>
|
||||
<p>流量制御する場合、メッセージは指定した時間間隔内に分散して送信します。キューに残っているメッセージ数はノードのステータスに表示されます。受け取った中間メッセージを破棄することも可能です。</p>
|
||||
<p>流量値を上書きできるように設定されている場合、新しい流量値はすぐに適用されます。この流量値は、再度変更されるまで、本ノードがリセットされるまで、またはフローが再実行されるまで有効です。</p>
|
||||
<p>流量制御は全てのメッセージに適用することも、<code>msg.topic</code>値でグループ化して適用することも可能です。グループ化すると、中間メッセージは自動的に破棄されます。時間間隔毎に全てのトピックの最新メッセージを送信するか、次のトピックの最新メッセージを送信するかを指定できます。</p>
|
||||
<p><b>注</b>: 流量制御モードでは、キューの大きさの最大値を<i>settings.js</i>ファイルのプロパティに設定できます。例えば、次の様な設定です。<code>nodeMessageBufferMaxLength: 1000,</code></p>
|
||||
</script>
|
||||
|
||||
@@ -27,5 +27,5 @@
|
||||
<p>不感帯モードでは%による指定もサポートしています。入力と前の値の差分がX%より大きな場合に出力を行います。</p>
|
||||
<p>狭帯域(narrowband)モードでは、前の値に対する差分が一定値より大きな場合に入力ペイロードをブロックします。このモードは、故障したセンサから発生する外れ値を無視する時などに有用です。</p>
|
||||
<p>不感帯モードと狭帯域モードでは、以前の有効出力値、もしくは、以前の入力値との比較ができます。有効出力値を用いると範囲外の値を無視することが、入力値を用いると設定点がリセットされるため漸次的変化(不感帯モード)もしくは段階的変化(狭帯域モード)が可能です。</p>
|
||||
<p><b>注:</b> このノードは<code>msg.topic</code>毎に動作します。そのため、ひとつのrbeノードで複数の異なるトピックを同時に扱うことができます。</p>
|
||||
<p><b>注:</b> このノードは<code>msg.topic</code>毎に動作します。そのため、ひとつのfilterノードで複数の異なるトピックを同時に扱うことができます。</p>
|
||||
</script>
|
||||
|
||||
@@ -530,7 +530,8 @@
|
||||
"label": {
|
||||
"type": "種類",
|
||||
"path": "パス",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "サブプロトコル"
|
||||
},
|
||||
"listenon": "待ち受け",
|
||||
"connectto": "接続",
|
||||
|
||||
@@ -26,11 +26,46 @@
|
||||
<dd>0: 最大1度到着, 1: 一度以上到着, 2: 1度のみ到着</dd>
|
||||
<dt>retain <span class="property-type">真偽値</span></dt>
|
||||
<dd>真の場合、メッセージを保持。メッセージが古い値の場合があります。</dd>
|
||||
<dt class="optional">responseTopic <span class="property-type">文字列</span></dt>
|
||||
<dd><b>MQTTv5</b>: メッセージのMQTT応答トピック</dd>
|
||||
<dt class="optional">correlationData <span class="property-type">バッファ</span></dt>
|
||||
<dd><b>MQTTv5</b>: メッセージの相関データ</dd>
|
||||
<dt class="optional">contentType <span class="property-type">文字列</span></dt>
|
||||
<dd><b>MQTTv5</b>: ペイロードのコンテントタイプ</dd>
|
||||
<dt class="optional">userProperties <span class="property-type">オブジェクト</span></dt>
|
||||
<dd><b>MQTTv5</b>: メッセージのユーザプロパティ</dd>
|
||||
<dt class="optional">messageExpiryInterval <span class="property-type">数値</span></dt>
|
||||
<dd><b>MQTTv5</b>: 秒単位のメッセージの有効期限</dd>
|
||||
</dl>
|
||||
<h3>詳細</h3>
|
||||
<p>購読トピックにはMQTTのワイルドカード(+: 1レベル, #: 複数レベル)を含めることができます。</p>
|
||||
<p>このノードの利用のためには、MQTTブローカへの接続設定が必要です。この設定は鉛筆アイコンをクリックすることで行えます。</p>
|
||||
<p>MQTT(inおよびout)ノードはブローカへの接続設定を必要に応じて共有できます。</p>
|
||||
<h4>動的購読</h4>
|
||||
本ノードは、MQTTの接続と購読を動的に制御するよう設定できます。有効にすると、本ノードの入力にメッセージを渡すことで制御できます。
|
||||
<h3>入力</h3>
|
||||
<p>これらは、動的購読が設定されている場合のみ適用されます。</p>
|
||||
<dl class="message-properties">
|
||||
<dt>action <span class="property-type">文字列</span></dt>
|
||||
<dd>本ノードが行う動作の名前。利用可能な動作は<code>"connect"</code>、<code>"disconnect"</code>、<code>"subscribe"</code>、<code>"unsubscribe"</code>です。</dd>
|
||||
<dt class="optional">topic <span class="property-type">文字列|オブジェクト|配列</span></dt>
|
||||
<dd><code>"subscribe"</code>と<code>"unsubscribe"</code>の動作に対して、本プロパティはトピックを提供します。次のいずれかを設定できます:<ul>
|
||||
<li>トピックフィルターを含む文字列</li>
|
||||
<li><code>topic</code>と<code>qos</code>プロパティを持つオブジェクト</li>
|
||||
<li>複数のトピックを扱う文字列やオブジェクトの配列</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="optional">broker <span class="property-type">broker</span> </dt>
|
||||
<dd><code>"connect"</code>の動作に対して、本プロパティは次の様な個々のブローカ設定を上書きします: <ul>
|
||||
<li><code>broker</code></li>
|
||||
<li><code>port</code></li>
|
||||
<li><code>url</code> - 完全な接続URLを提供するために、brokerとportを上書き</li>
|
||||
<li><code>username</code></li>
|
||||
<li><code>password</code></li>
|
||||
</ul>
|
||||
<p>本プロパティが設定され既にブローカが接続されている場合、<code>force</code>プロパティを設定しない限り、エラーがログに記録されます。設定された場合はブローカから切断され、新しい設定を適用して再接続します。</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="mqtt out">
|
||||
@@ -39,15 +74,24 @@
|
||||
<dl class="message-properties">
|
||||
<dt>payload <span class="property-type">文字列 | バッファ</span></dt>
|
||||
<dd>発行するペイロード。プロパティが設定されていない場合には、メッセージは送信されません。空のメッセージを送信するには、プロパティに空文字列を設定します。</dd>
|
||||
|
||||
<dt class="optional">topic <span class="property-type">文字列</span></dt>
|
||||
<dd>発行対象のMQTTトピック</dd>
|
||||
|
||||
<dt class="optional">qos <span class="property-type">数値</span></dt>
|
||||
<dd>0: 最大一度到着, 1: 一度以上到着, 2: 一度のみ到着。デフォルトは0です。</dd>
|
||||
|
||||
<dt class="optional">retain <span class="property-type">真偽値</span></dt>
|
||||
<dd>真の場合、メッセージをブローカに保持します。デフォルトは偽です。</dd>
|
||||
<dt class="optional">responseTopic <span class="property-type">文字列</span></dt>
|
||||
<dd><b>MQTTv5</b>: メッセージのMQTT応答トピック</dd>
|
||||
<dt class="optional">correlationData <span class="property-type">バッファ</span></dt>
|
||||
<dd><b>MQTTv5</b>: メッセージの相関データ</dd>
|
||||
<dt class="optional">contentType <span class="property-type">文字列</span></dt>
|
||||
<dd><b>MQTTv5</b>: ペイロードのコンテントタイプ</dd>
|
||||
<dt class="optional">userProperties <span class="property-type">オブジェクト</span></dt>
|
||||
<dd><b>MQTTv5</b>: メッセージのユーザプロパティ</dd>
|
||||
<dt class="optional">messageExpiryInterval <span class="property-type">数値</span></dt>
|
||||
<dd><b>MQTTv5</b>: 秒単位のメッセージの有効期限</dd>
|
||||
<dt class="optional">topicAlias <span class="property-type">数値</span></dt>
|
||||
<dd><b>MQTTv5</b>: 使用するMQTTトピックエイリアス</dd>
|
||||
</dl>
|
||||
<h3>詳細</h3>
|
||||
<p><code>msg.payload</code>を発行するメッセージのペイロードとして用います。ペイロードがオブジェクトの場合、送信の際にJSON文字列に変換します。ペイロードがバイナリバッファの場合、そのまま送信します。</p>
|
||||
@@ -55,6 +99,24 @@
|
||||
<p>同様に、QoSとretainもノードの設定、もしくは、ノードの設定が空の場合には、それぞれ<code>msg.qos</code>および<code>msg.retain</code>で指定できます。以前ブローカに保存したトピックをクリアするには、retainフラグを設定して当該トピックに空のメッセージを発行します。</p>
|
||||
<p>このノードの利用のためには、MQTTブローカへの接続設定が必要です。この設定は鉛筆アイコンをクリックすることで行えます。</p>
|
||||
<p>MQTT(inおよびout)ノードはブローカへの接続設定を必要に応じて共有できます。</p>
|
||||
|
||||
<h4>動的制御</h4>
|
||||
本ノードによって接続を動的に制御できます。本ノードが以下の制御メッセージのいずれかを受け取った際は、ペイロードと同じ様にパブリッシュされることはありません。
|
||||
<h3>入力</h3>
|
||||
<dl class="message-properties">
|
||||
<dt>action <span class="property-type">文字列</span></dt>
|
||||
<dd>本ノードが行う動作の名前。利用可能な動作は<code>"connect"</code>、<code>"disconnect"</code>、<code>"subscribe"</code>、<code>"unsubscribe"</code>です。</dd>
|
||||
<dt class="optional">broker <span class="property-type">broker</span> </dt>
|
||||
<dd><code>"connect"</code>の動作に対して、本プロパティは次の様な個々のブローカ設定を上書きします: <ul>
|
||||
<li><code>broker</code></li>
|
||||
<li><code>port</code></li>
|
||||
<li><code>url</code> - 完全な接続URLを提供するために、brokerとportを上書き</li>
|
||||
<li><code>username</code></li>
|
||||
<li><code>password</code></li>
|
||||
</ul>
|
||||
<p>本プロパティが設定され既にブローカが接続されている場合、<code>force</code>プロパティを設定しない限り、エラーがログに記録されます。設定された場合はブローカから切断され、新しい設定を適用して再接続します。</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="mqtt-broker">
|
||||
@@ -70,5 +132,4 @@
|
||||
<h4>WebSocket</h4>
|
||||
<p>WebSocketによる接続を行うように設定できます。WebSocketを利用するには、サーバフィールドに接続先のURIを完全な形式で記述します。以下に例を示します。</p>
|
||||
<pre>ws://example.com:4000/mqtt</pre>
|
||||
|
||||
</script>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<h3>詳細</h3>
|
||||
<p>「列名」にカラム名のリストを指定することができます。CSVからオブジェクトに変換を行う際、カラム名をプロパティ名として使用します。「列名」の代わりに、CSVデータの1行目にカラム名を含めることもできます。</p>
|
||||
<p>CSVへの変換を行う際には、オブジェクトから取り出すべきプロパティとその順序を「列名」を参照して決めます。</p>
|
||||
<p>列名がない場合、本ノードは<code>msg.columns</code>プロパティの単純なコンマ区切りリストを使用して、何を抽出するかを決定します。もしそれが存在しない場合、すべてのオブジェクトプロパティを見つけた順序で出力します。</p>
|
||||
<p>列名がない場合、本ノードは<code>msg.columns</code>プロパティの単純なコンマ区切りリストを使用して、何をどの順序で抽出するかを決定します。もし存在しない場合、すべてのオブジェクトプロパティを見つけた順序で出力します。</p>
|
||||
<p>入力が配列の場合には、「列名」はカラム名を表す行の出力指定がされた場合だけ用います。</p>
|
||||
<p>「数値を変換する」オプションがチェックされている場合、文字列型の数値が数値として返されます。つまり「1,"1.5",2」の真ん中の値が数値になります。</p>
|
||||
<p>「空の文字を含む」オプションがチェックされている場合、空の文字列が結果に返されます。つまり「"1","",3」の真ん中の値が空の文字列になります。</p>
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
<p>このモードで処理する際には、メッセージ数を予め知ることができないため、<code>msg.parts.count</code>プロパティは設定されません。従って、<b>join</b>ノードの「自動モード」と組み合わせることはできません。</p>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/html" data-help-name="join">
|
||||
<p>メッセージ列を結合して一つのメッセージにします。</p>
|
||||
<p>メッセージの結合には次の3つのモードが利用できます。</p>
|
||||
@@ -80,6 +79,10 @@
|
||||
</dd>
|
||||
<dt class="optional">complete</dt>
|
||||
<dd>設定されている場合、本ノードはペイロードを追加し、保持しているメッセージを送信します。ペイロードを追加したくない場合は、msgから削除してください。</dd>
|
||||
<dt class="optional">reset</dt>
|
||||
<dd>設定されている場合、本ノードは部分的に完成したメッセージを送信せず、削除します。</dd>
|
||||
<dt class="optional">restartTimeout</dt>
|
||||
<dd>設定されている場合、本ノードにタイムアウトが設定され、そのタイムアウトを用いて処理が再開されます。</dd>
|
||||
</dl>
|
||||
<h3>詳細</h3>
|
||||
|
||||
@@ -96,7 +99,7 @@
|
||||
</ul>
|
||||
<p>出力メッセージのその他のプロパティはメッセージを送信する直前のメッセージをコピーします。</p>
|
||||
<p>「<i>合計値</i>」には出力メッセージを送信する前に受信すべきメッセージ数を指定します。オブジェクト出力の場合、この合計値に達すると後続メッセージの到着毎にメッセージを出力するように設定することもできます。</p>
|
||||
<p>「<i>秒</i>」には新規メッセージを送信するまでの経過時間を設定します。</p>
|
||||
<p>「<i>秒</i>」には新規メッセージを送信するまでの経過時間を設定します。<code>msg.restartTimeout</code>プロパティを設定したメッセージを渡すことで、指定した時間で再開できます。</p>
|
||||
<p><code>msg.complete</code>プロパティを設定したメッセージを受信すると、出力メッセージを送信します。この時、メッセージ列の数をリセットします。</p>
|
||||
<p><code>msg.reset</code>プロパティを設定したメッセージを受信すると、部分的に受信済みのメッセージを破棄します。これらのメッセージは送信されません。この時、メッセージ列の数をリセットします。</p>
|
||||
|
||||
|
||||
@@ -433,7 +433,8 @@
|
||||
"label": {
|
||||
"type": "종류",
|
||||
"path": "패스",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "서브 프로토콜"
|
||||
},
|
||||
"listenon": "대기",
|
||||
"connectto": "접속",
|
||||
|
||||
@@ -461,7 +461,8 @@
|
||||
"label": {
|
||||
"type": "Тип",
|
||||
"path": "Путь",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "Подпротокол"
|
||||
},
|
||||
"listenon": "Слушать на ...",
|
||||
"connectto": "Присоединиться к ...",
|
||||
|
||||
@@ -454,7 +454,8 @@
|
||||
"label": {
|
||||
"type": "类型",
|
||||
"path": "路径",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "子协议"
|
||||
},
|
||||
"listenon": "监听",
|
||||
"connectto": "连接",
|
||||
|
||||
@@ -458,7 +458,8 @@
|
||||
"label": {
|
||||
"type": "類型",
|
||||
"path": "路徑",
|
||||
"url": "URL"
|
||||
"url": "URL",
|
||||
"subprotocol": "子协议"
|
||||
},
|
||||
"listenon": "監聽",
|
||||
"connectto": "連接",
|
||||
|
||||
@@ -83,6 +83,7 @@ function createNode(flow,config) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
Object.defineProperty(conf,'_module', {value: typeRegistry.getNodeInfo(type), enumerable: false, writable: true })
|
||||
Object.defineProperty(conf,'_flow', {value: flow, enumerable: false, writable: true })
|
||||
newNode = new nodeTypeConstructor(conf);
|
||||
} catch (err) {
|
||||
|
||||
@@ -59,6 +59,9 @@ function Node(n) {
|
||||
// which we can tolerate as they are the same object.
|
||||
Object.defineProperty(this,'_flow', {value: n._flow, enumerable: false, writable: true })
|
||||
}
|
||||
if (n._module) {
|
||||
Object.defineProperty(this,'_module', {value: n._module, enumerable: false, writable: true })
|
||||
}
|
||||
this.updateWires(n.wires);
|
||||
}
|
||||
|
||||
@@ -496,7 +499,12 @@ function log_helper(self, level, msg) {
|
||||
if (self.name) {
|
||||
o.name = self.name;
|
||||
}
|
||||
self._flow.log(o);
|
||||
// See https://github.com/node-red/node-red/issues/3327
|
||||
try {
|
||||
self._flow.log(o);
|
||||
} catch(err) {
|
||||
logUnexpectedError(self, err)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Log an INFO level message
|
||||
@@ -576,4 +584,59 @@ Node.prototype.status = function(status) {
|
||||
this._flow.handleStatus(this,status);
|
||||
};
|
||||
|
||||
|
||||
function inspectObject(flow) {
|
||||
try {
|
||||
let properties = new Set()
|
||||
let currentObj = flow
|
||||
do {
|
||||
if (!Object.getPrototypeOf(currentObj)) { break }
|
||||
Object.getOwnPropertyNames(currentObj).map(item => properties.add(item))
|
||||
} while ((currentObj = Object.getPrototypeOf(currentObj)))
|
||||
let propList = [...properties.keys()].map(item => `${item}[${(typeof flow[item])[0]}]`)
|
||||
propList.sort();
|
||||
let result = [];
|
||||
let line = "";
|
||||
while (propList.length > 0) {
|
||||
let prop = propList.shift()
|
||||
if (line.length+prop.length > 80) {
|
||||
result.push(line)
|
||||
line = "";
|
||||
} else {
|
||||
line += " "+prop
|
||||
}
|
||||
}
|
||||
if (line.length > 0) {
|
||||
result.push(line);
|
||||
}
|
||||
return result.join("\n ")
|
||||
|
||||
} catch(err) {
|
||||
return "Failed to capture object properties: "+err.toString()
|
||||
}
|
||||
}
|
||||
|
||||
function logUnexpectedError(node, error) {
|
||||
let moduleInfo = node._module?`${node._module.module}@${node._module.version}`:"undefined"
|
||||
Log.error(`
|
||||
********************************************************************
|
||||
Unexpected Node Error
|
||||
${error.stack}
|
||||
Node:
|
||||
Type: ${node.type}
|
||||
Module: ${moduleInfo}
|
||||
ID: ${node._alias||node.id}
|
||||
Properties:
|
||||
${inspectObject(node)}
|
||||
Flow: ${node._flow?node._flow.path:'undefined'}
|
||||
Type: ${node._flow?node._flow.TYPE:'undefined'}
|
||||
Properties:
|
||||
${node._flow?inspectObject(node._flow):'undefined'}
|
||||
|
||||
Please report this issue, including the information logged above:
|
||||
https://github.com/node-red/node-red/issues/
|
||||
********************************************************************
|
||||
`)
|
||||
}
|
||||
|
||||
module.exports = Node;
|
||||
|
||||
@@ -425,7 +425,7 @@ describe('rbe node', function() {
|
||||
});
|
||||
|
||||
it('should not send output if x away or greater from original value (narrowbandEq)', function(done) {
|
||||
var flow = [{"id":"n1", "type":"rbe", func:"narrowbandEq", gap:"10", inout:"out", wires:[["n2"]] },
|
||||
var flow = [{"id":"n1", "type":"rbe", func:"narrowbandEq", gap:"10", inout:"out", start:"1", wires:[["n2"]] },
|
||||
{id:"n2", type:"helper"} ];
|
||||
helper.load(testNode, flow, function() {
|
||||
var n1 = helper.getNode("n1");
|
||||
@@ -445,6 +445,7 @@ describe('rbe node', function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
n1.emit("input", {payload:100});
|
||||
n1.emit("input", {payload:0});
|
||||
n1.emit("input", {payload:10});
|
||||
n1.emit("input", {payload:5});
|
||||
|
||||
@@ -366,6 +366,18 @@ describe('websocket Node', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle protocol property', function(done) {
|
||||
var flow = [
|
||||
{ id: "server", type: "websocket-listener", path: "/ws" },
|
||||
{ id: "n1", type: "websocket-client", path: getWsUrl("/ws") },
|
||||
{ id: "n2", type: "websocket-client", path: getWsUrl("/ws"), subprotocol: "testprotocol1, testprotocol2" }];
|
||||
helper.load(websocketNode, flow, function() {
|
||||
helper.getNode("n1").should.have.property("subprotocol", []);
|
||||
helper.getNode("n2").should.have.property("subprotocol", ["testprotocol1","testprotocol2"]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should connect to server', function(done) {
|
||||
var flow = [
|
||||
{ id: "server", type: "websocket-listener", path: "/ws" },
|
||||
@@ -378,6 +390,18 @@ describe('websocket Node', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should initiate with subprotocol', function(done) {
|
||||
var flow = [
|
||||
{ id: "server", type: "websocket-listener", path: "/ws" },
|
||||
{ id: "n2", type: "websocket-client", path: getWsUrl("/ws"), subprotocol: "testprotocol" }];
|
||||
helper.load(websocketNode, flow, function() {
|
||||
getSocket('server').on('connection', function (sock) {
|
||||
sock.should.have.property("protocol", "testprotocol")
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should close on delete', function(done) {
|
||||
var flow = [
|
||||
{ id: "server", type: "websocket-listener", path: "/ws" },
|
||||
|
||||
Reference in New Issue
Block a user