Comments (9)
a setInterval every X seconds should do the trick, but you are right, I have no idea performance-wise how this works. I can eventually create a 3 state dropdown (like: off, autosave, manual save) so a user can decide the behavior, default would be off and if a user wants to enable the functionality is free to do so
from drb.
Great idea.
One final suggestion: please consider using setTimeout instead of setInterval. That is because if, for example, the interval is 5 seconds, and the save function takes 3 seconds, then the user is left with 2 seconds of 'unfrozen' UI to do any work. If the save function takes the full 5 seconds, then the UI will hang.
You can scale that up to any interval for the same outcome. setTimeout allows for a breather on the UI for slow logic.
Regardless of the method, thank you for listening.
from drb.
@yagasoft I had another change in the pipeline so I had time to check about this functionality.
I released a new version (1.0.0.14), now you can manually save the collection to localStorage using the Save State option (right click on the collection).
The localStorage key name includes the instance url, so if you use the same browser with different instances it should work.
I know it's not the autosave functionality but I will keep this issue open for a while as reminder, I want to do some tests with the Worker API but right now I can't dedicate too much time on this, the manual save was easier to implement.
from drb.
Please let me know if you would like me to take a stab at it.
from drb.
@yagasoft I am not familiar with the functionality, probably I can replicate the behavior you described using the localStorage (so the current state is always saved there and when the page is loaded it checks if an entry exists there).
If you have suggestions on how this can be added to DRB let me know
from drb.
@GuidoPreite
Indeed, that is what I had in mind exactly.
Periodically, say every 5 seconds, invoke the 'save' functionality but don't pop up the 'save file' dialogue. Instead, save the JSON directly to localStorage.
On load, check the localStorage for the JSON. If found, invoke the 'load' function but don't pop up the 'load file' dialogue. Instead, load the JSON read from storage.
I am not sure how performant is the 'save' function, but if it's too slow with large collections, we could replace the internal loop with an always-visible button to save progress in the browser. Or, we could measure the performance of the save, and if it takes longer than 100ms, for example, we could show that button for the user and increase the loop time to be 60 seconds, for example.
I am just spitballing, to be honest, but there are a lot of ways to do it.
Shame that JS is single-threaded, or it would have been straightforward. One way to overcome the performance hit of the internal loop is to implement a Web Worker ...
https://medium.com/techtrument/multithreading-javascript-46156179cf9a
from drb.
Manual save in the browser will make things much easier. Extra functionality than that is nice to have for sure.
Thank you.
from drb.
@yagasoft thanks again for making this suggestion. It was very helpful for me to be able to save the collection state inside localStorage when I added the Fetch API syntax and when I added the REST Client export.
I thought in the last days about the autosave and I decided to don't proceed as I can't create something reliable and suitable for everybody.
I also checked the jsTree events (the request configuration is saved inside the data attribute of the jsTree node) but also the "changed" one doesn't get triggered when the data attribute is updated.
Sadly I also update the configuration (DRB.Metadata.CurrentNode that is a reference to the jsTree node) not uniformly in the code I wrote, making it difficult to pursue an approach related to this.
Feel free to comment if you want to add something, I will close this ticket 3 days later.
from drb.
Thank you for considering my suggestion.
You could create a loop in a Web Worker and let it save periodically, regardless of events. The saved data would be exactly the same as the 'export to JSON' functionality. It wouldn't affect performance. However, you know your solution better than I do.
In any case, thanks again for adding the current save functionality. It's very helpful, indeed.
from drb.
Related Issues (18)
- Export as Postman Collection - Grant Type = Client Credentials HOT 3
- Where is the entrance? After installation HOT 1
- Error after long loading in XrmToolBox HOT 4
- Execute Code Error: Xrm is not definied (XrmToolBox) HOT 1
- Support for duplicate detection in Create HOT 2
- Could not load file or assembly 'Microsoft.Web.WebView2.WinForms' after updating to Version 1.0.0.42 HOT 1
- "Top count" is not applied in Portals query string HOT 5
- One-to-many relationship dropdownlist doesn't fit in window in User entity HOT 4
- Callback after "Get Access Token" does not work in browser HOT 7
- [Question] Integration with Dataverse Browser? HOT 1
- OnPremise version connections are unsuported in XrmToolbox? HOT 2
- [Enhancement] Support for Power Automate Dataverse Connector Parameters HOT 1
- Issue on systemuser table HOT 3
- Requested API version not understood HOT 5
- Not compatible with 8.2 HOT 1
- Error when trying to use DRB on XrmToolBox HOT 5
- Issue on latest update from XrmToolbox HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drb.