zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject incubator-zeppelin git commit: [ZEPPELIN-309] Redirect to created/cloned notebook page on notebook c…
Date Wed, 11 Nov 2015 13:03:10 GMT
Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master fa40d567f -> 6aaafe1b4


[ZEPPELIN-309] Redirect to created/cloned notebook page on notebook c…

…reation/clone

This PR enables redirecting to new/cloned notebook pages when create/clone notebook event
occurs.

Author: Mina Lee <minalee@nflabs.com>

Closes #309 from minahlee/ZEPPELIN-309 and squashes the following commits:

8611343 [Mina Lee] Update selenium test for opening new created notebook and fix indentation
b307483 [Mina Lee] [ZEPPELIN-309] Redirect to created/cloned notebook page on notebook creation/clone


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

Branch: refs/heads/master
Commit: 6aaafe1b46296e85d1210bf14fc239eb4cdb1d2f
Parents: fa40d56
Author: Mina Lee <minalee@nflabs.com>
Authored: Mon Nov 9 20:00:51 2015 +0900
Committer: Lee moon soo <moon@apache.org>
Committed: Wed Nov 11 22:03:06 2015 +0900

----------------------------------------------------------------------
 .../apache/zeppelin/socket/NotebookServer.java  |  2 +
 .../java/org/apache/zeppelin/ZeppelinIT.java    | 39 ++++++--------------
 .../noteName-create/notename.controller.js      |  8 ++++
 3 files changed, 21 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/6aaafe1b/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 644639f..a7a0f4d 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
@@ -397,6 +397,7 @@ public class NotebookServer extends WebSocketServlet implements
     }
 
     note.persist();
+    addConnectionToNote(note.id(), (NotebookSocket) conn);
     broadcastNote(note);
     broadcastNoteList();
   }
@@ -440,6 +441,7 @@ public class NotebookServer extends WebSocketServlet implements
     String noteId = getOpenNoteId(conn);
     String name = (String) fromMessage.get("name");
     Note newNote = notebook.cloneNote(noteId, name);
+    addConnectionToNote(newNote.id(), (NotebookSocket) conn);
     broadcastNote(newNote);
     broadcastNoteList();
   }

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/6aaafe1b/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java
index 215d3de..dc188f8 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/ZeppelinIT.java
@@ -165,17 +165,15 @@ public class ZeppelinIT {
     }
   }
 
-	@Test
+  @Test
   public void testAngularDisplay() throws InterruptedException{
     if (!endToEndTestEnabled()) {
       return;
     }
+    createNewNote();
 
-	  String noteName = createNewNoteAndGetName();
-	  driver.findElement(By.partialLinkText(noteName)).click();
-
-	  // wait for first paragraph's " READY " status text
-	  waitForParagraph(1, "READY");
+    // wait for first paragraph's " READY " status text
+    waitForParagraph(1, "READY");
 
     /*
      * print angular template
@@ -293,7 +291,7 @@ public class ZeppelinIT {
     System.out.println("testCreateNotebook Test executed");
   }
 
-  private String createNewNoteAndGetName() {
+  private void createNewNote() {
     List<WebElement> notebookLinks = driver.findElements(By
         .xpath("//div[contains(@class, \"col-md-4\")]/div/ul/li"));    
     List<String> notebookTitles = new LinkedList<String>();
@@ -301,32 +299,17 @@ public class ZeppelinIT {
       notebookTitles.add(el.getText());
     }
     
-	WebElement createNoteLink = driver.findElement(By.xpath("//div[contains(@class, \"col-md-4\")]/div/h5/a"));
-	createNoteLink.click();
+    WebElement createNoteLink = driver.findElement(By.xpath("//div[contains(@class, \"col-md-4\")]/div/h5/a"));
+    createNoteLink.click();
 
-	WebDriverWait block = new WebDriverWait(driver, 10);
-	WebElement modal = block.until(ExpectedConditions.visibilityOfElementLocated(By.id("noteNameModal")));
-	WebElement createNoteButton = modal.findElement(By.id("createNoteButton"));
-	createNoteButton.click();
+    WebDriverWait block = new WebDriverWait(driver, 10);
+    WebElement modal = block.until(ExpectedConditions.visibilityOfElementLocated(By.id("noteNameModal")));
+    WebElement createNoteButton = modal.findElement(By.id("createNoteButton"));
+    createNoteButton.click();
 
     try {
       Thread.sleep(500); // wait for notebook list updated
     } catch (InterruptedException e) {
     } 
-
-    List<WebElement> notebookLinksAfterCreate = driver.findElements(By
-        .xpath("//div[contains(@class, \"col-md-4\")]/div/ul/li"));
-
-    Iterator<WebElement> it = notebookLinksAfterCreate.iterator();
-    while (it.hasNext()) {
-      WebElement newEl = it.next();
-      if (notebookTitles.contains(newEl.getText())) {
-        
-        it.remove();
-      }
-    }
-
-    assertEquals(1, notebookLinksAfterCreate.size());
-    return notebookLinksAfterCreate.get(0).getText();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/6aaafe1b/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 342cad7..a81ffba 100644
--- a/zeppelin-web/src/components/noteName-create/notename.controller.js
+++ b/zeppelin-web/src/components/noteName-create/notename.controller.js
@@ -26,6 +26,14 @@ angular.module('zeppelinWebApp').controller('NotenameCtrl', function($scope,
$ro
   	  	 vm.websocketMsgSrv.cloneNotebook(noteId, $scope.note.notename);
   	  }
   };
+
+  $scope.$on('setNoteContent', function(event, note) {
+    if(note !== undefined) {
+      window.location = '#/notebook/' + note.id;
+      console.log(note);
+    }
+  });
+
   vm.preVisible = function(clone){
 		var generatedName = vm.generateName();
 		$scope.note.notename = 'Note ' + generatedName;


Mime
View raw message