Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 02a042b1f -> cf34b68d2


[ZEPPELIN-772] - Improve text append when streaming

### What is this PR for?
This PR is to improve the result output when having interpreter streaming 
running.
If you navigate outside the notebook, then come back inside, the streaming 
output will append below previous result.

### What type of PR is it?
Improvement

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-772

### How should this be tested?
You can run this
```
(1 to 40).foreach{ i=>
    Thread.sleep(1000)
    println("Hello " + i)
}
```
Then navigate to home, then back to the notebook.
You should see the newly streamed result only.

### Screenshots
Before:
![before](https://cloud.githubusercontent.com/assets/710411/14101710/2b3608f6-f5d1-11e5-9501-e9ba7b0bc16c.gif)

After:
![after](https://cloud.githubusercontent.com/assets/710411/14101714/31aaab06-f5d1-11e5-8fc1-645a3324a65e.gif)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Damien CORNEAU <[email protected]>

Closes #804 from corneadoug/improve/flushStreamingOutput and squashes the 
following commits:

76a66a4 [Damien CORNEAU] Flush on first text append event


Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/cf34b68d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/cf34b68d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/cf34b68d

Branch: refs/heads/master
Commit: cf34b68d20d09fd55e23e01942b2f0721cfdc877
Parents: 02a042b
Author: Damien CORNEAU <[email protected]>
Authored: Tue Mar 29 17:02:24 2016 +0900
Committer: Damien CORNEAU <[email protected]>
Committed: Mon Apr 11 10:55:34 2016 +0900

----------------------------------------------------------------------
 .../src/app/notebook/paragraph/paragraph.controller.js       | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/cf34b68d/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js 
b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index 599ed90..a5d2fe3 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -167,7 +167,7 @@ angular.module('zeppelinWebApp')
         angular.element('#p' + $scope.paragraph.id + 
'_text').bind('mousewheel', function(e) {
           $scope.keepScrollDown = false;
         });
-
+        $scope.flushStreamingOutput = true;
       } else {
         $timeout(retryRenderer, 10);
       }
@@ -445,13 +445,17 @@ angular.module('zeppelinWebApp')
 
   $scope.$on('appendParagraphOutput', function(event, data) {
     if ($scope.paragraph.id === data.paragraphId) {
+      if ($scope.flushStreamingOutput) {
+        $scope.clearTextOutput();
+        $scope.flushStreamingOutput = false;
+      }
       $scope.appendTextOutput(data.data);
     }
   });
 
   $scope.$on('updateParagraphOutput', function(event, data) {
     if ($scope.paragraph.id === data.paragraphId) {
-      $scope.clearTextOutput(data.data);
+      $scope.clearTextOutput();
       $scope.appendTextOutput(data.data);
     }
   });

Reply via email to