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

Prevent deleting subflow if instance on locked tab

This commit is contained in:
Nick O'Leary 2022-11-01 11:42:40 +00:00
parent ce94226c3c
commit fe9c630572
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 4 additions and 1 deletions

View File

@ -616,7 +616,7 @@ RED.nodes = (function() {
var subflowId = n.type.substring(8); var subflowId = n.type.substring(8);
var sf = RED.nodes.subflow(subflowId); var sf = RED.nodes.subflow(subflowId);
if (sf) { if (sf) {
sf.instances.push(sf); sf.instances.push(newNode);
} }
n["_"] = RED._; n["_"] = RED._;
} }

View File

@ -450,6 +450,9 @@ RED.subflow = (function() {
return return
} }
if (subflow.instances.length > 0) { if (subflow.instances.length > 0) {
if (subflow.instances.some(sf => { const ws = RED.nodes.workspace(sf.z); return ws?ws.locked:false })) {
return
}
const msg = $('<div>') const msg = $('<div>')
$('<p>').text(RED._("subflow.subflowInstances",{count: subflow.instances.length})).appendTo(msg); $('<p>').text(RED._("subflow.subflowInstances",{count: subflow.instances.length})).appendTo(msg);
$('<p>').text(RED._("subflow.confirmDelete")).appendTo(msg); $('<p>').text(RED._("subflow.confirmDelete")).appendTo(msg);