Skip to content
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

Refreshing the Galaxy history after putting data in it. #3

Open
bgruening opened this issue Jul 30, 2014 · 3 comments
Open

Refreshing the Galaxy history after putting data in it. #3

bgruening opened this issue Jul 30, 2014 · 3 comments
Milestone

Comments

@bgruening
Copy link
Owner

It would be nice if we were able to refresh the history after we have transferred some data to it. I'm not aware of any function from bioblend that supports that ...

@hexylena
Copy link
Collaborator

That would be really nice, agreed. Howevever since the client is polling the server for history updates, there's no way for the server to tell the client anything ahead of the next scheduled poll.

I bet we could do something like this though: http://stackoverflow.com/questions/7502047/can-scripts-in-iframe-interact-with-scripts-in-the-main-pag

Because the docker and galaxy instances are on the same domain we can probably trigger javascript to click the refresh history button.

We can definitely do that on notebook save. No idea how we'll do it on put() requests though.

@hexylena hexylena changed the title Refreshing the Galaxy history after put'ing data in it. Refreshing the Galaxy history after putting data in it. Jul 30, 2014
@hexylena
Copy link
Collaborator

Okay, I've tested this today and cannot get this to work. It may be for any number of reasons (I'm certainly no JS expert, perhaps someone who is will be able to fix this.)

I tested it by opening up a new notebook and running the following in a cell:

from IPython.display import HTML
js = """
<script type="text/javascript>
$("#history-refresh-button").click();
</script>
"""
HTML(js)

In the context of a browser JS console window, this works correctly and reloads the history. In the context of IPython if fails to execute the refresh.

@hexylena
Copy link
Collaborator

From IRC, we'll have to have a PubSubHub of some manner running on the notebook image, which can be subscribed to by JS within the mako template. Whenever we receive a notification of a new history item, we can call Galaxy.currHistoryPanel.refreshContents, where var Galaxy = window.parent.Galaxy;

12:27 < ceberhard> So, here's my next guess:
12:27 < ceberhard> You *can* access the Galaxy object from your vis template scripts.
12:27 < ceberhard> "console.debug( 'parent:', window.parent.Galaxy );"
12:27 < esr_> Hmmmmmmmmm
12:27 < ceberhard> (this would only work if it's displayed in the center panel and not if it's in it's own tab).
12:28 < esr_> Oh that gets messy quickly...we could use JS in the template to parse the DOM we've loaded and watch for changes?
12:28 < ceberhard> I would recommend pubsub for that.
12:28 < esr_> Huh. That's a very interesting idea.
12:28 < ceberhard> If you can create a mediator in your mako template between the parent.Galaxy and the template.
12:28 < esr_> bag: mark for v0.2 :P
12:29 < bag> ceberhard, it is in the central panel
12:29 < esr_> yeah
12:29 < esr_> HUH.
12:29 < ceberhard> And then, also have it mediate between your *inner* iframe and it's messages.
12:29 < esr_> That might work
12:29 < esr_> Great suggestion, thanks :)
12:29 < ceberhard> Well - don't thank me yet.
12:29 < bag> esr_, yes nothing for version 0.1 :)
12:29 < ceberhard> Because it's from a different host...
12:30 < ceberhard> the message from your *inner* iframe to the mako template may not be allowed.
12:30 < esr_> ceberhard: well, if we can access galaxy there we can easily pubsub with the remote end for changes, that shouldn't be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants