Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed form mapper error where File objects were not being mapped correctly Will now rely on `FormData` methods for catching erroneous objects being passed in - it may be worth working towards a more robust mapper for future use, but for now, it is felt that this version is more than suitable for our needs. * Removed log statement Missed a log statement that is no longer required - this has been removed * Removed failing test * Added filedrag definitions This just makes my life easier - these are only useful for TS usage * Rename for upload of new files now possible - Added check for renaming in API endpoint as well as functionality to perform the rename - Cleaned up some code within `DocumentComponent`, namely: - made `el` property `readonly` - this was because I believed it was being overwritten somewhere (see next point) - the `updateProgress` function wasn't firing correctly and couldn't find the element it was supposed to be linked to - this has been removed (although it now means the code isn't as DRY) - Changed the `showerror` function in an attempt to make result consistent across calls - Added input and button for document renaming and implemented logic - as noted in the code - for some reason I wasn't able to modify the `original-name` data attribute within the component using `event.target` so I had to pass the button in directly - frankly, TypeScript appears to have dropped the ball somewhere on this - I would upgrade the version of TS, Babel, Webpack, etc. but I'm not insane enough to go down that rabbit-hole - this is deemed the lesser of two evils in my opinion. * Fixed typo in API endpoint * File renaming complete - Updated `datum::File` to check file name for marking datum as changed - Removed rename within file post request and placed within a put request - Updated `DocumentComponent` as required - Removed debug statements - Modified `edit.tt` as required * Typo fixed (thus fixing tests) * Changes as suggested Also applied perltidy using current config and modified output accordingly * File rename complete It appears that using `find_with_permission` on the `Fileval` gives a datum object. Due to the only reason you would be able to access the field in this manner for a rename would be if you already have permission, this is seen as an over-complication. * Updated templates * Updated logging to match and added check for window.test for use in test environments * Updated for IE11 removal and finished initial button and updates * Updated progress bar Also updated styling * Further UX changes Following feedback from UX testing, further changes complete and pushed * Created checks for renaming and valid names * Updated for correct renaming functionality * Updated file renaming * Fixes for bugs found in testing - Added old name to rename button event in order to revert the result on error - Exported `RenameEvent` to keep things DRY - Modified specifiers on multiple elements within `DocumentComponent` as events were being fired across the board rather than having required specificity - Removed error as this wasn't displaying correctly - Moved to async methods as IE11 is no longer in use to add clarity to code - Refactored out progress function and bound as required (DRY) - Discovered server is returning errors as strings, not as JSON objects (this will become a new ticket as a bug) so ensured that these are being parsed as required * Updated file name checks - Added check for invalid characters on upload - Allowed specific special characters on upload (underscore and dash) * Updated rename component * Fixed failing tests * Updated file upload to allow brackets in uploaded files Any invalid characters will be replaced when the file is saved to the record, but it is felt that the error still remain regardless. * Removed unnecessary changes * Updated comment on `file_check` * Revert on component * Further changes and bug fixes after testing on copy system * Removed additional CSS classes and used Bootstrap * Fix for spacing of rename button * Moved check out of other files and into endpoint with return value * Updated comments for file upload renaming Also removed extra check that's not required on `Datum::File` after `set_value` * Updates allowing for security considerations * Removed debug statements * Updated file checks * Re-added comments * Moved code for post to correct method * Fix for name checks on upload --------- Co-authored-by: root <[email protected]>
- Loading branch information