diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 156: If the job log view is scrolled to the bottom when new output

Message ID 20120320212410.11186.3716.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson March 20, 2012, 9:24 p.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~mwhudson/lava-scheduler/restore-pinning-js-bug-927981/+merge/98141
  proposed by: Michael Hudson-Doyle (mwhudson)
  review: Approve - Zygmunt Krynicki (zkrynicki)
------------------------------------------------------------
revno: 156 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Wed 2012-03-21 10:21:40 +1300
message:
  If the job log view is scrolled to the bottom when new output
  arrives, keep the view at the bottom.
modified:
  doc/changes.rst
  fake-dispatcher
  lava_scheduler_app/management/commands/scheduler.py
  lava_scheduler_app/templates/lava_scheduler_app/job_log_file.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 'doc/changes.rst'
--- doc/changes.rst	2012-03-15 21:27:02 +0000
+++ doc/changes.rst	2012-03-19 23:46:57 +0000
@@ -1,18 +1,20 @@ 
 Version History
 ***************
 
-* Show all dispatcher logs.
-* Highlight action lines.
-* Download log file in summary page
 
 .. _version_0_12:
 
 Version 0.12 (UNRELEASED)
 =========================
 * Two fixes around job privacy:
-  * Display ValueErrors raised by from_json_and_user nicely to API
-    users.
+  * Display ValueErrors raised by from_json_and_user nicely to API users.
   * Allow submission to anonymous streams again.
+* Job view improvements:
+  * Show all dispatcher logs.
+  * Highlight action lines.
+  * Add link to download log file in summary page.
+  * If the job log view is scrolled to the bottom when new output arrives, keep
+    the view at the bottom.
 
 .. _version_0_11:
 

=== modified file 'fake-dispatcher'
--- fake-dispatcher	2011-08-24 10:33:21 +0000
+++ fake-dispatcher	2012-03-19 04:32:52 +0000
@@ -1,8 +1,13 @@ 
 #!/bin/sh
 echo starting processing $1
 echo error >&2
-for i in `seq 3`; do
-sleep 2
+for i in `seq 100`; do
+echo p $i
+cat $1
+echo
+done
+for i in `seq 300`; do
+sleep 1
 echo $i
 cat $1
 echo

=== modified file 'lava_scheduler_app/management/commands/scheduler.py'
--- lava_scheduler_app/management/commands/scheduler.py	2012-02-16 01:39:54 +0000
+++ lava_scheduler_app/management/commands/scheduler.py	2012-03-19 04:31:48 +0000
@@ -59,8 +59,10 @@ 
         source = DatabaseJobSource()
 
         if options['use_fake']:
+            import lava_scheduler_app
+            opd = os.path.dirname
             dispatcher = os.path.join(
-                os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
+                opd(opd(os.path.abspath(lava_scheduler_app.__file__))),
                 'fake-dispatcher')
         else:
             dispatcher = options['dispatcher']

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html'
--- lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html	2011-12-13 04:22:40 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html	2012-03-19 23:44:40 +0000
@@ -37,6 +37,9 @@ 
           var d = data[i];
           var cls = 'log_' + d[0];
           var last_pre = $("#logfile_content pre:last");
+          var s = $("html"), w = $(window);
+          var atBottom = w.attr('innerHeight') + w.scrollTop() >= s.attr('scrollHeight')
+                      && w.attr('innerHeight') > progressNode.attr('offsetHeight');
           if (last_pre.attr('class') == cls) {
               last_pre.append(document.createTextNode(d[2]));
           } else {
@@ -45,6 +48,9 @@ 
               newNode.text(d[2]);
               newNode.insertBefore(progressNode);
           }
+          if (atBottom) {
+            w.scrollTop(s.attr('scrollHeight'))
+          }
       }
       logLenth = xhr.getResponseHeader('X-Current-Size');
       if (xhr.getResponseHeader('X-Is-Finished')) {