Merge branch 'dev' into search-options

This commit is contained in:
Nick O'Leary
2022-03-03 21:52:52 +00:00
committed by GitHub
32 changed files with 455 additions and 130 deletions

View File

@@ -600,6 +600,14 @@ RED.nodes = (function() {
RED.events.emit('nodes:add',n);
}
function addLink(l) {
if (nodeLinks[l.source.id]) {
const isUnique = nodeLinks[l.source.id].out.every(function(link) {
return link.sourcePort !== l.sourcePort || link.target.id !== l.target.id
})
if (!isUnique) {
return
}
}
links.push(l);
if (l.source) {
// Possible the node hasn't been added yet

View File

@@ -350,6 +350,15 @@ RED.popover = (function() {
}
}
target.on("remove", function (ev) {
if (timer) {
clearTimeout(timer);
}
if (active) {
active = false;
setTimeout(closePopup,delay.hide);
}
});
if (trigger === 'hover') {
target.on('mouseenter',function(e) {
clearTimeout(timer);

View File

@@ -334,6 +334,9 @@ RED.deploy = (function() {
var invalidNodes = [];
RED.nodes.eachConfig(function(node) {
if (node.valid === undefined) {
RED.editor.validateNode(node);
}
if (!node.valid && !node.d) {
invalidNodes.push(getNodeInfo(node));
}

View File

@@ -577,7 +577,7 @@ RED.editor.codeEditor.monaco = (function() {
createMonacoCompletionItem("set (flow context)", 'flow.set("${1:name}", ${1:value});','Set a value in flow context',range),
createMonacoCompletionItem("get (global context)", 'global.get("${1:name}");','Get a value from global context',range),
createMonacoCompletionItem("set (global context)", 'global.set("${1:name}", ${1:value});','Set a value in global context',range),
createMonacoCompletionItem("get (env)", 'env.get("${1:name}");','Get env variable value',range),
createMonacoCompletionItem("get (env)", 'env.get("${1|NR_NODE_ID,NR_NODE_NAME,NR_NODE_PATH,NR_GROUP_ID,NR_GROUP_NAME,NR_FLOW_ID,NR_FLOW_NAME|}");','Get env variable value',range),
createMonacoCompletionItem("cloneMessage (RED.util)", 'RED.util.cloneMessage(${1:msg});',
["```typescript",
"RED.util.cloneMessage<T extends registry.NodeMessage>(msg: T): T",

View File

@@ -625,7 +625,7 @@ RED.keyboard = (function() {
pane.find("#red-ui-settings-tab-keyboard-filter").searchBox({
delay: 100,
change: function() {
var filterValue = $(this).val().trim();
var filterValue = $(this).val().trim().toLowerCase();
if (filterValue === "") {
shortcutList.editableList('filter', null);
} else {

View File

@@ -119,6 +119,7 @@ RED.search = (function() {
val = extractFlag(val,"config",flags);
val = extractFlag(val,"subflow",flags);
val = extractFlag(val,"hidden",flags);
val = extractFlag(val,"modified",flags);
// uses:<node-id>
val = extractValue(val,"uses",flags);
@@ -164,6 +165,11 @@ RED.search = (function() {
continue;
}
}
if (flags.hasOwnProperty("modified")) {
if (!node.node.changed && !node.node.moved) {
continue;
}
}
if (flags.hasOwnProperty("hidden")) {
// Only tabs can be hidden
if (node.node.type !== 'tab') {

View File

@@ -2338,14 +2338,21 @@ RED.view = (function() {
var removedSubflowStatus;
var subflowInstances = [];
var historyEvents = [];
var addToRemovedLinks = function(links) {
if(!links) { return; }
var _links = Array.isArray(links) ? links : [links];
_links.forEach(function(l) {
removedLinks.push(l);
selectedLinks.remove(l);
})
}
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)
addToRemovedLinks(reconnectResult.removedLinks)
}
var startDirty = RED.nodes.dirty();
@@ -2377,7 +2384,7 @@ RED.view = (function() {
var removedEntities = RED.nodes.remove(node.id);
removedNodes.push(node);
removedNodes = removedNodes.concat(removedEntities.nodes);
removedLinks = removedLinks.concat(removedEntities.links);
addToRemovedLinks(removedNodes.removedLinks);
if (node.g) {
var group = RED.nodes.group(node.g);
if (selectedGroups.indexOf(group) === -1) {
@@ -2410,20 +2417,20 @@ RED.view = (function() {
if (removedSubflowOutputs.length > 0) {
result = RED.subflow.removeOutput(removedSubflowOutputs);
if (result) {
removedLinks = removedLinks.concat(result.links);
addToRemovedLinks(result.links);
}
}
// Assume 0/1 inputs
if (removedSubflowInputs.length == 1) {
result = RED.subflow.removeInput();
if (result) {
removedLinks = removedLinks.concat(result.links);
addToRemovedLinks(result.links);
}
}
if (removedSubflowStatus) {
result = RED.subflow.removeStatus();
if (result) {
removedLinks = removedLinks.concat(result.links);
addToRemovedLinks(result.links);
}
}

View File

@@ -428,6 +428,9 @@ RED.workspaces = (function() {
}
}
})
RED.actions.add("core:list-modified-nodes",function() {
RED.actions.invoke("core:search","is:modified ");
})
RED.actions.add("core:list-hidden-flows",function() {
RED.actions.invoke("core:search","is:hidden ");
})

View File

@@ -263,6 +263,20 @@ declare class global {
static keys(store: string, callback: Function);
}
declare class env {
/** Get an environment variable value */
static get(name:string);
/**
* Get an environment variable value
*
* Predefined node-red variables...
* * `NR_NODE_ID` - the ID of the node
* * `NR_NODE_NAME` - the Name of the node
* * `NR_NODE_PATH` - the Path of the node
* * `NR_GROUP_ID` - the ID of the containing group
* * `NR_GROUP_NAME` - the Name of the containing group
* * `NR_FLOW_ID` - the ID of the flow the node is on
* * `NR_FLOW_NAME` - the Name of the flow the node is on
* @param name Name of the environment variable to get
* @example
* ```const flowName = env.get("NR_FLOW_NAME");```
*/
static get(name:string) :string;
}