google-code-export / stoqs

Automatically exported from code.google.com/p/stoqs
GNU General Public License v3.0
1 stars 1 forks source link

Add a "Share this view" function #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
As the STOQS UI becomes more feature rich (and more complicated) the need to 
save and share particular views is growing. A data exploration session can 
produce a complex data filtering resulting in an interesting visualization. 
Replicating this can be arduous and inexact. Most of the information need to 
dynamically re-create the state of the UI is programmatically available.

The ajax request for summary data contains all the filter constraints. This 
information can be serialized and saved in a urlencoded format. The UI state 
(which accordions are opened/closed, etc.) is a bit more complex. There are 
methods for saving these states in cookies.

Investigate a method to encode the UI state and share/save it as a stoqs url. 
This url would execute a Django view that will submit the ajax request for 
summary data and configure the UI in the specified state.

Original issue reported on code.google.com by MBARIm...@gmail.com on 22 Feb 2013 at 7:14

GoogleCodeExporter commented 9 years ago
Need to up the priority of this enhancement request. Both the Molecular Ecology 
people and Heer and Shneiderman (http://queue.acm.org/detail.cfm?id=2146416) 
mention the importance of sharing for collaboration.

Original comment by MBARIm...@gmail.com on 26 Feb 2013 at 11:49

GoogleCodeExporter commented 9 years ago
IIRC, the state of all the current sliders is available to the browser.  
Serializing that state in json and sending it down to the server would allow 
the server to store it (and assign it a unique identifier) and return a 
view-specific URL back to the user.

The bulk of the work for this is really in the JavaScript UI code (very little 
resides on the server, aside from a view to store json encoded data in the 
database and return a UUID representing that data.)  We can talk more on the 
phone about this if you like...you'd need to make two new "service" URLs (one 
to store and the other to return a json page config.) and then some JavaScript 
code..assuming the UI hasn't changed significantly since the last time I used 
it.

Original comment by chan...@otg-nc.com on 27 Feb 2013 at 12:46

GoogleCodeExporter commented 9 years ago
The following changesets implement permalink generation and loading:

changeset:   1270:1ff5b7d0ed99
tag:         tip
user:        Chander Ganesan <chander@otg-nc.com>
date:        Mon Jul 29 10:22:14 2013 -0400
files:       stoqs/static/permalink/lz-string.js stoqs/templates/stoqsquery.html
description:
Add in support for the optional client-side permalink, which doesn't rely on 
storing data within the STOQS database.  This can be problematic for a few 
reasons:

1.  The GET parameter generated can be quite long (it is lza compressed then 
base64 compressed.  This can be outside the maximum allowable URL length for a 
browser, which would cause the p
ermalink to not be uncompressed correctly (and fail).  There is some exception 
handling code to try to catch that and alert the user.

2.  The code relies on your window having the same elements as the old window - 
if it does not (i.e., parameters are missing) then it's possible that the 
loading will fail as well.

3.  An additional javacsript library is added for LZA encoding within the 
browser.

The better way to do this is to store permalinks in the database.  To allow for 
the switching between the two, you can use the "client_side_permalink" setting. 
 When set to true, permalink
s would be fully-encoded in the URL.  When set to false, they are stored in the 
database (and are 32 characters long.)  Permalink loading happens based on link 
length, so regardless of the
 setting, both client side and server side permalinks would be loaded correctly.

If you want, you can create a checkbox on the page, and when checked client 
side links are generated, when unchecked server side links, etc.

changeset:   1269:99a8c070c1b8
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 22:02:59 2013 -0400
files:       stoqs/templates/stoqsquery.html
description:
Change stringification to be more compact, the old (easy to read) format was 
just for developing.

changeset:   1268:bbcfbd337764
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:58:01 2013 -0400
files:       stoqs/templates/stoqsquery.html
description:
Add in support for preserving tab selection amongst all tabs on the page.  This 
required some Id's to be added to a couple of tab list <ul>'s that didn't have 
IDs, to ensure we could addre
ss and track each tab independently of the others without having to do crazy 
stuff.  SInce all the subordinate LI's are the same, we use li offset directly 
below the UL to determine the ac
tive tab on save, and the active tab on restore.  Note that means that changing 
the tab order of the UI could end up making restoring a view break.

changeset:   1267:5e848892c950
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:34:58 2013 -0400
files:       stoqs/templates/stoqsquery.html
description:
Add in support for storing the state of all the accordions on the page.  I had 
overlooked this, but realized it after re-reading the ticket.  When permalinks 
are
loaded the accordian state will be preserved.

changeset:   1266:b2a64d7b5e8e
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:19:04 2013 -0400
files:       stoqs/templates/stoqsquery.html
description:
Add in functions to grab configuration from the page and store it in a JSON 
object, save the JSON object to the database, retrieve/generate a permalink 
URL, and add in support for finding 
the permalink component of the URL and then retrieving and rendering it in the 
browser.

changeset:   1265:6908f7807fff
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:17:50 2013 -0400
files:       stoqs/views/permalinks.py
description:
The new views to handle permalink-related activities.  Create a database entry 
to store permalink data, and a view to manage retrieving it.  Note that 
retrieval will add some basic trackin
g to make it (hopefully) easier to cleanup unused permalinks in the future.

changeset:   1264:18549a130cfe
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:16:38 2013 -0400
files:       stoqs/static/permalink/json2.js stoqs/static/permalink/purl.js
description:
Add in support for permalinks, this adds a (cross browser usable) mechanism to 
create JSON Strings, and also a set of tools (jQuery) for accessing and 
managing parts of the URL.

changeset:   1263:ad101140bcc8
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:15:39 2013 -0400
files:       urls.py
description:
update urls.py to add in paths for saving and loading a permalink.

changeset:   1262:2a7f9497887a
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:15:18 2013 -0400
files:       utils/Viz/__init__.py
description:
Change the module to gracefully handle the case where the media directory 
doesn't exist.  I didn't see where this would have been created from the docs, 
but when it isn't there then things
 kind of break.  This check will create the directory if possible, or log a useful message to the logs indicating that the directory needs to be added.

changeset:   1261:0b9b9cd1dbce
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:13:57 2013 -0400
files:       PREREQUISITES
description:
Add the simplejson requirement to the document

changeset:   1260:6ce931714849
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:13:41 2013 -0400
files:       stoqs/models.py
description:
Update models to add in a new model for storing permalink data.

changeset:   1259:89936925313d
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:13:14 2013 -0400
files:       setup.sh
description:
Various updates to the setup script to make it more robust and easier to 
install a venv for stoqs.

changeset:   1258:c961dc146407
user:        Chander Ganesan <chander@otg-nc.com>
date:        Sun Jul 28 21:12:45 2013 -0400
files:       requirements.txt
description:
Add in the simplejson requirement used to validate serialized data sent to the 
server.

Original comment by MBARIm...@gmail.com on 29 Jul 2013 at 4:07

GoogleCodeExporter commented 9 years ago
There are still a few bugs with this.  Sometimes a permalink is generated that 
when loaded has the map not showing.  

There are also problems with Parameters from multiple Platforms not plotting, 
but that is another issue - literally, another issue is being posted to deal 
with plotting Parameters measured by multiple Platforms.

Original comment by MBARIm...@gmail.com on 26 Sep 2013 at 1:42