Merge branch 'master' of git.curoverse.com:arvados #2751
[arvados.git] / apps / workbench / app / assets / javascripts / event_log.js
index 9be2979c22591eaaee59f2dbc6c99e116a808f59..0ebb999b7645f69907e0f9b56b4958c549d3f74c 100644 (file)
@@ -4,11 +4,11 @@
 
 /* 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) {
+function subscribeToEventLog (elementId) {
   // if websockets are not supported by browser, do not subscribe for events
   websocketsSupported = ('WebSocket' in window);
   if (websocketsSupported == false) {
-    return;  
+    return;
   }
 
   // grab websocket connection from window, if one exists
@@ -37,8 +37,9 @@ function onEventLogDispatcherOpen(event) {
 /* trigger event for all applicable elements waiting for this event */
 function onEventLogDispatcherMessage(event) {
   parsedData = JSON.parse(event.data);
-  event_uuid = parsedData.object_uuid;
+  object_uuid = parsedData.object_uuid;
 
-  matches = ".arv-log-event-listener[data-object-uuid=\"" + event_uuid + "\"],.arv-log-event-listener[data-object-uuid=\"all\"]";
+  // if there are any listeners for this object uuid or "all", trigger the event
+  matches = ".arv-log-event-listener[data-object-uuid=\"" + object_uuid + "\"],.arv-log-event-listener[data-object-uuids~=\"" + object_uuid + "\"],.arv-log-event-listener[data-object-uuid=\"all\"]";
   $(matches).trigger('arv-log-event', event.data);
 }