WIP: allow progressive and ajax/SPA templates #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows the template system to load progressively, or use ajax to dynamically load the notebook output.
The idea (which I feel is not 100% solid yet, since it feels not that easy to explain / not super intuitive) is to have 2 phase, phase 0 and 1.
By default, voila executes both phases (and if voila.html is not present, phase 0 will be effectively skipped).
Progressive loading works the following:
<html>...<body>....
<script that removes spinner> .... </body></html>
A SPA (single page app) that would like to use ajax, could use the following strategy.
phase=1
An example of how it looks using the 'progressive' template:
(using ajax kind looks the same)
There is quite some duplication of template snippets, although I am not sure we can nicely fix this without creating confusion. Also, I don't like the phase=0/1 naming; we can think about a different name, or have different tornado handlers for each phase.
I do like that it is becoming quite flexible. I can see, with this PR, that one could create a single page dashboard that could load different notebooks without a page reload for instance.