uwescience / myria-web

Web frontend for Myria
https://demo.myria.cs.washington.edu
Other
11 stars 14 forks source link

save state when moving forward and backward #55

Open dhalperi opened 10 years ago

dhalperi commented 10 years ago

Right now we do a lot of automatic AJAX stuff on page load. One side effect of this is that if you accidentally hit the back button while writing a query, you lose all state. Yikes! This just bit us twice in a row.

The website should pick up where you left off if you hit backwards & forwards. A good model is GitHub, which somehow does this magically.

billhowe commented 10 years ago

Two parts to the solution:

1) Derive a unique url for every state you can reach by manipulating the interface, and make sure each can be resolved correctly server-side (this is the harder part)

2) Use the HTML5 pushState interface to manipulate the browser history so that a) the url changes without a refresh, and b) the back/forward buttons work as expected.

This is how you get the "endless scroll" effect on most news sites nowadays. You just keep scrolling down to see new articles, and the url changes, and you can hit "back" to pop back up through them. Yet it's all AJAX/javascript.

http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/ https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

On Wed, Apr 2, 2014 at 10:20 AM, Daniel Halperin notifications@github.comwrote:

Right now we do a lot of automatic AJAX stuff on page load. One side effect of this is that if you accidentally hit the back button while writing a query, you lose all state. Yikes! This just bit us twice in a row.

The website should pick up where you left off if you hit backwards & forwards. A good model is GitHub, which somehow does this magically.

Reply to this email directly or view it on GitHubhttps://github.com/uwescience/myria-web/issues/55 .

dhalperi commented 10 years ago

Thanks for tips

domoritz commented 10 years ago

Another solution is just have separate pages for different languages and not use ajax for switching languages. The last query written should be stored though and we could use push state for that.

In general, I am not a friend of Ajax for things that can easily be done as separate pages.

stechu commented 10 years ago

Before we have this great state aware feature. Can we set the default language to MyriaL?

I use MyriaL most of the time, so have to switch from Datalog to MyriaL each time. How about others and our users other developers?

dhalperi commented 10 years ago

This seems like something you can easily submit a PR for, @stechu :)


Daniel Halperin Director of Research for Scalable Analytics eScience Institute University of Washington

On Wed, Apr 16, 2014 at 4:30 PM, Shumo Chu notifications@github.com wrote:

Before we have this great state aware feature. Can we make the default language to MyriaL?

I use MyriaL most of the time, so have to switch from Datalog to MyriaL each time. How about others and our users other developers?

— Reply to this email directly or view it on GitHubhttps://github.com/uwescience/myria-web/issues/55#issuecomment-40664963 .

stechu commented 10 years ago

@dhalperi I want to make sure most people is happy about that :) Do most people primarily using MyriaL?

domoritz commented 10 years ago

:+1:

dhalperi commented 10 years ago

Just another input: @mbalazin has expressed a strong :+1: vote for saving state in the editor if we go back to it.

domoritz commented 10 years ago

It it enough to just save the latest state? That would be much easier since we don't have to mess with the history.

dhalperi commented 10 years ago

I don't have an excellent understanding of the low-level implementation issues here, just the high-level application behavior.

The key constraint is that if I'm writing a query, hit 'Queries', and hit the back button, I want to be where I was.


Daniel Halperin Director of Research for Scalable Analytics eScience Institute University of Washington

On Tue, May 6, 2014 at 11:48 AM, Dominik Moritz notifications@github.comwrote:

It it enough to just save the latest state? That would be much easier since we don't have to mess with the history.

— Reply to this email directly or view it on GitHubhttps://github.com/uwescience/myria-web/issues/55#issuecomment-42342866 .

dhalperi commented 10 years ago

92 implemented much of this; let's refine the list of tasks?

domoritz commented 10 years ago
mbalazin commented 10 years ago

Thanks! Here's the detailed scenario:

A user is editing a query so he/she writes a simplified version, executes it, and then goes to see the results. It's important for that user to then be able to go back to the query editor and continue editing the query.

The most recent query is enough for this scenario (no need to keep the entire history).

thanks magda

On Tue, May 6, 2014 at 1:10 PM, Dominik Moritz notifications@github.comwrote:

  • changing tabs can be undone (or at least is stored in state)

— Reply to this email directly or view it on GitHubhttps://github.com/uwescience/myria-web/issues/55#issuecomment-42352394 .

domoritz commented 10 years ago

@mbalazin Exactly this scenario works on https://demo.myria.cs.washington.edu now. As long as the page is not reloaded, a user can also use CMD+Z and CMD+Y to undo/redo changes. I think it would be nice to keep this history as well at least for a few steps. We can probably get this information out of http://codemirror.net/doc/manual.html#api_history

domoritz commented 10 years ago

Done in #93

mbalazin commented 10 years ago

Thanks Dominik!!!! magda

On Tue, May 6, 2014 at 2:30 PM, Dominik Moritz notifications@github.comwrote:

Done in #93 https://github.com/uwescience/myria-web/pull/93

— Reply to this email directly or view it on GitHubhttps://github.com/uwescience/myria-web/issues/55#issuecomment-42361666 .