()
| 6733 | }); |
| 6734 | } |
| 6735 | |
| 6736 | if (newParentForm) { |
| 6737 | newParentForm.addEventListener('submit', async (event) => { |
| 6738 | event.preventDefault(); |
| 6739 | const newParentName = document.getElementById('new-parent-name').value.trim(); |
| 6740 | const sourceDropdownId = newParentDialog.dataset.sourceDropdown || 'model-parent'; |
| 6741 | |
| 6742 | if (newParentName) { |
| 6743 | // Trigger auto-save first |
| 6744 | if (sourceDropdownId === 'multi-parent') { |
| 6745 | await autoSaveMultipleModels('parentModel', newParentName); |
| 6746 | } else if (sourceDropdownId === 'parent-select') { |
| 6747 | // For filter dropdown, we need to save to a model first |
| 6748 | // This shouldn't normally happen, but handle it gracefully |
| 6749 | const filePath = getCurrentModelFilePath(); |
| 6750 | if (filePath) { |
| 6751 | await autoSaveModel('parentModel', newParentName, filePath); |
| 6752 | } |
| 6753 | } else { |
| 6754 | const filePath = getCurrentModelFilePath(); |
| 6755 | await autoSaveModel('parentModel', newParentName, filePath); |
| 6756 | } |
no test coverage detected