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

Add change annotation for newly added flow

This commit is contained in:
Nick O'Leary 2023-02-23 23:14:18 +00:00
parent 363a8b8588
commit 2ddbb44992
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 18 additions and 8 deletions

View File

@ -602,10 +602,10 @@ RED.deploy = (function() {
node.moved = false; node.moved = false;
} }
}) })
flowsToLock.forEach(flow => {
flow.locked = true
})
RED.nodes.eachConfig(function (confNode) { RED.nodes.eachConfig(function (confNode) {
if (confNode.z) {
ensureUnlocked(confNode.z)
}
confNode.changed = false; confNode.changed = false;
if (confNode.credentials) { if (confNode.credentials) {
delete confNode.credentials; delete confNode.credentials;
@ -615,8 +615,16 @@ RED.deploy = (function() {
subflow.changed = false; subflow.changed = false;
}); });
RED.nodes.eachWorkspace(function (ws) { RED.nodes.eachWorkspace(function (ws) {
ws.changed = false; if (ws.changed || ws.added) {
ensureUnlocked(ws.z)
ws.changed = false;
delete ws.added
RED.events.emit("flows:change", ws)
}
}); });
flowsToLock.forEach(flow => {
flow.locked = true
})
// Once deployed, cannot undo back to a clean state // Once deployed, cannot undo back to a clean state
RED.history.markAllDirty(); RED.history.markAllDirty();
RED.view.redraw(); RED.view.redraw();

View File

@ -82,8 +82,11 @@ RED.workspaces = (function() {
info: "", info: "",
label: RED._('workspace.defaultName',{number:workspaceIndex}), label: RED._('workspace.defaultName',{number:workspaceIndex}),
env: [], env: [],
hideable: true hideable: true,
}; };
if (!skipHistoryEntry) {
ws.added = true
}
RED.nodes.addWorkspace(ws,targetIndex); RED.nodes.addWorkspace(ws,targetIndex);
workspace_tabs.addTab(ws,targetIndex); workspace_tabs.addTab(ws,targetIndex);
@ -93,8 +96,7 @@ RED.workspaces = (function() {
RED.nodes.dirty(true); RED.nodes.dirty(true);
} }
} }
$("#red-ui-tab-"+(ws.id.replace(".","-"))).attr("flowname",ws.label) $("#red-ui-tab-"+(ws.id.replace(".","-"))).attr("flowname",ws.label).toggleClass('red-ui-workspace-changed',!!(ws.contentsChanged || ws.changed || ws.added));
RED.view.focus(); RED.view.focus();
return ws; return ws;
} }
@ -645,7 +647,7 @@ RED.workspaces = (function() {
}) })
RED.events.on("flows:change", (ws) => { RED.events.on("flows:change", (ws) => {
$("#red-ui-tab-"+(ws.id.replace(".","-"))).toggleClass('red-ui-workspace-changed',!!(ws.contentsChanged || ws.changed)); $("#red-ui-tab-"+(ws.id.replace(".","-"))).toggleClass('red-ui-workspace-changed',!!(ws.contentsChanged || ws.changed || ws.added));
}) })
hideWorkspace(); hideWorkspace();