This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new d38e745  [ZEPPELIN-4653] Fix unable to render the ansi color codes
d38e745 is described below

commit d38e74502a2c528728d7d7445e552a22e3ee6393
Author: Hsuan Lee <hsua...@gmail.com>
AuthorDate: Fri Feb 28 18:14:39 2020 +0800

    [ZEPPELIN-4653] Fix unable to render the ansi color codes
    
    ### What is this PR for?
    
    Fix unable to render the ansi color codes
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### What is the Jira issue?
    
    https://issues.apache.org/jira/browse/ZEPPELIN-4653
    
    ### How should this be tested?
    
    N/A
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Hsuan Lee <hsua...@gmail.com>
    
    Closes #3665 from hsuanxyz/fix/ansi-text and squashes the following commits:
    
    e6ef7c0d3 [Hsuan Lee] fix: unable to render the ansi color codes
---
 .../src/app/notebook/paragraph/result/result.controller.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js 
b/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js
index dc6b0bb..d5b1017 100644
--- a/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js
@@ -160,6 +160,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, 
$routeParams, $location
   // queue for append output
   const textResultQueueForAppend = [];
 
+  const retryRenderElements = {};
   // prevent body area scrollbar from blocking due to scroll in paragraph 
results
   $scope.mouseOver = false;
   $scope.onMouseOver = function() {
@@ -205,10 +206,19 @@ function ResultCtrl($scope, $rootScope, $route, $window, 
$routeParams, $location
     return elem.length;
   }
 
+  function cancelRetryRender(targetElemId) {
+    if (retryRenderElements[targetElemId]) {
+      $timeout.cancel(retryRenderElements[targetElemId]);
+      delete retryRenderElements[targetElemId];
+    }
+  }
+
   function retryUntilElemIsLoaded(targetElemId, callback) {
+    cancelRetryRender(targetElemId);
     function retry() {
+      cancelRetryRender(targetElemId);
       if (!isDOMLoaded(targetElemId)) {
-        $timeout(retry, 10);
+        retryRenderElements[targetElemId] = $timeout(retry, 10);
         return;
       }
 
@@ -220,7 +230,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, 
$routeParams, $location
       const elem = angular.element(`#${targetElemId}`);
       callback(elem);
     } else {
-      $timeout(retry);
+      retryRenderElements[targetElemId] = $timeout(retry);
     }
   }
 

Reply via email to