Change the name of getID by generateId

This commit is contained in:
GogoVega 2024-06-19 12:23:31 +02:00
parent 2f01fe5832
commit 476e8345c5
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -564,7 +564,7 @@ RED.nodes = (function() {
return api; return api;
})() })()
function getID() { function generateId() {
var bytes = []; var bytes = [];
for (var i=0;i<8;i++) { for (var i=0;i<8;i++) {
bytes.push(Math.round(0xff*Math.random()).toString(16).padStart(2,'0')); bytes.push(Math.round(0xff*Math.random()).toString(16).padStart(2,'0'));
@ -2124,7 +2124,7 @@ RED.nodes = (function() {
activeWorkspace = defaultWorkspace.id; activeWorkspace = defaultWorkspace.id;
} }
if (createNewIds || options.importMap[node.id] === "copy") { if (createNewIds || options.importMap[node.id] === "copy") {
node.id = getID(); node.id = generateId();
} }
addWorkspace(node); addWorkspace(node);
workspaceMap[oldId] = node.id; workspaceMap[oldId] = node.id;
@ -2136,23 +2136,23 @@ RED.nodes = (function() {
input.direction = "in"; input.direction = "in";
input.z = node.id; input.z = node.id;
input.i = i; input.i = i;
input.id = getID(); input.id = generateId();
}); });
node.out.forEach(function(output, i) { node.out.forEach(function(output, i) {
output.type = "subflow"; output.type = "subflow";
output.direction = "out"; output.direction = "out";
output.z = node.id; output.z = node.id;
output.i = i; output.i = i;
output.id = getID(); output.id = generateId();
}); });
if (node.status) { if (node.status) {
node.status.type = "subflow"; node.status.type = "subflow";
node.status.direction = "status"; node.status.direction = "status";
node.status.z = node.id; node.status.z = node.id;
node.status.id = getID(); node.status.id = generateId();
} }
if (createNewIds || options.importMap[node.id] === "copy") { if (createNewIds || options.importMap[node.id] === "copy") {
node.id = getID(); node.id = generateId();
} }
subflowMap[oldId] = node; subflowMap[oldId] = node;
newSubflows.push(node); newSubflows.push(node);
@ -2162,7 +2162,7 @@ RED.nodes = (function() {
// Add a tab if there isn't one there already - Like first install // Add a tab if there isn't one there already - Like first install
if (!defaultWorkspace) { if (!defaultWorkspace) {
defaultWorkspace = { type: "tab", id: getID(), disabled: false, info: "", label: RED._("workspace.defaultName", { number: 1 }), env: [] }; defaultWorkspace = { type: "tab", id: generateId(), disabled: false, info: "", label: RED._("workspace.defaultName", { number: 1 }), env: [] };
addWorkspace(defaultWorkspace); addWorkspace(defaultWorkspace);
RED.workspaces.add(defaultWorkspace); RED.workspaces.add(defaultWorkspace);
newWorkspaces.push(defaultWorkspace); newWorkspaces.push(defaultWorkspace);
@ -2181,7 +2181,7 @@ RED.nodes = (function() {
// Repair the flow - but we really need to track that down. // Repair the flow - but we really need to track that down.
if (!recoveryWorkspace) { if (!recoveryWorkspace) {
recoveryWorkspace = { recoveryWorkspace = {
id: getID(), id: generateId(),
type: "tab", type: "tab",
disabled: false, disabled: false,
label: RED._("clipboard.recoveredNodes"), label: RED._("clipboard.recoveredNodes"),
@ -2333,7 +2333,7 @@ RED.nodes = (function() {
// Now the node has been copied, change the `id` if it's a copy // Now the node has been copied, change the `id` if it's a copy
if (createNewIds || options.importMap[oldId] === "copy") { if (createNewIds || options.importMap[oldId] === "copy") {
nodeMap[oldId].id = getID(); nodeMap[oldId].id = generateId();
} }
if (node.type === "junction") { if (node.type === "junction") {
@ -3145,7 +3145,7 @@ RED.nodes = (function() {
createExportableNodeSet: createExportableNodeSet, createExportableNodeSet: createExportableNodeSet,
createCompleteNodeSet: createCompleteNodeSet, createCompleteNodeSet: createCompleteNodeSet,
updateConfigNodeUsers: updateConfigNodeUsers, updateConfigNodeUsers: updateConfigNodeUsers,
id: getID, id: generateId,
dirty: function(d) { dirty: function(d) {
if (d == null) { if (d == null) {
return dirty; return dirty;