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 2017/01/04 16:02:37 UTC

zeppelin git commit: [ZEPPELIN-1887] fix: DON'T create new para when run all paragraphs

Repository: zeppelin
Updated Branches:
  refs/heads/master d9a11a936 -> 2b1c6ea3f


[ZEPPELIN-1887] fix: DON'T create new para when run all paragraphs

### What is this PR for?

Clicking `Run all paragraphs` adds new paragraph. This is not the intended behavior.

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

### Todos

Nothing

### What is the Jira issue?

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

### How should this be tested?

1. Click `Run all paragraph button` in a note
2. Check whether new paragraph is added or not.

### Screenshots (if appropriate)

![zeppelin-1887](https://cloud.githubusercontent.com/assets/4968473/21635002/56fb7ebc-d29e-11e6-9644-8f3f1c42da1a.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 #1836 from 1ambda/ZEPPELIN-1887/do-not-create-paragraph-when-run-all-parag and squashes the following commits:

58ae983 [1ambda] fix: DON'T create new para when run all paragraphs


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

Branch: refs/heads/master
Commit: 2b1c6ea3f13a998ef5cd405189e3198e811226c4
Parents: d9a11a9
Author: 1ambda <1a...@gmail.com>
Authored: Wed Jan 4 16:51:23 2017 +0900
Committer: Lee moon soo <mo...@apache.org>
Committed: Wed Jan 4 08:02:31 2017 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/zeppelin/socket/NotebookServer.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/2b1c6ea3/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 3e56b05..b3bd0a3 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
@@ -34,6 +34,7 @@ import java.util.regex.Pattern;
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.google.common.base.Strings;
 import com.google.common.collect.Sets;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.vfs2.FileSystemException;
@@ -1562,9 +1563,11 @@ public class NotebookServer extends WebSocketServlet
     Map<String, Object> config = (Map<String, Object>) fromMessage.get("config");
     p.setConfig(config);
 
-    // if it's the last paragraph, let's add a new one
+    // if it's the last paragraph and empty, let's add a new one
     boolean isTheLastParagraph = note.isLastParagraph(p.getId());
-    if (isTheLastParagraph) {
+    if (!(text.trim().equals(p.getMagic()) ||
+        Strings.isNullOrEmpty(text)) &&
+        isTheLastParagraph) {
       Paragraph newPara = note.addParagraph(subject);
       broadcastNewParagraph(note, newPara);
     }