fix(editor): Fix empty node name handling (#9548)
Co-authored-by: oleg <me@olegivaniv.com>
This commit is contained in:
committed by
GitHub
parent
596990bed7
commit
da41d31bc0
@@ -2174,7 +2174,15 @@ export default defineComponent({
|
||||
try {
|
||||
const nodeIdMap: { [prev: string]: string } = {};
|
||||
if (workflowData.nodes) {
|
||||
const nodeNames = workflowData.nodes.map((node) => node.name);
|
||||
workflowData.nodes.forEach((node: INode) => {
|
||||
// Provide a new name for nodes that don't have one
|
||||
if (!node.name) {
|
||||
const nodeType = this.nodeTypesStore.getNodeType(node.type);
|
||||
const newName = this.uniqueNodeName(nodeType?.displayName ?? node.type, nodeNames);
|
||||
node.name = newName;
|
||||
nodeNames.push(newName);
|
||||
}
|
||||
//generate new webhookId if workflow already contains a node with the same webhookId
|
||||
if (node.webhookId && UPDATE_WEBHOOK_ID_NODE_TYPES.includes(node.type)) {
|
||||
const isDuplicate = Object.values(
|
||||
@@ -4137,6 +4145,12 @@ export default defineComponent({
|
||||
cancelButtonText: this.$locale.baseText('nodeView.prompt.cancel'),
|
||||
inputErrorMessage: this.$locale.baseText('nodeView.prompt.invalidName'),
|
||||
inputValue: currentName,
|
||||
inputValidator: (value: string) => {
|
||||
if (!value.trim()) {
|
||||
return this.$locale.baseText('nodeView.prompt.invalidName');
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
@@ -4402,7 +4416,7 @@ export default defineComponent({
|
||||
async addNodesToWorkflow(data: IWorkflowDataUpdate): Promise<IWorkflowDataUpdate> {
|
||||
// Because nodes with the same name maybe already exist, it could
|
||||
// be needed that they have to be renamed. Also could it be possible
|
||||
// that nodes are not allowd to be created because they have a create
|
||||
// that nodes are not allowed to be created because they have a create
|
||||
// limit set. So we would then link the new nodes with the already existing ones.
|
||||
// In this object all that nodes get saved in the format:
|
||||
// old-name -> new-name
|
||||
|
||||
Reference in New Issue
Block a user