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

incubator-zeppelin git commit: ZEPPELIN-542 ] Paragraph running, the page move is not possible.

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 78bf3776d -> 52901deee


ZEPPELIN-542 ] Paragraph running, the page move is not possible.

### What is this PR for?
Paragraph running, the page move is not possible.
If this Paragraph is running, you can not move to another page, such as the Interpreter Page.
Please check the Animated GIF.

The cause was due to 'NEW_NOTE' event and the 'CLONE NOTE' event to use enclosed in setNoteContent.
Therefore, I solved the problem by separating them.
### What type of PR is it?
Bug Fix

### Todos
- [x]  NEW_NOTE / CLONE_NOTE generated events on front-web
- [x]  NEW / CLONE NOTE Event Response separation backend-server.

### Is there a relevant Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-542
### How should this be tested?
Step 1. Write more than each x10 Paragraph as follows
``` scala
Thread.sleep(2000);
```
Step 2. Run All Paragraph (or Run Notebook)

Step 3. Go to another page, except for the Notebook.

### Screenshots (if appropriate)
#### before (bug)
![bug_fix_before](https://cloud.githubusercontent.com/assets/10525473/12030339/1fd4a650-adb2-11e5-949b-f2dbf63fb055.gif)

#### after (fixed)
![bug_fix_after](https://cloud.githubusercontent.com/assets/10525473/12030342/24093ccc-adb2-11e5-816d-e1ff8be5ca1b.gif)

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

Author: CloverHearts <es...@gmail.com>

Closes #580 from cloverhearts/bug_fix/RefreshParagraph and squashes the following commits:

8ffd3a3 [CloverHearts] Event integration and redirect changes.
f589e7b [CloverHearts] bug-fixed-force-redirect


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

Branch: refs/heads/master
Commit: 52901deeefbcefeaae787d7c7706ca4b47d0f4e8
Parents: 78bf377
Author: CloverHearts <es...@gmail.com>
Authored: Tue Dec 29 23:09:50 2015 -0800
Committer: Damien CORNEAU <co...@gmail.com>
Committed: Wed Jan 6 13:43:55 2016 +0900

----------------------------------------------------------------------
 .../main/java/org/apache/zeppelin/socket/NotebookServer.java | 7 ++++---
 .../src/components/noteName-create/notename.controller.js    | 8 --------
 .../components/websocketEvents/websocketEvents.factory.js    | 4 +++-
 3 files changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/52901dee/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
index a2fa16e..8dfb295 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
@@ -416,7 +416,8 @@ public class NotebookServer extends WebSocketServlet implements
 
     return cronUpdated;
   }
-  private void createNote(WebSocket conn, Notebook notebook, Message message) throws IOException {
+  private void createNote(NotebookSocket conn, Notebook notebook, Message message)
+      throws IOException {
     Note note = notebook.createNote();
     note.addParagraph(); // it's an empty note. so add one paragraph
     if (message != null) {
@@ -429,7 +430,7 @@ public class NotebookServer extends WebSocketServlet implements
 
     note.persist();
     addConnectionToNote(note.id(), (NotebookSocket) conn);
-    broadcastNote(note);
+    conn.send(serializeMessage(new Message(OP.NEW_NOTE).put("note", note)));
     broadcastNoteList();
   }
 
@@ -473,7 +474,7 @@ public class NotebookServer extends WebSocketServlet implements
     String name = (String) fromMessage.get("name");
     Note newNote = notebook.cloneNote(noteId, name);
     addConnectionToNote(newNote.id(), (NotebookSocket) conn);
-    broadcastNote(newNote);
+    conn.send(serializeMessage(new Message(OP.NEW_NOTE).put("note", newNote)));
     broadcastNoteList();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/52901dee/zeppelin-web/src/components/noteName-create/notename.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/noteName-create/notename.controller.js b/zeppelin-web/src/components/noteName-create/notename.controller.js
index 4529844..4982e12 100644
--- a/zeppelin-web/src/components/noteName-create/notename.controller.js
+++ b/zeppelin-web/src/components/noteName-create/notename.controller.js
@@ -34,14 +34,6 @@ angular.module('zeppelinWebApp').controller('NotenameCtrl', function($scope, $ro
     vm.createNote();
   };
 
-  $scope.$on('setNoteContent', function(event, note) {
-    //a hack, to make it run only after notebook creation
-    //it should not run i.e in case of linking to the paragraph
-    if (note && $location.path().indexOf(note.id) < 0) {
-      $location.path('notebook/' + note.id);
-    }
-  });
-
   vm.preVisible = function(clone) {
     var generatedName = vm.generateName();
     $scope.note.notename = 'Note ' + generatedName;

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/52901dee/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js
index dad2cb5..7bd8a63 100644
--- a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js
+++ b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js
@@ -13,7 +13,7 @@
  */
 'use strict';
 
-angular.module('zeppelinWebApp').factory('websocketEvents', function($rootScope, $websocket, baseUrlSrv) {
+angular.module('zeppelinWebApp').factory('websocketEvents', function($rootScope, $websocket, $location, baseUrlSrv) {
   var websocketCalls = {};
 
   websocketCalls.ws = $websocket(baseUrlSrv.getWebsocketUrl());
@@ -46,6 +46,8 @@ angular.module('zeppelinWebApp').factory('websocketEvents', function($rootScope,
     var data = payload.data;
     if (op === 'NOTE') {
       $rootScope.$broadcast('setNoteContent', data.note);
+    } else if (op === 'NEW_NOTE') {
+      $location.path('notebook/' + data.note.id);
     } else if (op === 'NOTES_INFO') {
       $rootScope.$broadcast('setNoteMenu', data.notes);
     } else if (op === 'PARAGRAPH') {