metacatui
metacatui copied to clipboard
Consider possible solutions for orphaned pre-emptive data uploads in editor
As of writing, when a user drops a data file in the Editor, the createObject request is sent off immediately. The rationale behind this is so, when the using finally submits their new package, the data are already inserted so creating the package is fast.
This has the potential to leave behind temporary or orphaned DATA Objects if the user (1) drags files into the Editor and then (2) cancels their submission / closes the tab/browser. The Editor should/could do something about this.
The Editor could try to do some immediate cleanup, such as:
- Archive the object (via
MNStorage.archive()). Probably a bad idea. - Delete the object (via
MNStorage.delete()). This can't work under the current D1 API which requires the MN Cert to call this - Remove some AccessPolicy rules. Not sure what benefit this would have but I'm throwing it out there.
These actions could be problematic as they require the user's browser to send the requests which we can't guarantee will happen. So as a complementary solution, it might be good to:
- Explain whatever behavior exists in the Editor and its consequences in the MetacatUI (Editor) docs
- Consider implementing some sort of cleanup routine in Metacat (Maybe not?)
- Consider showing the user their orphaned objects somehow (Profile?) and allowing them to do something with them like archive them or use them in a package (Editor could suggest orphaned objects when the user is filling out a new package)
- Calculate the checksum when a new file is added and look for an existing or orphaned object with the same checksum (Requires the Editor to be calculate the checksum using a few algorithms which is kinda lame but workable)
- Keep track of these objects in LocalStorage in the Editor so they appear to the user when they re-open the editor