Merge branch 'master' into 2756-eventbus-in-workbench
[arvados.git] / apps / workbench / app / assets / javascripts / pipeline_instances.js
index ee14e3b78127dbdfc79513abc97e4ed4c29b18d8..d66cffcae1823d6ae0fe351776fff8b53b9a66cb 100644 (file)
@@ -1,4 +1,3 @@
-
 (function() {
     var run_pipeline_button_state = function() {
         var a = $('a.editable.required.editable-empty');
         run_pipeline_button_state();
     } );
 
+    $(document).on('ajax:complete ready', function() {
+      var a = $('.arv-log-event-listener');
+      if (a.length > 0) {
+        $('.arv-log-event-listener').each(function() {
+          subscribeToEventLog(this.id, this.getAttribute('data-object-uuid'));
+        });
+      }
+    });
+
+    $(document).on('arv-log-event', '.arv-log-event-handler-append-logs', function(event, eventData){
+      parsedData = JSON.parse(eventData);
+      summary = parsedData.summary;
+      properties = parsedData.properties;
+      updatedProperties = null;
+      if (properties !== null) {
+        new_attributes = properties.new_attributes;
+        if (new_attributes !== null) {
+          updatedProperties = JSON.stringify(properties.new_attributes);
+        }
+      }
+
+      if (updatedProperties !== null) {
+        $(this).append(updatedProperties + "<br/><br/>");
+      } else {
+        $(this).append(summary + "<br/><br/>");
+      }
+    });
+
 })();