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

Fix generating flow name with incrementing number

Fixes #3295
This commit is contained in:
Nick O'Leary 2022-01-12 22:45:18 +00:00
parent 6d2793cac6
commit df70c8a800
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -66,7 +66,7 @@ RED.workspaces = (function() {
var tabId = RED.nodes.id(); var tabId = RED.nodes.id();
do { do {
workspaceIndex += 1; workspaceIndex += 1;
} while ($("#red-ui-workspace-tabs a[title='"+RED._('workspace.defaultName',{number:workspaceIndex})+"']").size() !== 0); } while ($("#red-ui-workspace-tabs li[flowname='"+RED._('workspace.defaultName',{number:workspaceIndex})+"']").size() !== 0);
ws = { ws = {
type: "tab", type: "tab",
@ -79,12 +79,15 @@ RED.workspaces = (function() {
}; };
RED.nodes.addWorkspace(ws,targetIndex); RED.nodes.addWorkspace(ws,targetIndex);
workspace_tabs.addTab(ws,targetIndex); workspace_tabs.addTab(ws,targetIndex);
workspace_tabs.activateTab(tabId); workspace_tabs.activateTab(tabId);
if (!skipHistoryEntry) { if (!skipHistoryEntry) {
RED.history.push({t:'add',workspaces:[ws],dirty:RED.nodes.dirty()}); RED.history.push({t:'add',workspaces:[ws],dirty:RED.nodes.dirty()});
RED.nodes.dirty(true); RED.nodes.dirty(true);
} }
} }
$("#red-ui-tab-"+(ws.id.replace(".","-"))).attr("flowname",ws.label)
RED.view.focus(); RED.view.focus();
return ws; return ws;
} }
@ -583,7 +586,7 @@ RED.workspaces = (function() {
refresh: function() { refresh: function() {
RED.nodes.eachWorkspace(function(ws) { RED.nodes.eachWorkspace(function(ws) {
workspace_tabs.renameTab(ws.id,ws.label); workspace_tabs.renameTab(ws.id,ws.label);
$("#red-ui-tab-"+(ws.id.replace(".","-"))).attr("flowname",ws.label)
}) })
RED.nodes.eachSubflow(function(sf) { RED.nodes.eachSubflow(function(sf) {
if (workspace_tabs.contains(sf.id)) { if (workspace_tabs.contains(sf.id)) {