open-scd
open-scd copied to clipboard
Automatic Backup
I was configuring an SCL file and web services suddenly collapsed and I lost my data since there were no back up or "go back" option. -It would be nice to have an automatic backup that forwards the file to "Downloads" directory, periodically. -Second option could be a reminder to save the files which will block all activities until user save the project.
Thanks for you feedback. What kind of webservices do you mean?
I actually wanted mention web location of open scd --> https://openscd.github.io/ I tried to re produce the issue, Crash happens after a bunch of configuration changes in the project.
@ca-d what can we do here using browser only?
The CoMPAS version of OpenSCD supports a database backend:
However it does not support automatic backup.
I had a play recently at prototyping this using the FileSystem API (not present in all browsers). It works with Chrome (and likely Edge but probably not Safari or Firefox).
You can add this plugin as a Menu plugin using the URL: https://danyill.github.io/oscd-automatic-backup/oscd-automatic-backup.js
The plugin repo is here: https://github.com/danyill/oscd-automatic-backup
How it works is:
- after granting permissions to a folder it will write a backup every x minutes up to a total of y backups and then remove the earliest backup.
- some folders can't be used (which are considered "system" folders for security reasons).
- for each session it has to be initialised by choosing a folder again (because thems the rules on the web).
- if the user stops editing it no longer writes backups (editCount not changing).
I think for a non-database solution this is quite nice but it is only a prototype at the moment (no tests, no proper error checking etc.). I would be grateful for some comment/feedback.
Thanks for your great work, Daniel! I've tried to use it for a few days and have not found anything to be broken so far. One thing that surprised me about the UI is that I could not simply click "choose folder" and get going, but instead had to click the not terribly prominently placed "enable backup" switch. To me it would be more intuitive if there was no such switch at all and instead a new "disable" button would show up between "cancel" and "choose folder" as soon as the backup is enabled.
Thank you for these comments and your kind words, I have made some improvement, I hope you like them :wink:
I shall be pleased to receive further feedback but for my needs this is now be "feature complete".
I have also made it such that, if the user has enabled the plugin and then refreshed the page, when edits are made there is a reminder to set a directory or disable the plugin. I think that's the best we can do.