feat(create): add 'copy from existing' (clone) option to CreateComponent #3646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changed proposed:
Add support for cloning an existing entity from the 'Create' card for multiple types.
I modified the tests for
create.component.spec.ts. I'm not sure what other tests are needed for this.FYI not an NX/Angular expert and I used AI tools to help draft this. Hopefully, nothing too bad in here
Details:
Adds
allowCopyfield to the CreateComponent<keira-create>, which is opt-in.Handling is done by routing to a
/cloneroute with a providedIDto copy from. This is similar to/selectand/createthat already exist. The/copyroute displays a page withcopyqueries for the main table and related tables. After executing, the user is routed to the edit page.After doing this for creatures, it was easy enough to copy and paste the handling for other types.
For gobjects and creatures, only the template-like tables are copied. SmartAI (TODO?), spawns or guid-specific stuff is not copied.
Issues
UI
UI Screenshots
[[copilot summary below]]
This pull request adds support for "copy" routes and features across multiple entity types in the Keira app, allowing users to duplicate existing entries. It also introduces new internationalized strings related to the copy functionality in all supported languages.
Key changes include:
Routing and Feature Enhancements:
routes.ts, each guarded by the appropriate handler service and linked to the correspondingCopyComponent. This enables users to copy existing records for these entities. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]routes.tsto include all newCopyComponentclasses for the affected features. [1] [2] [3] [4] [5] [6]Internationalization (i18n):
en.json,de.json,es.json,fr.json,el.json,it.json). This ensures the new copy functionality is fully localized. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]These changes collectively introduce and localize the experimental ability to copy existing entries for a wide range of entities within the Keira application, improving user productivity and data management.