Merge branch '12552-slurm-priority'
[arvados.git] / apps / workbench / app / assets / javascripts / work_unit_log.js
index 07ca74c8504269c78a4ac6091ebd1884053eed23..c43bae0e3c7e080d01c0fc69d19e2435612777e1 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
 $(document).on('arv-log-event', '.arv-log-event-handler-append-logs', function(event, eventData){
     var wasatbottom, txt;
     if (this != event.target) {
@@ -10,8 +14,12 @@ $(document).on('arv-log-event', '.arv-log-event-handler-append-logs', function(e
     }
 
     txt = '';
-    if ('text' in eventData.properties) {
+    if ('text' in eventData.properties &&
+       eventData.properties.text.length > 0) {
         txt += eventData.properties.text;
+        if (txt.slice(txt.length-1) != "\n") {
+            txt += "\n";
+        }
     }
     if (eventData.event_type == 'update' &&
         eventData.object_uuid.indexOf("-dz642-") == 5 &&
@@ -31,10 +39,7 @@ $(document).on('arv-log-event', '.arv-log-event-handler-append-logs', function(e
                 txt += stamp + "Container "+eventData.object_uuid+" started\n";
                 break;
             case "Complete":
-                var outcome = eventData.properties.new_attributes.exit_code === 0 ? "success" : "failure";
-                txt += stamp + "Container "+eventData.object_uuid+" finished with exit code " +
-                    eventData.properties.new_attributes.exit_code +
-                    " ("+outcome+")\n";
+                txt += stamp + "Container "+eventData.object_uuid+" finished\n";
                 break;
             case "Cancelled":
                 txt += stamp + "Container "+eventData.object_uuid+" was cancelled\n";
@@ -52,7 +57,7 @@ $(document).on('arv-log-event', '.arv-log-event-handler-append-logs', function(e
         return;
     }
 
-    wasatbottom = ($(this).scrollTop() + $(this).height() >= this.scrollHeight);
+    wasatbottom = (this.scrollTop + this.clientHeight >= this.scrollHeight);
     if (eventData.prepend) {
         $(this).prepend(txt);
     } else {