diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 49: fix two bugs in the new job view:

Message ID 20110727002718.6332.65357.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson July 27, 2011, 12:27 a.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
------------------------------------------------------------
revno: 49 [merge]
committer: Michael-Doyle Hudson <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Wed 2011-07-27 12:25:45 +1200
message:
  fix two bugs in the new job view:
  1) a newline was inserted on each poll even if there was no new data
  2) the json definition could flow out of the tab
modified:
  fake-dispatcher
  lava_scheduler_app/templates/lava_scheduler_app/job.html


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'fake-dispatcher'
--- fake-dispatcher	2011-07-25 05:41:22 +0000
+++ fake-dispatcher	2011-07-27 00:22:15 +0000
@@ -2,7 +2,7 @@ 
 echo starting processing $1
 echo error >&2
 for i in `seq 30`; do
-sleep 1
+sleep 2
 echo $i
 cat $1
 echo

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/job.html'
--- lava_scheduler_app/templates/lava_scheduler_app/job.html	2011-07-26 05:10:49 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/job.html	2011-07-27 00:23:24 +0000
@@ -67,10 +67,8 @@ 
     <li><a href="#tab-output">Output</a></li>
 {% endif %}
   </ul>
-  <div id="tab-definition">
-    <pre>
-{{ job.definition }}
-    </pre>
+  <div id="tab-definition" >
+    <pre style="overflow: auto;">{{ job.definition }}</pre>
   </div>
 {% if log_file_present %}
   <div id="tab-output">
@@ -105,23 +103,25 @@ 
     global: false,
     success: function (data, success, xhr) {
       var node = $("<pre></pre>");
-      node.text(data);
-      var progressNode = $('#tab-output img');
-      var scrollDiv = progressNode.closest('div');
-      var atBottom = scrollDiv.attr('offsetHeight') + scrollDiv.attr('scrollTop') >= scrollDiv.attr('scrollHeight') && scrollDiv.attr('offsetHeight') > progressNode.attr('offsetHeight');
-      var skipped = xhr.getResponseHeader('X-Skipped-Bytes');
-      if (skipped) {
-        var notice = $('<code class="skip">... skipped ' + skipped + ' bytes (<a href="#">load</a>) ...</code>');
-        var curLength = logLenth;
-        $('a', notice).click(function (e) {
-          e.preventDefault();
-          loadExtra(notice, curLength, skipped);
-        });
-        notice.insertBefore(progressNode);
-      }
-      node.insertBefore(progressNode);
-      if (atBottom) {
-        scrollDiv.attr('scrollTop', scrollDiv.attr('scrollHeight'))
+      if (data.length > 0) {
+        node.text(data);
+        var progressNode = $('#tab-output img');
+        var scrollDiv = progressNode.closest('div');
+        var atBottom = scrollDiv.attr('offsetHeight') + scrollDiv.attr('scrollTop') >= scrollDiv.attr('scrollHeight') && scrollDiv.attr('offsetHeight') > progressNode.attr('offsetHeight');
+        var skipped = xhr.getResponseHeader('X-Skipped-Bytes');
+        if (skipped) {
+          var notice = $('<code class="skip">... skipped ' + skipped + ' bytes (<a href="#">load</a>) ...</code>');
+          var curLength = logLenth;
+          $('a', notice).click(function (e) {
+            e.preventDefault();
+            loadExtra(notice, curLength, skipped);
+          });
+          notice.insertBefore(progressNode);
+        }
+        node.insertBefore(progressNode);
+        if (atBottom) {
+          scrollDiv.attr('scrollTop', scrollDiv.attr('scrollHeight'))
+        }
       }
       logLenth = xhr.getResponseHeader('X-Current-Size');
       if (xhr.getResponseHeader('X-Is-Finished')) {