You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2020/02/19 20:36:33 UTC
[zeppelin] branch master updated: [ZEPPELIN-4568] Fix can not
update output when the data is empty
This is an automated email from the ASF dual-hosted git repository.
moon 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 b0e220e [ZEPPELIN-4568] Fix can not update output when the data is empty
b0e220e is described below
commit b0e220e6dbbf1a54cbce98f290d593b49e97bc23
Author: Hsuan Lee <hs...@gmail.com>
AuthorDate: Mon Feb 10 17:01:24 2020 +0800
[ZEPPELIN-4568] Fix can not update output when the data is empty
### What is this PR for?
Fix can not update output when the data is empty
### What type of PR is it?
[Bug Fix]
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-4568
### How should this be tested?
Try the following code:
```pythone
import sys
import time
from IPython.display import display, clear_output
for i in range(10):
time.sleep(0.25)
clear_output(wait=True)
print(i)
sys.stdout.flush()
```
Should be updated instead of append the output
### 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 <hs...@gmail.com>
Closes #3635 from hsuanxyz/fix/clean-out and squashes the following commits:
df9c6f8ac [Hsuan Lee] fix: can not update output when the data is empty
---
zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js | 2 +-
.../src/app/notebook/paragraph/result/result.controller.js | 7 ++++++-
zeppelin-web/src/app/spell/spell-result.js | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index f0e5d7f..a303b0f 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -212,7 +212,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
$scope.paragraph.results.msg = [];
}
- let update = ($scope.paragraph.results.msg[data.index]) ? true : false;
+ let update = typeof $scope.paragraph.results.msg[data.index] !== 'undefined';
$scope.paragraph.results.msg[data.index] = {
data: data.data,
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 dc0fdbf..dc6b0bb 100644
--- a/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js
@@ -216,7 +216,12 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location
callback(elem);
}
- $timeout(retry);
+ if(isDOMLoaded(targetElemId)) {
+ const elem = angular.element(`#${targetElemId}`);
+ callback(elem);
+ } else {
+ $timeout(retry);
+ }
}
$scope.$on('updateResult', function(event, result, newConfig, paragraphRef, index) {
diff --git a/zeppelin-web/src/app/spell/spell-result.js b/zeppelin-web/src/app/spell/spell-result.js
index 52bcdc1..93d71ed 100644
--- a/zeppelin-web/src/app/spell/spell-result.js
+++ b/zeppelin-web/src/app/spell/spell-result.js
@@ -217,7 +217,7 @@ export class SpellResult {
}
static isObject(data) {
- return (data &&
+ return (typeof data !== 'undefined' &&
!SpellResult.isFunction(data) &&
!SpellResult.isPromise(data));
}