-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvement/create new metadata modal (#22)
* Enhanced metadata file creation logic Refined `evaluateForm` method to support editing existing metadata files or creating new ones. Introduced logic to handle file linkage, and to populate new DocumentModel instances with form result data. Now, if an existing file is passed, it's updated with the synchronized metadata; otherwise, a new file is created using a specified template if available. * Renamed and updated file link methods Refactored `DocumentModel` methods for clarity and added return value to `setLinkedFile`. The `getFile` method is renamed to `getLinkedFile` to better represent its functionality. The `setLinkedFile` method now returns the constructed wikilink string for potential further use, while previously it returned nothing. Calls to the old `getFile` have been updated accordingly in `StaticDocumentModel` to maintain consistency. * Enhanced data setting logic in FileModel Refined the setter logic for `_data` to preserve existing values when an `undefined` is passed, and to explicitly clear them when a `null` is provided. This change improves data handling by ensuring that `undefined` values do not overwrite current data, allowing for more precise updates to the FileModel’s state. * Refactor transaction handling and model initialization Refactored the FileModel and TransactionModel classes to streamline the transaction handling process. In FileModel, simplified setting of the file property and consolidated the creation of an empty object with default values directly into the transaction changes object, removing the need for iteratively updating key-value pairs. Enhanced the TransactionModel by immediately starting a transaction if the `writeChanges` callback is not provided during instantiation, emphasizing the intent to always be in a transactional state. Further, introduced a clear separation of concerns by adding methods to properly finish or abort ongoing transactions based on the presence or emptiness of changes. Improved error handling in the asynchronous `writeChanges` callback, now catching errors and logging them properly, as well as clarifying the function's execution flow with a boolean return value. This adjustment allows for better debugging and maintenance. These enhancements aim to improve code clarity, reduce complexity, and enforce a more predictable and reliable transaction flow throughout the system. * Ensure cache consistency on file update Added a call to invalidateMetadataCacheArray after updating a file entry in MetadataCache to ensure that the cache remains consistent. This change addresses potential stale data when the cache is accessed following a file update. Version bump to V0.0.33
- Loading branch information
Showing
9 changed files
with
84 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters