mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'master' into handle-bad-subflow
This commit is contained in:
@@ -100,16 +100,36 @@ RED.multiplayer = (function () {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (isInWorkspace) {
|
||||
const chart = $('#red-ui-workspace-chart')
|
||||
const chartOffset = chart.offset()
|
||||
const scaleFactor = RED.view.scale()
|
||||
location.cursor = {
|
||||
x: (lastPosition[0] - chartOffset.left + chart.scrollLeft()) / scaleFactor,
|
||||
y: (lastPosition[1] - chartOffset.top + chart.scrollTop()) / scaleFactor
|
||||
}
|
||||
}
|
||||
return location
|
||||
}
|
||||
|
||||
let publishLocationTimeout
|
||||
let lastPosition = [0,0]
|
||||
let isInWorkspace = false
|
||||
|
||||
function publishLocation () {
|
||||
const location = getLocation()
|
||||
if (location.workspace !== 0) {
|
||||
log('send', 'multiplayer/location', location)
|
||||
RED.comms.send('multiplayer/location', location)
|
||||
if (!publishLocationTimeout) {
|
||||
publishLocationTimeout = setTimeout(() => {
|
||||
const location = getLocation()
|
||||
if (location.workspace !== 0) {
|
||||
log('send', 'multiplayer/location', location)
|
||||
RED.comms.send('multiplayer/location', location)
|
||||
}
|
||||
publishLocationTimeout = null
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function revealUser(location, skipWorkspace) {
|
||||
if (location.node) {
|
||||
// Need to check if this is a known node, so we can fall back to revealing
|
||||
@@ -271,7 +291,16 @@ RED.multiplayer = (function () {
|
||||
|
||||
function removeUserLocation (sessionId) {
|
||||
updateUserLocation(sessionId, {})
|
||||
removeUserCursor(sessionId)
|
||||
}
|
||||
function removeUserCursor (sessionId) {
|
||||
// return
|
||||
if (sessions[sessionId]?.cursor) {
|
||||
sessions[sessionId].cursor.parentNode.removeChild(sessions[sessionId].cursor)
|
||||
delete sessions[sessionId].cursor
|
||||
}
|
||||
}
|
||||
|
||||
function updateUserLocation (sessionId, location) {
|
||||
let viewTouched = false
|
||||
const oldLocation = sessions[sessionId].location
|
||||
@@ -291,6 +320,28 @@ RED.multiplayer = (function () {
|
||||
// console.log(`updateUserLocation sessionId:${sessionId} oldWS:${oldLocation?.workspace} newWS:${location.workspace}`)
|
||||
if (location.workspace) {
|
||||
getWorkspaceTray(location.workspace).addUser(sessionId)
|
||||
if (location.cursor && location.workspace === RED.workspaces.active()) {
|
||||
if (!sessions[sessionId].cursor) {
|
||||
const user = sessions[sessionId].user
|
||||
const cursorIcon = document.createElementNS("http://www.w3.org/2000/svg","g");
|
||||
cursorIcon.setAttribute("class", "red-ui-multiplayer-annotation")
|
||||
cursorIcon.appendChild(createAnnotationUser(user, true))
|
||||
$(cursorIcon).css({
|
||||
transform: `translate( ${location.cursor.x}px, ${location.cursor.y}px)`,
|
||||
transition: 'transform 0.1s linear'
|
||||
})
|
||||
$("#red-ui-workspace-chart svg").append(cursorIcon)
|
||||
sessions[sessionId].cursor = cursorIcon
|
||||
} else {
|
||||
const cursorIcon = sessions[sessionId].cursor
|
||||
$(cursorIcon).css({
|
||||
transform: `translate( ${location.cursor.x}px, ${location.cursor.y}px)`
|
||||
})
|
||||
|
||||
}
|
||||
} else if (sessions[sessionId].cursor) {
|
||||
removeUserCursor(sessionId)
|
||||
}
|
||||
}
|
||||
if (location.node) {
|
||||
addUserToNode(sessionId, location.node)
|
||||
@@ -309,67 +360,69 @@ RED.multiplayer = (function () {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
function createAnnotationUser(user, pointer = false) {
|
||||
const radius = 20
|
||||
const halfRadius = radius/2
|
||||
const group = document.createElementNS("http://www.w3.org/2000/svg","g");
|
||||
const badge = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
let shapePath
|
||||
if (!pointer) {
|
||||
shapePath = `M 0 ${halfRadius} a ${halfRadius} ${halfRadius} 0 1 1 ${radius} 0 a ${halfRadius} ${halfRadius} 0 1 1 -${radius} 0 z`
|
||||
} else {
|
||||
shapePath = `M 0 0 h ${halfRadius} a ${halfRadius} ${halfRadius} 0 1 1 -${halfRadius} ${halfRadius} z`
|
||||
}
|
||||
badge.setAttribute('d', shapePath)
|
||||
badge.setAttribute("class", "red-ui-multiplayer-annotation-background")
|
||||
group.appendChild(badge)
|
||||
if (user && user.profileColor !== undefined) {
|
||||
badge.setAttribute("class", "red-ui-multiplayer-annotation-background red-ui-user-profile-color-" + user.profileColor)
|
||||
}
|
||||
if (user && user.image) {
|
||||
const image = document.createElementNS("http://www.w3.org/2000/svg","image");
|
||||
image.setAttribute("width", radius)
|
||||
image.setAttribute("height", radius)
|
||||
image.setAttribute("href", user.image)
|
||||
image.setAttribute("clip-path", "circle("+Math.floor(radius/2)+")")
|
||||
group.appendChild(image)
|
||||
} else if (user && user.anonymous) {
|
||||
const anonIconHead = document.createElementNS("http://www.w3.org/2000/svg","circle");
|
||||
anonIconHead.setAttribute("cx", radius/2)
|
||||
anonIconHead.setAttribute("cy", radius/2 - 2)
|
||||
anonIconHead.setAttribute("r", 2.4)
|
||||
anonIconHead.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
|
||||
group.appendChild(anonIconHead)
|
||||
const anonIconBody = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
anonIconBody.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
|
||||
// anonIconBody.setAttribute("d",`M ${radius/2 - 4} ${radius/2 + 1} h 8 v4 h -8 z`);
|
||||
anonIconBody.setAttribute("d",`M ${radius/2} ${radius/2 + 5} h -2.5 c -2 1 -2 -5 0.5 -4.5 c 2 1 2 1 4 0 c 2.5 -0.5 2.5 5.5 0 4.5 z`);
|
||||
group.appendChild(anonIconBody)
|
||||
} else {
|
||||
const labelText = user.username ? user.username.substring(0,2) : user
|
||||
const label = document.createElementNS("http://www.w3.org/2000/svg","text");
|
||||
if (user.username) {
|
||||
label.setAttribute("class","red-ui-multiplayer-annotation-label");
|
||||
label.textContent = user.username.substring(0,2)
|
||||
} else {
|
||||
label.setAttribute("class","red-ui-multiplayer-annotation-label red-ui-multiplayer-user-count")
|
||||
label.textContent = user
|
||||
}
|
||||
label.setAttribute("text-anchor", "middle")
|
||||
label.setAttribute("x",radius/2);
|
||||
label.setAttribute("y",radius/2 + 3);
|
||||
group.appendChild(label)
|
||||
}
|
||||
const border = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
border.setAttribute('d', shapePath)
|
||||
border.setAttribute("class", "red-ui-multiplayer-annotation-border")
|
||||
group.appendChild(border)
|
||||
return group
|
||||
}
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
|
||||
function createAnnotationUser(user) {
|
||||
|
||||
const group = document.createElementNS("http://www.w3.org/2000/svg","g");
|
||||
const badge = document.createElementNS("http://www.w3.org/2000/svg","circle");
|
||||
const radius = 20
|
||||
badge.setAttribute("cx",radius/2);
|
||||
badge.setAttribute("cy",radius/2);
|
||||
badge.setAttribute("r",radius/2);
|
||||
badge.setAttribute("class", "red-ui-multiplayer-annotation-background")
|
||||
group.appendChild(badge)
|
||||
if (user && user.profileColor !== undefined) {
|
||||
badge.setAttribute("class", "red-ui-multiplayer-annotation-background red-ui-user-profile-color-" + user.profileColor)
|
||||
}
|
||||
if (user && user.image) {
|
||||
const image = document.createElementNS("http://www.w3.org/2000/svg","image");
|
||||
image.setAttribute("width", radius)
|
||||
image.setAttribute("height", radius)
|
||||
image.setAttribute("href", user.image)
|
||||
image.setAttribute("clip-path", "circle("+Math.floor(radius/2)+")")
|
||||
group.appendChild(image)
|
||||
} else if (user && user.anonymous) {
|
||||
const anonIconHead = document.createElementNS("http://www.w3.org/2000/svg","circle");
|
||||
anonIconHead.setAttribute("cx", radius/2)
|
||||
anonIconHead.setAttribute("cy", radius/2 - 2)
|
||||
anonIconHead.setAttribute("r", 2.4)
|
||||
anonIconHead.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
|
||||
group.appendChild(anonIconHead)
|
||||
const anonIconBody = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
anonIconBody.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
|
||||
// anonIconBody.setAttribute("d",`M ${radius/2 - 4} ${radius/2 + 1} h 8 v4 h -8 z`);
|
||||
anonIconBody.setAttribute("d",`M ${radius/2} ${radius/2 + 5} h -2.5 c -2 1 -2 -5 0.5 -4.5 c 2 1 2 1 4 0 c 2.5 -0.5 2.5 5.5 0 4.5 z`);
|
||||
group.appendChild(anonIconBody)
|
||||
} else {
|
||||
const labelText = user.username ? user.username.substring(0,2) : user
|
||||
const label = document.createElementNS("http://www.w3.org/2000/svg","text");
|
||||
if (user.username) {
|
||||
label.setAttribute("class","red-ui-multiplayer-annotation-label");
|
||||
label.textContent = user.username.substring(0,2)
|
||||
} else {
|
||||
label.setAttribute("class","red-ui-multiplayer-annotation-label red-ui-multiplayer-user-count")
|
||||
label.textContent = user
|
||||
}
|
||||
label.setAttribute("text-anchor", "middle")
|
||||
label.setAttribute("x",radius/2);
|
||||
label.setAttribute("y",radius/2 + 3);
|
||||
group.appendChild(label)
|
||||
}
|
||||
const border = document.createElementNS("http://www.w3.org/2000/svg","circle");
|
||||
border.setAttribute("cx",radius/2);
|
||||
border.setAttribute("cy",radius/2);
|
||||
border.setAttribute("r",radius/2);
|
||||
border.setAttribute("class", "red-ui-multiplayer-annotation-border")
|
||||
group.appendChild(border)
|
||||
|
||||
|
||||
|
||||
return group
|
||||
}
|
||||
|
||||
|
||||
RED.view.annotations.register("red-ui-multiplayer",{
|
||||
type: 'badge',
|
||||
@@ -479,6 +532,24 @@ RED.multiplayer = (function () {
|
||||
RED.comms.send('multiplayer/disconnect', disconnectInfo)
|
||||
RED.settings.removeLocal('multiplayer:sessionId')
|
||||
})
|
||||
|
||||
const chart = $('#red-ui-workspace-chart')
|
||||
chart.on('mousemove', function (evt) {
|
||||
lastPosition[0] = evt.clientX
|
||||
lastPosition[1] = evt.clientY
|
||||
publishLocation()
|
||||
})
|
||||
chart.on('scroll', function (evt) {
|
||||
publishLocation()
|
||||
})
|
||||
chart.on('mouseenter', function () {
|
||||
isInWorkspace = true
|
||||
publishLocation()
|
||||
})
|
||||
chart.on('mouseleave', function () {
|
||||
isInWorkspace = false
|
||||
publishLocation()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,13 @@ RED.nodes = (function() {
|
||||
|
||||
var exports = {
|
||||
setModulePendingUpdated: function(module,version) {
|
||||
moduleList[module].pending_version = version;
|
||||
if (!!RED.plugins.getModule(module)) {
|
||||
// The module updated is a plugin
|
||||
RED.plugins.getModule(module).pending_version = version;
|
||||
} else {
|
||||
moduleList[module].pending_version = version;
|
||||
}
|
||||
|
||||
RED.events.emit("registry:module-updated",{module:module,version:version});
|
||||
},
|
||||
getModule: function(module) {
|
||||
@@ -1032,21 +1038,29 @@ RED.nodes = (function() {
|
||||
return {nodes:removedNodes,links:removedLinks, groups: removedGroups, junctions: removedJunctions};
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Subflow to the Workspace
|
||||
*
|
||||
* @param {object} sf The Subflow to add.
|
||||
* @param {boolean|undefined} createNewIds Whether to update the name.
|
||||
*/
|
||||
function addSubflow(sf, createNewIds) {
|
||||
if (createNewIds) {
|
||||
var subflowNames = Object.keys(subflows).map(function(sfid) {
|
||||
return subflows[sfid].name;
|
||||
});
|
||||
// Update the Subflow name to highlight that this is a copy
|
||||
const subflowNames = Object.keys(subflows).map(function (sfid) {
|
||||
return subflows[sfid].name || "";
|
||||
})
|
||||
subflowNames.sort()
|
||||
|
||||
subflowNames.sort();
|
||||
var copyNumber = 1;
|
||||
var subflowName = sf.name;
|
||||
let copyNumber = 1;
|
||||
let subflowName = sf.name;
|
||||
subflowNames.forEach(function(name) {
|
||||
if (subflowName == name) {
|
||||
subflowName = sf.name + " (" + copyNumber + ")";
|
||||
copyNumber++;
|
||||
subflowName = sf.name+" ("+copyNumber+")";
|
||||
}
|
||||
});
|
||||
|
||||
sf.name = subflowName;
|
||||
}
|
||||
|
||||
@@ -2027,6 +2041,8 @@ RED.nodes = (function() {
|
||||
if (matchingSubflow) {
|
||||
subflow_denylist[n.id] = matchingSubflow;
|
||||
} else {
|
||||
const oldId = n.id;
|
||||
|
||||
subflow_map[n.id] = n;
|
||||
if (createNewIds || options.importMap[n.id] === "copy") {
|
||||
nid = getID();
|
||||
@@ -2054,7 +2070,7 @@ RED.nodes = (function() {
|
||||
n.status.id = getID();
|
||||
}
|
||||
new_subflows.push(n);
|
||||
addSubflow(n,createNewIds || options.importMap[n.id] === "copy");
|
||||
addSubflow(n,createNewIds || options.importMap[oldId] === "copy");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2418,11 +2434,28 @@ RED.nodes = (function() {
|
||||
} else {
|
||||
delete n.g
|
||||
}
|
||||
// If importing into a subflow, ensure an outbound-link doesn't get added
|
||||
if (activeSubflow && /^link /.test(n.type) && n.links) {
|
||||
// If importing a link node, ensure both ends of each link are either:
|
||||
// - not in a subflow
|
||||
// - both in the same subflow (not for link call node)
|
||||
if (/^link /.test(n.type) && n.links) {
|
||||
n.links = n.links.filter(function(id) {
|
||||
const otherNode = node_map[id] || RED.nodes.node(id);
|
||||
return (otherNode && otherNode.z === activeWorkspace);
|
||||
if (!otherNode) {
|
||||
// Cannot find other end - remove the link
|
||||
return false
|
||||
}
|
||||
if (otherNode.z === n.z) {
|
||||
// Both ends in the same flow/subflow
|
||||
return true
|
||||
} else if (n.type === "link call" && !getSubflow(otherNode.z)) {
|
||||
// Link call node can call out of a subflow as long as otherNode is
|
||||
// not in a subflow
|
||||
return true
|
||||
} else if (!!getSubflow(n.z) || !!getSubflow(otherNode.z)) {
|
||||
// One end is in a subflow - remove the link
|
||||
return false
|
||||
}
|
||||
return true
|
||||
});
|
||||
}
|
||||
for (var d3 in n._def.defaults) {
|
||||
|
@@ -205,7 +205,9 @@ RED.actionList = (function() {
|
||||
}
|
||||
|
||||
function init() {
|
||||
RED.actions.add("core:show-action-list",show);
|
||||
if (RED.settings.theme("menu.menu-item-action-list", true)) {
|
||||
RED.actions.add("core:show-action-list",show);
|
||||
}
|
||||
|
||||
RED.events.on("editor:open",function() { disabled = true; });
|
||||
RED.events.on("editor:close",function() { disabled = false; });
|
||||
|
@@ -32,24 +32,28 @@ RED.contextMenu = (function () {
|
||||
const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
|
||||
let hasGroup, isAllGroups = true, hasDisabledNode, hasEnabledNode, hasLabeledNode, hasUnlabeledNode;
|
||||
if (hasSelection) {
|
||||
selection.nodes.forEach(n => {
|
||||
const nodes = selection.nodes.slice();
|
||||
while (nodes.length) {
|
||||
const n = nodes.shift();
|
||||
if (n.type === 'group') {
|
||||
hasGroup = true;
|
||||
nodes.push(...n.nodes);
|
||||
} else {
|
||||
isAllGroups = false;
|
||||
}
|
||||
if (n.d) {
|
||||
hasDisabledNode = true;
|
||||
} else {
|
||||
hasEnabledNode = true;
|
||||
if (n.d) {
|
||||
hasDisabledNode = true;
|
||||
} else {
|
||||
hasEnabledNode = true;
|
||||
}
|
||||
}
|
||||
if (n.l === undefined || n.l) {
|
||||
hasLabeledNode = true;
|
||||
} else {
|
||||
hasUnlabeledNode = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const offset = $("#red-ui-workspace-chart").offset()
|
||||
|
||||
let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
|
||||
@@ -61,10 +65,11 @@ RED.contextMenu = (function () {
|
||||
addY = gridSize * Math.floor(addY / gridSize)
|
||||
}
|
||||
|
||||
menuItems.push(
|
||||
{ onselect: 'core:show-action-list', label: RED._("contextMenu.showActionList"), onpostselect: function () { } }
|
||||
)
|
||||
|
||||
if (RED.settings.theme("menu.menu-item-action-list", true)) {
|
||||
menuItems.push(
|
||||
{ onselect: 'core:show-action-list', label: RED._("contextMenu.showActionList"), onpostselect: function () { } }
|
||||
)
|
||||
}
|
||||
const insertOptions = []
|
||||
menuItems.push({ label: RED._("contextMenu.insert"), options: insertOptions })
|
||||
insertOptions.push(
|
||||
|
@@ -589,7 +589,9 @@ RED.deploy = (function() {
|
||||
RED.notify('<p>' + RED._("deploy.successfulDeploy") + '</p>', "success");
|
||||
}
|
||||
const flowsToLock = new Set()
|
||||
// Node's properties cannot be modified if its workspace is locked.
|
||||
function ensureUnlocked(id) {
|
||||
// TODO: `RED.nodes.subflow` is useless
|
||||
const flow = id && (RED.nodes.workspace(id) || RED.nodes.subflow(id) || null);
|
||||
const isLocked = flow ? flow.locked : false;
|
||||
if (flow && isLocked) {
|
||||
@@ -642,6 +644,7 @@ RED.deploy = (function() {
|
||||
delete confNode.credentials;
|
||||
}
|
||||
});
|
||||
// Subflow cannot be locked
|
||||
RED.nodes.eachSubflow(function (subflow) {
|
||||
if (subflow.changed) {
|
||||
subflow.changed = false;
|
||||
@@ -650,12 +653,18 @@ RED.deploy = (function() {
|
||||
});
|
||||
RED.nodes.eachWorkspace(function (ws) {
|
||||
if (ws.changed || ws.added) {
|
||||
ensureUnlocked(ws.z)
|
||||
// Ensure the Workspace is unlocked to modify its properties.
|
||||
ensureUnlocked(ws.id);
|
||||
ws.changed = false;
|
||||
delete ws.added
|
||||
if (flowsToLock.has(ws)) {
|
||||
ws.locked = true;
|
||||
flowsToLock.delete(ws);
|
||||
}
|
||||
RED.events.emit("flows:change", ws)
|
||||
}
|
||||
});
|
||||
// Ensures all workspaces to be locked have been locked.
|
||||
flowsToLock.forEach(flow => {
|
||||
flow.locked = true
|
||||
})
|
||||
|
@@ -497,7 +497,7 @@ RED.diff = (function() {
|
||||
}
|
||||
})
|
||||
if (c === 0) {
|
||||
result.text("none");
|
||||
result.text(RED._("diff.type.none"));
|
||||
} else {
|
||||
list.appendTo(result);
|
||||
}
|
||||
@@ -821,7 +821,7 @@ RED.diff = (function() {
|
||||
conflict = true;
|
||||
}
|
||||
row = $("<tr>").appendTo(nodePropertiesTableBody);
|
||||
$("<td>",{class:"red-ui-diff-list-cell-label"}).text("position").appendTo(row);
|
||||
$("<td>",{class:"red-ui-diff-list-cell-label"}).text(RED._("diff.type.position")).appendTo(row);
|
||||
localCell = $("<td>",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row);
|
||||
if (localNode) {
|
||||
localCell.addClass("red-ui-diff-status-"+(localChanged?"moved":"unchanged"));
|
||||
@@ -899,7 +899,7 @@ RED.diff = (function() {
|
||||
conflict = true;
|
||||
}
|
||||
row = $("<tr>").appendTo(nodePropertiesTableBody);
|
||||
$("<td>",{class:"red-ui-diff-list-cell-label"}).text("wires").appendTo(row);
|
||||
$("<td>",{class:"red-ui-diff-list-cell-label"}).text(RED._("diff.type.wires")).appendTo(row);
|
||||
localCell = $("<td>",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row);
|
||||
if (localNode) {
|
||||
if (!conflict) {
|
||||
@@ -2029,15 +2029,14 @@ RED.diff = (function() {
|
||||
if (!isSeparator) {
|
||||
var isOurs = /^..<<<<<<</.test(lineText);
|
||||
if (isOurs) {
|
||||
$('<span>').text("<<<<<<< Local Changes").appendTo(line);
|
||||
$('<span>').text("<<<<<<< " + RED._("diff.localChanges")).appendTo(line);
|
||||
hunk.localChangeStart = actualLineNumber;
|
||||
} else {
|
||||
hunk.remoteChangeEnd = actualLineNumber;
|
||||
$('<span>').text(">>>>>>> Remote Changes").appendTo(line);
|
||||
|
||||
$('<span>').text(">>>>>>> " + RED._("diff.remoteChanges")).appendTo(line);
|
||||
}
|
||||
diffRow.addClass("mergeHeader-"+(isOurs?"ours":"theirs"));
|
||||
$('<button class="red-ui-button red-ui-button-small" style="float: right; margin-right: 20px;"><i class="fa fa-angle-double-'+(isOurs?"down":"up")+'"></i> use '+(isOurs?"local":"remote")+' changes</button>')
|
||||
$('<button class="red-ui-button red-ui-button-small" style="float: right; margin-right: 20px;"><i class="fa fa-angle-double-'+(isOurs?"down":"up")+'"></i> '+RED._(isOurs?"diff.useLocalChanges":"diff.useRemoteChanges")+'</button>')
|
||||
.appendTo(line)
|
||||
.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
@@ -2119,7 +2118,7 @@ RED.diff = (function() {
|
||||
$("<h3>").text(commit.title).appendTo(content);
|
||||
$('<div class="commit-body"></div>').text(commit.comment).appendTo(content);
|
||||
var summary = $('<div class="commit-summary"></div>').appendTo(content);
|
||||
$('<div style="float: right">').text("Commit "+commit.sha).appendTo(summary);
|
||||
$('<div style="float: right">').text(RED._('diff.commit')+" "+commit.sha).appendTo(summary);
|
||||
$('<div>').text((commit.authorName||commit.author)+" - "+options.date).appendTo(summary);
|
||||
|
||||
if (commit.files) {
|
||||
|
@@ -157,6 +157,12 @@ RED.editor = (function() {
|
||||
}
|
||||
}
|
||||
if (valid && "validate" in definition[property]) {
|
||||
if (definition[property].hasOwnProperty("required") &&
|
||||
definition[property].required === false) {
|
||||
if (value === "") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
try {
|
||||
var opt = {};
|
||||
if (label) {
|
||||
@@ -183,6 +189,11 @@ RED.editor = (function() {
|
||||
});
|
||||
}
|
||||
} else if (valid) {
|
||||
if (definition[property].hasOwnProperty("required") && definition[property].required === false) {
|
||||
if (value === "") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// If the validator is not provided in node property => Check if the input has a validator
|
||||
if ("category" in node._def) {
|
||||
const isConfig = node._def.category === "config";
|
||||
@@ -888,7 +899,7 @@ RED.editor = (function() {
|
||||
const labelText = RED.editor.envVarList.lookupLabel(labels, labels["en-US"] || tenv.name, locale)
|
||||
const config = {
|
||||
env: tenv,
|
||||
id: '${' + parentEnv[0].name + '}',
|
||||
id: '${' + tenv.name + '}',
|
||||
type: type,
|
||||
label: labelText,
|
||||
__label__: `[env] ${labelText}`
|
||||
|
@@ -165,7 +165,13 @@ RED.editor.codeEditor.monaco = (function() {
|
||||
//Handles orphaned models
|
||||
//ensure loaded models that are not explicitly destroyed by a call to .destroy() are disposed
|
||||
RED.events.on("editor:close",function() {
|
||||
let models = window.monaco ? monaco.editor.getModels() : null;
|
||||
if (!window.monaco) { return; }
|
||||
const editors = window.monaco.editor.getEditors()
|
||||
const orphanEditors = editors.filter(editor => editor && !document.body.contains(editor.getDomNode()))
|
||||
orphanEditors.forEach(editor => {
|
||||
editor.dispose();
|
||||
});
|
||||
let models = monaco.editor.getModels()
|
||||
if(models && models.length) {
|
||||
console.warn("Cleaning up monaco models left behind. Any node that calls createEditor() should call .destroy().")
|
||||
for (let index = 0; index < models.length; index++) {
|
||||
@@ -1124,6 +1130,7 @@ RED.editor.codeEditor.monaco = (function() {
|
||||
|
||||
$(el).remove();
|
||||
$(toolbarRow).remove();
|
||||
ed.dispose();
|
||||
}
|
||||
|
||||
ed.resize = function resize() {
|
||||
|
@@ -131,7 +131,7 @@ RED.editor.envVarList = (function() {
|
||||
nameField.trigger('change');
|
||||
}
|
||||
},
|
||||
sortable: ".red-ui-editableList-item-handle",
|
||||
sortable: true,
|
||||
removable: false
|
||||
});
|
||||
var parentEnv = {};
|
||||
|
@@ -11,9 +11,22 @@ RED.editor.mermaid = (function () {
|
||||
|
||||
if (!initializing) {
|
||||
initializing = true
|
||||
$.getScript(
|
||||
'vendor/mermaid/mermaid.min.js',
|
||||
function (data, stat, jqxhr) {
|
||||
// Find the cache-buster:
|
||||
let cacheBuster
|
||||
$('script').each(function (i, el) {
|
||||
if (!cacheBuster) {
|
||||
const src = el.getAttribute('src')
|
||||
const m = /\?v=(.+)$/.exec(src)
|
||||
if (m) {
|
||||
cacheBuster = m[1]
|
||||
}
|
||||
}
|
||||
})
|
||||
$.ajax({
|
||||
url: `vendor/mermaid/mermaid.min.js?v=${cacheBuster}`,
|
||||
dataType: "script",
|
||||
cache: true,
|
||||
success: function (data, stat, jqxhr) {
|
||||
mermaid.initialize({
|
||||
startOnLoad: false,
|
||||
theme: RED.settings.get('mermaid', {}).theme
|
||||
@@ -24,7 +37,7 @@ RED.editor.mermaid = (function () {
|
||||
render(pending)
|
||||
}
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const nodes = document.querySelectorAll(selector)
|
||||
|
@@ -839,10 +839,10 @@ RED.library = (function() {
|
||||
if (file && file.label && !file.children) {
|
||||
$.get("library/"+file.library+"/"+file.type+"/"+file.path, function(data) {
|
||||
//TODO: nls + sanitize
|
||||
var propRow = $('<tr class="red-ui-help-info-row"><td>Type</td><td></td></tr>').appendTo(table);
|
||||
var propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("library.type")+'</td><td></td></tr>').appendTo(table);
|
||||
$(propRow.children()[1]).text(activeLibrary.type);
|
||||
if (file.props.hasOwnProperty('name')) {
|
||||
propRow = $('<tr class="red-ui-help-info-row"><td>Name</td><td>'+file.props.name+'</td></tr>').appendTo(table);
|
||||
propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("library.name")+'</td><td>'+file.props.name+'</td></tr>').appendTo(table);
|
||||
$(propRow.children()[1]).text(file.props.name);
|
||||
}
|
||||
for (var p in file.props) {
|
||||
|
@@ -308,7 +308,7 @@ RED.projects.settings = (function() {
|
||||
if (activeProject.dependencies) {
|
||||
for (var m in activeProject.dependencies) {
|
||||
if (activeProject.dependencies.hasOwnProperty(m)) {
|
||||
var installed = !!RED.nodes.registry.getModule(m) && activeProject.dependencies[m] === modulesInUse[m].version;
|
||||
var installed = !!RED.nodes.registry.getModule(m) && activeProject.dependencies[m] === modulesInUse[m]?.version;
|
||||
depsList.editableList('addItem',{
|
||||
id: m,
|
||||
version: activeProject.dependencies[m], //RED.nodes.registry.getModule(module).version,
|
||||
@@ -1256,7 +1256,7 @@ RED.projects.settings = (function() {
|
||||
notification.close();
|
||||
}
|
||||
},{
|
||||
text: 'Delete branch',
|
||||
text: RED._("sidebar.project.projectSettings.deleteBranch"),
|
||||
click: function() {
|
||||
notification.close();
|
||||
var url = "projects/"+activeProject.name+"/branches/"+entry.name;
|
||||
|
@@ -204,7 +204,7 @@ RED.sidebar.info = (function() {
|
||||
|
||||
propertiesPanelHeaderIcon.empty();
|
||||
RED.utils.createNodeIcon({type:"_selection_"}).appendTo(propertiesPanelHeaderIcon);
|
||||
propertiesPanelHeaderLabel.text("Selection");
|
||||
propertiesPanelHeaderLabel.text(RED._("sidebar.info.selection"));
|
||||
propertiesPanelHeaderReveal.hide();
|
||||
propertiesPanelHeaderHelp.hide();
|
||||
propertiesPanelHeaderCopyLink.hide();
|
||||
|
@@ -279,6 +279,11 @@ RED.typeSearch = (function() {
|
||||
if ($("#red-ui-main-container").height() - opts.y - 195 < 0) {
|
||||
opts.y = opts.y - 275;
|
||||
}
|
||||
const dialogWidth = dialog.width() || 300 // default is 300 (defined in class .red-ui-search)
|
||||
const workspaceWidth = $('#red-ui-workspace').width()
|
||||
if (workspaceWidth > dialogWidth && workspaceWidth - opts.x - dialogWidth < 0) {
|
||||
opts.x = opts.x - (dialogWidth - RED.view.node_width)
|
||||
}
|
||||
dialog.css({left:opts.x+"px",top:opts.y+"px"}).show();
|
||||
searchResultsDiv.slideDown(300);
|
||||
setTimeout(function() {
|
||||
@@ -330,13 +335,25 @@ RED.typeSearch = (function() {
|
||||
}
|
||||
}
|
||||
function applyFilter(filter,type,def) {
|
||||
return !def || !filter ||
|
||||
(
|
||||
(!filter.spliceMultiple) &&
|
||||
(!filter.type || type === filter.type) &&
|
||||
(!filter.input || type === 'junction' || def.inputs > 0) &&
|
||||
(!filter.output || type === 'junction' || def.outputs > 0)
|
||||
)
|
||||
if (!filter) {
|
||||
// No filter; allow everything
|
||||
return true
|
||||
}
|
||||
if (type === 'junction') {
|
||||
// Only allow Junction is there's no specific type filter
|
||||
return !filter.type
|
||||
}
|
||||
if (filter.type) {
|
||||
// Handle explicit type filter
|
||||
return filter.type === type
|
||||
}
|
||||
if (!def) {
|
||||
// No node definition available - allow it
|
||||
return true
|
||||
}
|
||||
// Check if the filter is for input/outputs and apply
|
||||
return (!filter.input || def.inputs > 0) &&
|
||||
(!filter.output || def.outputs > 0)
|
||||
}
|
||||
function refreshTypeList(opts) {
|
||||
var i;
|
||||
@@ -365,7 +382,7 @@ RED.typeSearch = (function() {
|
||||
var items = [];
|
||||
RED.nodes.registry.getNodeTypes().forEach(function(t) {
|
||||
var def = RED.nodes.getType(t);
|
||||
if (def.category !== 'config' && t !== 'unknown' && t !== 'tab') {
|
||||
if (def.set?.enabled !== false && def.category !== 'config' && t !== 'unknown' && t !== 'tab') {
|
||||
items.push({type:t,def: def, label:getTypeLabel(t,def)});
|
||||
}
|
||||
});
|
||||
|
@@ -1102,18 +1102,27 @@ RED.view.tools = (function() {
|
||||
const paletteLabel = RED.utils.getPaletteLabel(n.type, nodeDef)
|
||||
const defaultNodeNameRE = new RegExp('^'+paletteLabel.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')+' (\\d+)$')
|
||||
if (!typeIndex.hasOwnProperty(n.type)) {
|
||||
const existingNodes = RED.nodes.filterNodes({type: n.type})
|
||||
let maxNameNumber = 0;
|
||||
existingNodes.forEach(n => {
|
||||
let match = defaultNodeNameRE.exec(n.name)
|
||||
const existingNodes = RED.nodes.filterNodes({ type: n.type });
|
||||
const existingIds = existingNodes.reduce((ids, node) => {
|
||||
let match = defaultNodeNameRE.exec(node.name);
|
||||
if (match) {
|
||||
let nodeNumber = parseInt(match[1])
|
||||
if (nodeNumber > maxNameNumber) {
|
||||
maxNameNumber = nodeNumber
|
||||
const nodeNumber = parseInt(match[1], 10);
|
||||
if (!ids.includes(nodeNumber)) {
|
||||
ids.push(nodeNumber);
|
||||
}
|
||||
}
|
||||
})
|
||||
typeIndex[n.type] = maxNameNumber + 1
|
||||
return ids;
|
||||
}, []).sort((a, b) => a - b);
|
||||
|
||||
let availableNameNumber = 1;
|
||||
for (let i = 0; i < existingIds.length; i++) {
|
||||
if (existingIds[i] !== availableNameNumber) {
|
||||
break;
|
||||
}
|
||||
availableNameNumber++;
|
||||
}
|
||||
|
||||
typeIndex[n.type] = availableNameNumber;
|
||||
}
|
||||
if ((options.renameBlank && n.name === '') || (options.renameClash && defaultNodeNameRE.test(n.name))) {
|
||||
if (generateHistory) {
|
||||
|
@@ -288,7 +288,7 @@ RED.view = (function() {
|
||||
}
|
||||
selectedLinks.clearUnselected()
|
||||
},
|
||||
length: () => groups.length,
|
||||
length: () => groups.size,
|
||||
forEach: (func) => { groups.forEach(func) },
|
||||
toArray: () => [...groups],
|
||||
clear: function () {
|
||||
@@ -1209,7 +1209,10 @@ RED.view = (function() {
|
||||
lasso = null;
|
||||
}
|
||||
if (d3.event.touches || d3.event.button === 0) {
|
||||
if ((mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) && isControlPressed(d3.event) && !(d3.event.altKey || d3.event.shiftKey)) {
|
||||
if (
|
||||
(mouse_mode === 0 && isControlPressed(d3.event) && !(d3.event.altKey || d3.event.shiftKey)) ||
|
||||
mouse_mode === RED.state.QUICK_JOINING
|
||||
) {
|
||||
// Trigger quick add dialog
|
||||
d3.event.stopPropagation();
|
||||
clearSelection();
|
||||
@@ -1285,7 +1288,6 @@ RED.view = (function() {
|
||||
}
|
||||
|
||||
var mainPos = $("#red-ui-main-container").position();
|
||||
|
||||
if (mouse_mode !== RED.state.QUICK_JOINING) {
|
||||
mouse_mode = RED.state.QUICK_JOINING;
|
||||
$(window).on('keyup',disableQuickJoinEventHandler);
|
||||
@@ -2687,22 +2689,21 @@ RED.view = (function() {
|
||||
addToRemovedLinks(reconnectResult.removedLinks)
|
||||
}
|
||||
|
||||
var startDirty = RED.nodes.dirty();
|
||||
var startChanged = false;
|
||||
var selectedGroups = [];
|
||||
const startDirty = RED.nodes.dirty();
|
||||
let movingSelectedGroups = [];
|
||||
if (movingSet.length() > 0) {
|
||||
|
||||
for (var i=0;i<movingSet.length();i++) {
|
||||
node = movingSet.get(i).n;
|
||||
if (node.type === "group") {
|
||||
selectedGroups.push(node);
|
||||
movingSelectedGroups.push(node);
|
||||
}
|
||||
}
|
||||
// Make sure we have identified all groups about to be deleted
|
||||
for (i=0;i<selectedGroups.length;i++) {
|
||||
selectedGroups[i].nodes.forEach(function(n) {
|
||||
if (n.type === "group" && selectedGroups.indexOf(n) === -1) {
|
||||
selectedGroups.push(n);
|
||||
for (i=0;i<movingSelectedGroups.length;i++) {
|
||||
movingSelectedGroups[i].nodes.forEach(function(n) {
|
||||
if (n.type === "group" && movingSelectedGroups.indexOf(n) === -1) {
|
||||
movingSelectedGroups.push(n);
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -2719,7 +2720,7 @@ RED.view = (function() {
|
||||
addToRemovedLinks(removedEntities.links);
|
||||
if (node.g) {
|
||||
var group = RED.nodes.group(node.g);
|
||||
if (selectedGroups.indexOf(group) === -1) {
|
||||
if (movingSelectedGroups.indexOf(group) === -1) {
|
||||
// Don't use RED.group.removeFromGroup as that emits
|
||||
// a change event on the node - but we're deleting it
|
||||
var index = group.nodes.indexOf(node);
|
||||
@@ -2733,7 +2734,7 @@ RED.view = (function() {
|
||||
removedLinks = removedLinks.concat(result.links);
|
||||
if (node.g) {
|
||||
var group = RED.nodes.group(node.g);
|
||||
if (selectedGroups.indexOf(group) === -1) {
|
||||
if (movingSelectedGroups.indexOf(group) === -1) {
|
||||
// Don't use RED.group.removeFromGroup as that emits
|
||||
// a change event on the node - but we're deleting it
|
||||
var index = group.nodes.indexOf(node);
|
||||
@@ -2755,8 +2756,8 @@ RED.view = (function() {
|
||||
|
||||
// Groups must be removed in the right order - from inner-most
|
||||
// to outermost.
|
||||
for (i = selectedGroups.length-1; i>=0; i--) {
|
||||
var g = selectedGroups[i];
|
||||
for (i = movingSelectedGroups.length-1; i>=0; i--) {
|
||||
var g = movingSelectedGroups[i];
|
||||
removedGroups.push(g);
|
||||
RED.nodes.removeGroup(g);
|
||||
}
|
||||
@@ -3057,8 +3058,8 @@ RED.view = (function() {
|
||||
}
|
||||
|
||||
function disableQuickJoinEventHandler(evt) {
|
||||
// Check for ctrl (all browsers), "Meta" (Chrome/FF), keyCode 91 (Safari)
|
||||
if (evt.keyCode === 17 || evt.key === "Meta" || evt.keyCode === 91) {
|
||||
// Check for ctrl (all browsers), "Meta" (Chrome/FF), keyCode 91 (Safari), or Escape
|
||||
if (evt.keyCode === 17 || evt.key === "Meta" || evt.keyCode === 91 || evt.keyCode === 27) {
|
||||
resetMouseVars();
|
||||
hideDragLines();
|
||||
redraw();
|
||||
@@ -3189,27 +3190,59 @@ RED.view = (function() {
|
||||
|
||||
for (i=0;i<drag_lines.length;i++) {
|
||||
if (portType != drag_lines[i].portType && mouseup_node !== drag_lines[i].node) {
|
||||
var drag_line = drag_lines[i];
|
||||
var src,dst,src_port;
|
||||
let drag_line = drag_lines[i];
|
||||
let src,dst,src_port;
|
||||
let oldDst;
|
||||
let oldSrc;
|
||||
if (drag_line.portType === PORT_TYPE_OUTPUT) {
|
||||
src = drag_line.node;
|
||||
src_port = drag_line.port;
|
||||
dst = mouseup_node;
|
||||
oldSrc = src;
|
||||
if (drag_line.link) {
|
||||
oldDst = drag_line.link.target;
|
||||
}
|
||||
} else if (drag_line.portType === PORT_TYPE_INPUT) {
|
||||
src = mouseup_node;
|
||||
dst = drag_line.node;
|
||||
src_port = portIndex || 0;
|
||||
oldSrc = dst;
|
||||
if (drag_line.link) {
|
||||
oldDst = drag_line.link.source
|
||||
}
|
||||
}
|
||||
var link = {source: src, sourcePort:src_port, target: dst};
|
||||
if (drag_line.virtualLink) {
|
||||
if (/^link (in|out)$/.test(src.type) && /^link (in|out)$/.test(dst.type) && src.type !== dst.type) {
|
||||
if (src.links.indexOf(dst.id) === -1 && dst.links.indexOf(src.id) === -1) {
|
||||
var oldSrcLinks = $.extend(true,{},{v:src.links}).v
|
||||
var oldDstLinks = $.extend(true,{},{v:dst.links}).v
|
||||
var oldSrcLinks = [...src.links]
|
||||
var oldDstLinks = [...dst.links]
|
||||
|
||||
src.links.push(dst.id);
|
||||
dst.links.push(src.id);
|
||||
|
||||
if (oldDst) {
|
||||
src.links = src.links.filter(id => id !== oldDst.id)
|
||||
dst.links = dst.links.filter(id => id !== oldDst.id)
|
||||
var oldOldDstLinks = [...oldDst.links]
|
||||
oldDst.links = oldDst.links.filter(id => id !== oldSrc.id)
|
||||
oldDst.dirty = true;
|
||||
modifiedNodes.push(oldDst);
|
||||
linkEditEvents.push({
|
||||
t:'edit',
|
||||
node: oldDst,
|
||||
dirty: RED.nodes.dirty(),
|
||||
changed: oldDst.changed,
|
||||
changes: {
|
||||
links:oldOldDstLinks
|
||||
}
|
||||
});
|
||||
oldDst.changed = true;
|
||||
}
|
||||
|
||||
src.dirty = true;
|
||||
dst.dirty = true;
|
||||
|
||||
modifiedNodes.push(src);
|
||||
modifiedNodes.push(dst);
|
||||
|
||||
@@ -3237,6 +3270,7 @@ RED.view = (function() {
|
||||
links:oldDstLinks
|
||||
}
|
||||
});
|
||||
|
||||
src.changed = true;
|
||||
dst.changed = true;
|
||||
}
|
||||
|
@@ -183,25 +183,29 @@ RED.workspaces = (function() {
|
||||
},
|
||||
null)
|
||||
}
|
||||
menuItems.push(
|
||||
{
|
||||
id:"red-ui-tabs-menu-option-add-flow",
|
||||
label: RED._("workspace.addFlow"),
|
||||
onselect: "core:add-flow"
|
||||
}
|
||||
)
|
||||
if (isMenuButton || !!tab) {
|
||||
if (RED.settings.theme("menu.menu-item-workspace-add", true)) {
|
||||
menuItems.push(
|
||||
{
|
||||
id:"red-ui-tabs-menu-option-add-flow-right",
|
||||
label: RED._("workspace.addFlowToRight"),
|
||||
shortcut: RED.keyboard.getShortcut("core:add-flow-to-right"),
|
||||
onselect: function() {
|
||||
RED.actions.invoke("core:add-flow-to-right", tab)
|
||||
}
|
||||
},
|
||||
null
|
||||
id:"red-ui-tabs-menu-option-add-flow",
|
||||
label: RED._("workspace.addFlow"),
|
||||
onselect: "core:add-flow"
|
||||
}
|
||||
)
|
||||
}
|
||||
if (isMenuButton || !!tab) {
|
||||
if (RED.settings.theme("menu.menu-item-workspace-add", true)) {
|
||||
menuItems.push(
|
||||
{
|
||||
id:"red-ui-tabs-menu-option-add-flow-right",
|
||||
label: RED._("workspace.addFlowToRight"),
|
||||
shortcut: RED.keyboard.getShortcut("core:add-flow-to-right"),
|
||||
onselect: function() {
|
||||
RED.actions.invoke("core:add-flow-to-right", tab)
|
||||
}
|
||||
},
|
||||
null
|
||||
)
|
||||
}
|
||||
if (activeWorkspace && activeWorkspace.type === 'tab') {
|
||||
menuItems.push(
|
||||
isFlowDisabled ? {
|
||||
@@ -255,7 +259,9 @@ RED.workspaces = (function() {
|
||||
}
|
||||
)
|
||||
}
|
||||
menuItems.push(null)
|
||||
if (menuItems.length > 0) {
|
||||
menuItems.push(null)
|
||||
}
|
||||
if (isMenuButton || !!tab) {
|
||||
menuItems.push(
|
||||
{
|
||||
@@ -299,19 +305,24 @@ RED.workspaces = (function() {
|
||||
}
|
||||
)
|
||||
if (tab) {
|
||||
menuItems.push(null)
|
||||
|
||||
if (RED.settings.theme("menu.menu-item-workspace-delete", true)) {
|
||||
menuItems.push(
|
||||
{
|
||||
label: RED._("common.label.delete"),
|
||||
onselect: function() {
|
||||
if (tab.type === 'tab') {
|
||||
RED.workspaces.delete(tab)
|
||||
} else if (tab.type === 'subflow') {
|
||||
RED.subflow.delete(tab.id)
|
||||
}
|
||||
},
|
||||
disabled: isCurrentLocked || (workspaceTabCount === 1)
|
||||
}
|
||||
)
|
||||
}
|
||||
menuItems.push(
|
||||
null,
|
||||
{
|
||||
label: RED._("common.label.delete"),
|
||||
onselect: function() {
|
||||
if (tab.type === 'tab') {
|
||||
RED.workspaces.delete(tab)
|
||||
} else if (tab.type === 'subflow') {
|
||||
RED.subflow.delete(tab.id)
|
||||
}
|
||||
},
|
||||
disabled: isCurrentLocked || (workspaceTabCount === 1)
|
||||
},
|
||||
{
|
||||
label: RED._("menu.label.export"),
|
||||
shortcut: RED.keyboard.getShortcut("core:show-export-dialog"),
|
||||
@@ -468,7 +479,7 @@ RED.workspaces = (function() {
|
||||
},
|
||||
minimumActiveTabWidth: 150,
|
||||
scrollable: true,
|
||||
addButton: "core:add-flow",
|
||||
addButton: RED.settings.theme("menu.menu-item-workspace-add", true) ? "core:add-flow" : undefined,
|
||||
addButtonCaption: RED._("workspace.addFlow"),
|
||||
menu: function() { return getMenuItems(true) },
|
||||
contextmenu: function(tab) { return getMenuItems(false, tab) }
|
||||
@@ -525,19 +536,24 @@ RED.workspaces = (function() {
|
||||
$(window).on("resize", function() {
|
||||
workspace_tabs.resize();
|
||||
});
|
||||
|
||||
RED.actions.add("core:add-flow",function(opts) { addWorkspace(undefined,undefined,opts?opts.index:undefined)});
|
||||
RED.actions.add("core:add-flow-to-right",function(workspace) {
|
||||
let index
|
||||
if (workspace) {
|
||||
index = workspace_tabs.getTabIndex(workspace.id)+1
|
||||
} else {
|
||||
index = workspace_tabs.activeIndex()+1
|
||||
}
|
||||
addWorkspace(undefined,undefined,index)
|
||||
});
|
||||
RED.actions.add("core:edit-flow",editWorkspace);
|
||||
RED.actions.add("core:remove-flow",removeWorkspace);
|
||||
if (RED.settings.theme("menu.menu-item-workspace-add", true)) {
|
||||
RED.actions.add("core:add-flow",function(opts) { addWorkspace(undefined,undefined,opts?opts.index:undefined)});
|
||||
RED.actions.add("core:add-flow-to-right",function(workspace) {
|
||||
let index
|
||||
if (workspace) {
|
||||
index = workspace_tabs.getTabIndex(workspace.id)+1
|
||||
} else {
|
||||
index = workspace_tabs.activeIndex()+1
|
||||
}
|
||||
addWorkspace(undefined,undefined,index)
|
||||
});
|
||||
}
|
||||
if (RED.settings.theme("menu.menu-item-workspace-edit", true)) {
|
||||
RED.actions.add("core:edit-flow",editWorkspace);
|
||||
}
|
||||
if (RED.settings.theme("menu.menu-item-workspace-delete", true)) {
|
||||
RED.actions.add("core:remove-flow",removeWorkspace);
|
||||
}
|
||||
RED.actions.add("core:enable-flow",enableWorkspace);
|
||||
RED.actions.add("core:disable-flow",disableWorkspace);
|
||||
RED.actions.add("core:lock-flow",lockWorkspace);
|
||||
@@ -904,6 +920,17 @@ RED.workspaces = (function() {
|
||||
}
|
||||
},
|
||||
refresh: function() {
|
||||
var workspace = RED.nodes.workspace(RED.workspaces.active());
|
||||
if (workspace) {
|
||||
document.title = `${documentTitle} : ${workspace.label}`;
|
||||
} else {
|
||||
var subflow = RED.nodes.subflow(RED.workspaces.active());
|
||||
if (subflow) {
|
||||
document.title = `${documentTitle} : ${subflow.name}`;
|
||||
} else {
|
||||
document.title = documentTitle
|
||||
}
|
||||
}
|
||||
RED.nodes.eachWorkspace(function(ws) {
|
||||
workspace_tabs.renameTab(ws.id,ws.label);
|
||||
$("#red-ui-tab-"+(ws.id.replace(".","-"))).attr("flowname",ws.label)
|
||||
|
Reference in New Issue
Block a user