()
| 7114 | defaultValue: item.name, |
| 7115 | placeholder: 'Enter new name...' |
| 7116 | }); |
| 7117 | |
| 7118 | if (newName && newName.trim() !== '' && newName.trim() !== item.name) { |
| 7119 | try { |
| 7120 | // Check if the new name already exists (merge scenario) |
| 7121 | const trimmedNewName = newName.trim(); |
| 7122 | const existingItem = allMetadata.find(m => |
| 7123 | m.type === type && |
| 7124 | m.name.toLowerCase() === trimmedNewName.toLowerCase() && |
| 7125 | m.name !== item.name |
| 7126 | ); |
| 7127 | |
| 7128 | let shouldProceed = true; |
| 7129 | |
| 7130 | // If merging, show confirmation dialog |
| 7131 | if (existingItem) { |
| 7132 | const confirmResult = await window.electron.showMessageBox({ |
| 7133 | type: 'question', |
| 7134 | title: 'Merge Metadata', |
| 7135 | message: `A ${type === 'designer' ? 'designer' : type === 'parentModel' ? 'parent model' : 'license'} with the name "${trimmedNewName}" already exists.`, |
| 7136 | detail: `This will merge "${item.name}" (${item.model_count} model${item.model_count !== 1 ? 's' : ''}) into "${trimmedNewName}" (${existingItem.model_count} model${existingItem.model_count !== 1 ? 's' : ''}).`, |
| 7137 | buttons: ['Merge', 'Cancel'], |
| 7138 | defaultId: 0, |
| 7139 | cancelId: 1 |
no test coverage detected