Skip to content

Commit 07b3e1a

Browse files
committed
Handle clear output correctly
1 parent bc6262e commit 07b3e1a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,15 @@ angular.module('zeppelinWebApp')
9797

9898
$scope.renderText = function() {
9999
var retryRenderer = function() {
100-
if (!$scope.paragraph.result || !$scope.paragraph.result.msg) {
101-
// nothing to render
102-
return;
103-
}
104100

105101
var textEl = angular.element('#p' + $scope.paragraph.id + '_text');
106102
if (textEl.length) {
107-
// clear all lines before append
103+
// clear all lines before render
108104
$scope.clearTextOutput();
109-
$scope.appendTextOutput($scope.paragraph.result.msg);
105+
106+
if ($scope.paragraph.result && $scope.paragraph.result.msg) {
107+
$scope.appendTextOutput($scope.paragraph.result.msg);
108+
}
110109
} else {
111110
$timeout(retryRenderer, 10);
112111
}
@@ -205,6 +204,7 @@ angular.module('zeppelinWebApp')
205204
data.paragraph.status !== $scope.paragraph.status ||
206205
data.paragraph.jobName !== $scope.paragraph.jobName ||
207206
data.paragraph.title !== $scope.paragraph.title ||
207+
!data.paragraph.result !== !$scope.paragraph.result ||
208208
data.paragraph.errorMessage !== $scope.paragraph.errorMessage ||
209209
!angular.equals(data.paragraph.settings, $scope.paragraph.settings) ||
210210
!angular.equals(data.paragraph.config, $scope.paragraph.config))
@@ -214,7 +214,7 @@ angular.module('zeppelinWebApp')
214214
var newType = $scope.getResultType(data.paragraph);
215215
var oldGraphMode = $scope.getGraphMode();
216216
var newGraphMode = $scope.getGraphMode(data.paragraph);
217-
var resultRefreshed = (data.paragraph.dateFinished !== $scope.paragraph.dateFinished);
217+
var resultRefreshed = (data.paragraph.dateFinished !== $scope.paragraph.dateFinished) || !data.paragraph.result !== !$scope.paragraph.result;
218218

219219
var statusChanged = (data.paragraph.status !== $scope.paragraph.status);
220220

@@ -276,8 +276,6 @@ angular.module('zeppelinWebApp')
276276
$scope.renderAngular();
277277
} else if (newType === 'TEXT' && resultRefreshed) {
278278
$scope.renderText();
279-
} else if (newType === 'TEXT' && !$scope.paragraph.result) {
280-
$scope.clearTextOutput();
281279
}
282280

283281
if (statusChanged || resultRefreshed) {

0 commit comments

Comments
 (0)