-
-
Notifications
You must be signed in to change notification settings - Fork 49
898 save app state version 3 #1011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Aleksander Chlebowski <[email protected]>
|
It's an interesting solution, but it seems demanding to be well-validated, as it requires decent Shiny Server testing. I want to continue the discussion started by @pawelru. One of the questions is how to protect the server so as not to be overwhelmed with the number of saves. Possibly control it by expiration date for saves. It is interesting if other users can access another one's saves and if you want to control it. The same app state produces different state id for following saves, which seems inefficient (on a shiny level) but perhaps more secure. Why not additionally support the limited scope URL bookmarking? The URL bookmarking is much more light and transparent, but I understand it can not cover the whole app here. It is too easy to lose everything now by clicking a specific bookmark. There should be a more careful process to apply a bookmark from the bookmark list. There should be an easy way to save all bookmarks to a yaml/txt file. |
…ring/teal into 898_save_app_state3@main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wunderbar 👍
Closes #898
Closes #941
Incorporating bookmarking to
tealapplications. The functionality is handled by theshinybookmarking mechanism, using the"server"mode. The newbookmark_managermodule tracks bookmark history, should the user choose to create more than one in their session.Overview
Inputs are stored with
shiny's built-in bookmarking mechanism using the "server" mode.Additional values may also be stored, which we use to "remember" filter state, filter snapshot history, and bookmark history.
literature
Using bookmarks requires that the
shinyoption"bookmarkStore"be set to"server". Normally this is achieved by callingenableBookmarking("server")before running the app or by settingenableBookmarking = "server"in ashinyAppcall.Here the option is set with a loading hook in
teal. Furthermore, the bookmark manager will enforce this option.Bookmarks are added to a list much like in the snapshot manager module but elements of the list are URLs pointing to bookmarked applications that open in new windows.
Current filter state, snapshot history, and bookmark history are included in the bookmark. The former two are stored by the snapshot manager, the latter - by the bookmark manager.
Note on bookmark history:
Bookmark URL is is obtained using the
session$onBookmarkedcallback. As a result the URL is added to the bookmark list in the state manager module after the bookmark is created and so when one goes to the bookmarked application, the most recent bookmark is not on the list. This is a small price to pay for not relying on potentially unstable internal functions but it deserves a mention.Manager modules
Prior to this PR, the
filter_managermodule was placed in thefilter_manager_modalmodule. The former consisted on a single button that opened a modal dialog where thefilter_managerwas housed.The
snapshot_managermodule was called by thefilter_managerand its UI resided within the modal dialog opened by thefilter_manager_modalbutton.Here, the module that opened the modal is renamed to
wunder_barmodule.wunder_barholds several buttons, each opening a different module. Thewunder_barserver function passes values between its subordinate modules.filter_managerandsnapshot_managerare decoupled. The values that exist in thefilter_manager_srvscope that thesnapshot_managerneeds are added tofilter_manager_srv's return value and are passed to thesnapshot_manager_srvfunction call in thewunder_barserver.Likewise,
snapshot_manager_srvreturns an object needed bybookmark_manager_srv, which is passed accordingly.Module compatibility
Some modules contain logic that precludes bookmarking. Therefore, each individual module will have to be proofed by its author and given the attribute:
teal_bookmarkable = TRUEif bookmarking is possible. (Thebookmarks_identicalfunction will be helpful in checking.)tealwill determine if the modules in the app support bookmarking and communicate it to the app user in the bookmark manager.Miscellaneous
Adjusted some CSS class names and styles.
Additional changes
We know of three issues that preclude the bookmarking mechanism from working:
choices = NULL) and modifying them server-side usingupdate*Inputteal)Issue (3) is remedied by a change in the
module_nested_tabs: unlike starting a naive app, when modules are initiated upon their first viewing, when restoring a bookmark, all modules are initiated on app start. This was done by @gogonzo.Issues (1) and (2) require certain preventative measures, which is explained in detail here.
Appropriate changes have been made:
teal.goshawkUpdate: in the context of
tealupdate*Inputwill never be compatible with bookmarking due toteal.transform.All dynamic inputs must be rewritten with rendering. This will be done during bookmarkability verification (issue below). In some cases the logic still makes it impossible to fully bookmark a module (e.g.
teal.modules.general::tm_g_distribution).TO DO
draggable_bucketsare not bookmarkable teal.widgets#239