[ARVADOS] updated: 6ea7ba8654f7620a5e0ba4f66d653026b3f002fe
git at public.curoverse.com
git at public.curoverse.com
Thu May 15 22:11:19 EDT 2014
Summary of changes:
apps/workbench/app/assets/javascripts/event_log.js | 34 ++++------------------
.../app/assets/javascripts/pipeline_instances.js | 9 ++++++
apps/workbench/app/models/arvados_api_client.rb | 9 +++++-
.../pipeline_instances/_show_components.html.erb | 12 +++++++-
.../pipeline_instances/_show_event_log.html.erb | 8 -----
services/fuse/arvados_fuse/__init__.py | 27 +++++++++--------
services/fuse/bin/arv-mount | 4 +--
7 files changed, 51 insertions(+), 52 deletions(-)
delete mode 100644 apps/workbench/app/views/pipeline_instances/_show_event_log.html.erb
via 6ea7ba8654f7620a5e0ba4f66d653026b3f002fe (commit)
via e35566eddb0c1e383e437e95b228f7898e7a1c16 (commit)
via 043002e8d0dfd2a5dbb3cfc135ac21732c199c05 (commit)
via 278fe7048f9035b350a60e032432c9119f151add (commit)
via 7a873b4adfd0a7f94a4e7dfa64eb088caece46df (commit)
via 7b4d7faff279490a40190208bd571a86090e2bf5 (commit)
via 83c873af757aea4217648cc5a909fcadcf3e93e4 (commit)
from f2574ec2e4ddef03c9504cd58741e73426ea1b17 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 6ea7ba8654f7620a5e0ba4f66d653026b3f002fe
Merge: e35566e 043002e
Author: radhika <radhika at curoverse.com>
Date: Thu May 15 22:11:00 2014 -0400
Merge branch 'master' into 2756-eventbus-in-workbench
commit e35566eddb0c1e383e437e95b228f7898e7a1c16
Author: radhika <radhika at curoverse.com>
Date: Thu May 15 22:09:45 2014 -0400
2756: subscribe for event log messages on ajax:complete or ready.
diff --git a/apps/workbench/app/assets/javascripts/event_log.js b/apps/workbench/app/assets/javascripts/event_log.js
index 243f733..61b4fdc 100644
--- a/apps/workbench/app/assets/javascripts/event_log.js
+++ b/apps/workbench/app/assets/javascripts/event_log.js
@@ -7,7 +7,7 @@
var event_log_disp;
-function subscribeToEventLog (url, uuid, elementId) {
+function subscribeToEventLog (elementId) {
// if websockets are not supported by browser, do not attempt to subscribe for events
websocketsSupported = ('WebSocket' in window);
if (websocketsSupported == false) {
@@ -18,27 +18,21 @@ function subscribeToEventLog (url, uuid, elementId) {
event_log_disp = $(window).data("arv-websocket");
if (event_log_disp == null) {
// create the event log dispatcher
- event_log_disp = new WebSocket(url);
+ event_log_disp = new WebSocket($(window).data("websocket-url"));
event_log_disp.onopen = function(event) { onEventLogDispatcherOpen(event) };
event_log_disp.onmessage = function(event) { onEventLogDispatcherMessage(event) };
// store websocket in window to allow reuse when multiple divs subscribe for events
$(window).data("arv-websocket", event_log_disp);
-
- // detach elementId when user leaves this window
- window.onbeforeunload = function (event) {detachElement(event, elementId);}
}
// Add the elementId to listener map
- event_log_listener_map = JSON.parse(sessionStorage.getItem("event_log_listener_map"));
+ event_log_listener_map = $(window).data("event_log_listener_map");
if (event_log_listener_map == null)
event_log_listener_map = {};
- delete event_log_listener_map[elementId];
- event_log_listener_map[elementId] = uuid;
-
- sessionStorage.removeItem("event_log_listener_map");
- sessionStorage.setItem("event_log_listener_map", JSON.stringify(event_log_listener_map));
+ event_log_listener_map[elementId] = $(window).data("listening-uuid");
+ $(window).data("event_log_listener_map", event_log_listener_map);
}
function onEventLogDispatcherOpen(event) {
@@ -48,7 +42,7 @@ function onEventLogDispatcherOpen(event) {
// Check each of the entries in the listener map. If any are waiting for
// an event of this event's object, append to their registered element
function onEventLogDispatcherMessage(event) {
- event_log_listener_map = JSON.parse(sessionStorage.getItem("event_log_listener_map"));
+ event_log_listener_map = $(window).data("event_log_listener_map");
for (var key in event_log_listener_map) {
value = event_log_listener_map[key];
@@ -69,19 +63,3 @@ function onEventLogDispatcherMessage(event) {
}
}
}
-
-/**
- * When leaving this window, remove elementId from map
- */
-function detachElement(event, elementId) {
- event_log_listener_map = JSON.parse(sessionStorage.getItem("event_log_listener_map"));
- if (event_log_listener_map !== null) {
- delete event_log_listener_map[elementId];
- }
-
- // According to documenation, browser will close the connection when page is left.
- // However, there are suggestions of inconsistency; so to be safe, close explicitly.
- if (event_log_disp !== null) {
- event_log_disp.close();
- }
-}
diff --git a/apps/workbench/app/assets/javascripts/pipeline_instances.js b/apps/workbench/app/assets/javascripts/pipeline_instances.js
index a9ca4df..40b2762 100644
--- a/apps/workbench/app/assets/javascripts/pipeline_instances.js
+++ b/apps/workbench/app/assets/javascripts/pipeline_instances.js
@@ -42,4 +42,13 @@
run_pipeline_button_state();
} );
+ $(document).on('ajax:complete ready', function() {
+ var a = $('.event-listener');
+ if (a.length > 0) {
+ $('.event-listener').each(function() {
+ subscribeToEventLog(this.id);
+ });
+ }
+ });
+
})();
diff --git a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
index b3b5402..38be3f5 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
@@ -110,4 +110,14 @@ setInterval(function(){$('a.refresh').click()}, 15000);
<% end %>
<% end %>
-<%= render partial: 'show_event_log', locals: {object: @object} %>
+<% if !@object.state.in? ['Complete', 'Failed'] %>
+ <script>
+ $(window).data("websocket-url", "<%=$arvados_api_client.discovery[:websocketUrl]%>?api_token=<%=Thread.current[:arvados_api_token]%>");
+ $(window).data("listening-uuid", "<%=@object.uuid%>");
+ </script>
+
+ <span>
+ <h3>Log for pipeline</h3>
+ <textarea class="event-listener" row="10" cols="80" id="pipeline_event_log_area"></textarea>
+ </span>
+<% end %>
diff --git a/apps/workbench/app/views/pipeline_instances/_show_event_log.html.erb b/apps/workbench/app/views/pipeline_instances/_show_event_log.html.erb
deleted file mode 100644
index c35562b..0000000
--- a/apps/workbench/app/views/pipeline_instances/_show_event_log.html.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<% if !@object.state.in? ['Complete', 'Failed'] %>
- <span>
- <h3>Log for pipeline</h3>
- <image hidden=true id="pipeline_event_log_img" src="/favicon.ico" onclick="sendToDispatcher();" onload="subscribeToEventLog('<%=$arvados_api_client.discovery[:websocketUrl]%>?api_token=<%=Thread.current[:arvados_api_token]%>', '<%=@object.uuid%>', 'pipeline_event_log_area')";></image>
-
- <textarea row="10" cols="80" id="pipeline_event_log_area"></textarea>
- </span>
-<% end %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list