Repository: zeppelin
Updated Branches:
  refs/heads/master f7ce7fad1 -> 74347c22f


Redirect home when requested a wrong notename path.

### What is this PR for?
This PR for redirecting to zeppelin home when requested wrong path.

### What type of PR is it?
Improvement

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1176

### How should this be tested?
put wrong path to your browser like screenshot.

### Screenshots (if appropriate)
- before
![b1](https://cloud.githubusercontent.com/assets/3348133/16835556/3b744224-49f4-11e6-84bf-6a22cc729a30.gif)

- after
![a](https://cloud.githubusercontent.com/assets/3348133/16835627/8cc590e2-49f4-11e6-878f-745ee026ef8e.gif)

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

Author: astroshim <[email protected]>

Closes #1185 from astroshim/feat/redirectHome and squashes the following 
commits:

d29519c [astroshim] remove #
eae453f [astroshim] fix path
c937b90 [astroshim] fix location.path
8db7017 [astroshim] redirect home when wrong path


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

Branch: refs/heads/master
Commit: 74347c22fa2ffcd618f2c57f1e8cd3cdb08f2190
Parents: f7ce7fa
Author: astroshim <[email protected]>
Authored: Fri Jul 15 17:57:01 2016 +0900
Committer: Damien CORNEAU <[email protected]>
Committed: Tue Jul 19 10:41:10 2016 +0900

----------------------------------------------------------------------
 .../main/java/org/apache/zeppelin/socket/NotebookServer.java    | 2 ++
 zeppelin-web/src/app/notebook/notebook.controller.js            | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/74347c22/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 4261a65..853c0d5 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
@@ -494,6 +494,8 @@ public class NotebookServer extends WebSocketServlet 
implements
       addConnectionToNote(note.id(), conn);
       conn.send(serializeMessage(new Message(OP.NOTE).put("note", note)));
       sendAllAngularObjects(note, conn);
+    } else {
+      conn.send(serializeMessage(new Message(OP.NOTE).put("note", null)));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/74347c22/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 eea8a10..fd9cb3e 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -80,7 +80,6 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', 
function($scope, $ro
     websocketMsgSrv.getNotebook($routeParams.noteId);
 
     var currentRoute = $route.current;
-
     if (currentRoute) {
       setTimeout(
         function() {
@@ -338,6 +337,10 @@ 
angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
 
   /** update the current note */
   $scope.$on('setNoteContent', function(event, note) {
+    if (note === undefined) {
+      $location.path('/');
+    }
+
     $scope.paragraphUrl = $routeParams.paragraphId;
     $scope.asIframe = $routeParams.asIframe;
     if ($scope.paragraphUrl) {

Reply via email to