You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by jo...@apache.org on 2017/01/05 06:31:58 UTC

zeppelin git commit: [ZEPPELIN-1905] fix: "Clear All Paragraphs" doens't work in a note

Repository: zeppelin
Updated Branches:
  refs/heads/master 18fd5481a -> 62a5983a1


[ZEPPELIN-1905] fix: "Clear All Paragraphs" doens't work in a note

### What is this PR for?

Fixed **Clear all paragraphs** button in a note (I attached a screenshot)

### Details

- `NotebookServer.java` sends the `NOTE` websocket message
- But `notebook.controller.js` doens't apply the result properly since it has invalid impl

```javascript
  $scope.$on('setNoteContent', function(event, note) {
      ....

      if ($scope.note === null) { // only set if the note is empty? what if already created?
        $scope.note = note;
      } else {
        $scope.note.config.personalizedMode = note.config.personalizedMode;
      }
```

- The reason I fixed `if (!$scope.editor || !$scope.editor.isFocused())` (in `paragraph.controll.js`) is because i am getting this type error whenever i click `Run all paragraphs` button after commit 7f95b9b (in this PR)

```javascript
angular.js:13236 TypeError: Cannot read property 'isFocused' of null
    at ChildScope.ParagraphCtrl.$scope.scrollToCursor (paragraph.controller.js:718)
    at paragraph.controller.js:708
    at Scope.$broadcast (angular.js:17143)
    at paragraph.controller.js:1052
```

### What type of PR is it?
[Bug Fix]

### Todos

Nothing

### What is the Jira issue?

[ZEPPELIN-1905](https://issues.apache.org/jira/browse/ZEPPELIN-1905)

### How should this be tested?

1. Open a note
2. Run some paragraphs.
3. Click the **Run all paragraphs** button.

### Screenshots (if appropriate)

![clear-all-output-bug](https://cloud.githubusercontent.com/assets/4968473/21660976/391d5010-d315-11e6-9ad0-c4feff32eee6.gif)

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

Author: 1ambda <1a...@gmail.com>

Closes #1843 from 1ambda/ZEPPELIN-1905/fix-clear-all-paras and squashes the following commits:

688194c [1ambda] fix: Calling isFocused of null (TypeError)
ed36575 [1ambda] fix: Set note content


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

Branch: refs/heads/master
Commit: 62a5983a18cc8c3cd8ef2226cfe5c6f274d32a0e
Parents: 18fd548
Author: 1ambda <1a...@gmail.com>
Authored: Thu Jan 5 07:00:29 2017 +0900
Committer: Jongyoul Lee <jo...@apache.org>
Committed: Thu Jan 5 15:31:45 2017 +0900

----------------------------------------------------------------------
 zeppelin-web/src/app/notebook/notebook.controller.js           | 6 +-----
 .../src/app/notebook/paragraph/paragraph.controller.js         | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/62a5983a/zeppelin-web/src/app/notebook/notebook.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js b/zeppelin-web/src/app/notebook/notebook.controller.js
index a1c652b..791eff3 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -973,11 +973,7 @@
         $rootScope.$broadcast('setIframe', $scope.asIframe);
       }
 
-      if ($scope.note === null) {
-        $scope.note = note;
-      } else {
-        $scope.note.config.personalizedMode = note.config.personalizedMode;
-      }
+      $scope.note = note;
       initializeLookAndFeel();
       //open interpreter binding setting when there're none selected
       getInterpreterBindings();

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/62a5983a/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 529094d..aedfdf4 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -715,7 +715,7 @@
      * lastCursorMove : 1(down), 0, -1(up) last cursor move event
      **/
     $scope.scrollToCursor = function(paragraphId, lastCursorMove) {
-      if (!$scope.editor.isFocused()) {
+      if (!$scope.editor || !$scope.editor.isFocused()) {
         // only make sense when editor is focused
         return;
       }