[ARVADOS] updated: 94abf66ab822425b025b8c88ebf9a2754b776ac3
git at public.curoverse.com
git at public.curoverse.com
Fri May 16 13:41:56 EDT 2014
Summary of changes:
apps/workbench/app/assets/javascripts/event_log.js | 42 +++++++---------------
.../pipeline_instances/_show_components.html.erb | 2 +-
2 files changed, 13 insertions(+), 31 deletions(-)
via 94abf66ab822425b025b8c88ebf9a2754b776ac3 (commit)
from 1b6c6a52d0bba5b0a03524c7477ee9e8836c5f5b (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 94abf66ab822425b025b8c88ebf9a2754b776ac3
Author: radhika <radhika at curoverse.com>
Date: Fri May 16 13:40:01 2014 -0400
2756: much cleaner and leaner
diff --git a/apps/workbench/app/assets/javascripts/event_log.js b/apps/workbench/app/assets/javascripts/event_log.js
index 9ff0e7e..e62b6a4 100644
--- a/apps/workbench/app/assets/javascripts/event_log.js
+++ b/apps/workbench/app/assets/javascripts/event_log.js
@@ -1,14 +1,11 @@
/*
- * This file establishes a websockets connection with the API Server.
- *
- * The subscribe method takes a window element id and object id. Any log
- * events for that particular object id are added to that window element.
+ * This js establishes a websockets connection with the API Server.
*/
-var event_log_disp;
-
+/* The subscribe method takes a window element id and object id.
+ Any log events for that particular object id are sent to that window element. */
function subscribeToEventLog (elementId, listeningOn) {
- // if websockets are not supported by browser, do not attempt to subscribe for events
+ // if websockets are not supported by browser, do not subscribe for events
websocketsSupported = ('WebSocket' in window);
if (websocketsSupported == false) {
return;
@@ -20,39 +17,24 @@ function subscribeToEventLog (elementId, listeningOn) {
// create the event log dispatcher
event_log_disp = new WebSocket(sessionStorage.getItem("arv-websocket-url"));
- event_log_disp.onopen = function(event) { onEventLogDispatcherOpen(event) };
- event_log_disp.onmessage = function(event) { onEventLogDispatcherMessage(event) };
+ event_log_disp.onopen = onEventLogDispatcherOpen;
+ event_log_disp.onmessage = onEventLogDispatcherMessage;
// store websocket in window to allow reuse when multiple divs subscribe for events
$(window).data("arv-websocket", event_log_disp);
}
-
- // Add the elementId to listener map
- event_log_listener_map = $(window).data("event_log_listener_map");
- if (event_log_listener_map == null)
- event_log_listener_map = {};
- event_log_listener_map[elementId] = listeningOn;
- $(window).data("event_log_listener_map", event_log_listener_map);
}
+/* send subscribe message to the websockets server */
function onEventLogDispatcherOpen(event) {
- event_log_disp.send('{"method":"subscribe"}');
+ this.send('{"method":"subscribe"}');
}
-// 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
+/* trigger event for all applicable elements waiting for this event */
function onEventLogDispatcherMessage(event) {
- event_log_listener_map = $(window).data("event_log_listener_map");
-
parsedData = JSON.parse(event.data);
event_uuid = parsedData.object_uuid;
- for (var key in event_log_listener_map) {
- value = event_log_listener_map[key];
- if (event_uuid === value) {
- matches = ".arv-log-event-listener[data-object-uuid=\"" + value + "\"]";
- $(matches).trigger('arv-log-event', event.data);
- }
- }
- // also trigger event for any listening for "all"
- $('.arv-log-event-listener[data-object-uuid="all"]').trigger('arv-log-event', event.data);
+
+ matches = ".arv-log-event-listener[data-object-uuid=\"" + event_uuid + "\"],.arv-log-event-listener[data-object-uuid=\"all\"]";
+ $(matches).trigger('arv-log-event', event.data);
}
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 bba2aa9..837fb50 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
@@ -88,7 +88,7 @@ setInterval(function(){$('a.refresh').click()}, 15000);
<% end %>
<% if !@object.state.in? ['Complete', 'Failed'] %>
- <h3>Log for pipeline</h3>
+ <h4>Log for pipeline</h4>
<div class="arv-log-event-listener arv-log-event-handler-append-logs" id="pipeline_event_log_div" data-object-uuid="<%=@object.uuid%>"/>
<% end %>
<% end %>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list