zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prabhjyotsi...@apache.org
Subject zeppelin git commit: [ZEPPELIN-3321] isRevisionSupported not working for importing notebooks.
Date Thu, 15 Mar 2018 03:16:54 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.8 c6485d621 -> 257db1d5a


[ZEPPELIN-3321] isRevisionSupported not working for importing notebooks.

 when importing note of from one zeppelin instance that don't support revision to another
zeppelin instance where revision is supported, the imported note still don't support revision.

[Bug Fix]

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

* Does the licenses files need update? N/A
* Is there breaking changes for older versions? N/A
* Does this needs documentation? N/A

Author: Prabhjyot Singh <prabhjyotsingh@gmail.com>

Closes #2862 from prabhjyotsingh/ZEPPELIN-3321 and squashes the following commits:

eca6b59 [Prabhjyot Singh] add unit test for isRevisionSupported
552fdeb [Prabhjyot Singh] approach 2: set as isRevisionSupported zeppelin global config
18873d3 [Prabhjyot Singh] ZEPPELIN-3321: fix isRevisionSupported

Change-Id: I49ec3350303b39a41b769bc47941c3397160234c
(cherry picked from commit 6001b98de620c13d57c88a0b4ae328bf19f338ea)
Signed-off-by: Prabhjyot Singh <prabhjyotsingh@gmail.com>


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

Branch: refs/heads/branch-0.8
Commit: 257db1d5a54c011c7e20b0ebd0ac5581d5c061dc
Parents: c6485d6
Author: Prabhjyot Singh <prabhjyotsingh@gmail.com>
Authored: Wed Mar 14 15:34:48 2018 +0530
Committer: Prabhjyot Singh <prabhjyotsingh@gmail.com>
Committed: Thu Mar 15 08:46:28 2018 +0530

----------------------------------------------------------------------
 .../apache/zeppelin/socket/NotebookServer.java  |  2 +-
 .../src/app/notebook/notebook-actionBar.html    |  2 +-
 .../src/components/navbar/navbar.controller.js  | 12 +++++++++
 .../java/org/apache/zeppelin/notebook/Note.java | 11 --------
 .../org/apache/zeppelin/notebook/Notebook.java  | 11 +++++++-
 .../apache/zeppelin/notebook/NotebookTest.java  | 27 ++++++++++++++++++++
 6 files changed, 51 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/257db1d5/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 0888874..4709d1d 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
@@ -1908,7 +1908,7 @@ public class NotebookServer extends WebSocketServlet
                     .getVarName());
           }
         });
-
+    configurations.put("isRevisionSupported", String.valueOf(notebook.isRevisionSupported()));
     conn.send(serializeMessage(
         new Message(OP.CONFIGURATIONS_INFO).put("configurations", configurations)));
   }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/257db1d5/zeppelin-web/src/app/notebook/notebook-actionBar.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/notebook-actionBar.html b/zeppelin-web/src/app/notebook/notebook-actionBar.html
index b4add93..7559a87 100644
--- a/zeppelin-web/src/app/notebook/notebook-actionBar.html
+++ b/zeppelin-web/src/app/notebook/notebook-actionBar.html
@@ -100,7 +100,7 @@ limitations under the License.
       </button>
     </span>
 
-    <span class="labelBtn btn-group" role="group" ng-if="note.config.isRevisionSupported">
+    <span class="labelBtn btn-group" role="group" ng-if="isRevisionSupported()" >
       <div class="btn-group" role="group">
         <button type="button"
                 class="btn btn-default btn-xs dropdown-toggle"

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/257db1d5/zeppelin-web/src/components/navbar/navbar.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js
index 9fb5db2..7665bf8 100644
--- a/zeppelin-web/src/components/navbar/navbar.controller.js
+++ b/zeppelin-web/src/components/navbar/navbar.controller.js
@@ -31,6 +31,7 @@ function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
   vm.TRASH_FOLDER_ID = TRASH_FOLDER_ID;
   vm.isFilterNote = isFilterNote;
   vm.numberOfNotesDisplayed = 10;
+  let revisionSupported = false;
 
   $scope.query = {q: ''};
 
@@ -245,4 +246,15 @@ function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
     }
     return 'top';
   };
+
+  $scope.$on('configurationsInfo', function(scope, event) {
+    // Server send this parameter is String
+    if(event.configurations['isRevisionSupported']==='true') {
+      revisionSupported = true;
+    }
+  });
+
+  $rootScope.isRevisionSupported = function() {
+    return revisionSupported;
+  };
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/257db1d5/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
index fc70c70..8889a55 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
@@ -301,17 +301,6 @@ public class Note implements ParagraphJobListener, JsonSerializable {
     this.repo = repo;
   }
 
-  void setRevisionSupported(NotebookRepo repo) {
-    if (repo instanceof NotebookRepoSync) {
-      getConfig()
-          .put("isRevisionSupported", ((NotebookRepoSync) repo).isRevisionSupportedInDefaultRepo());
-    } else if (repo instanceof NotebookRepoWithVersionControl) {
-      getConfig().put("isRevisionSupported", true);
-    } else {
-      getConfig().put("isRevisionSupported", false);
-    }
-  }
-
   public Boolean isCronSupported(ZeppelinConfiguration config) {
     if (config.isZeppelinNotebookCronEnable()) {
       config.getZeppelinNotebookCronFolders();

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/257db1d5/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java
index f4214e3..fe50402 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java
@@ -521,7 +521,6 @@ public class Notebook implements NoteEventListener {
 
     note.setJobListenerFactory(jobListenerFactory);
     note.setNotebookRepo(notebookRepo);
-    note.setRevisionSupported(notebookRepo);
     note.setCronSupported(getConf());
 
     Map<String, SnapshotAngularObject> angularObjectSnapshot = new HashMap<>();
@@ -1063,6 +1062,16 @@ public class Notebook implements NoteEventListener {
     }
   }
 
+  public Boolean isRevisionSupported() {
+    if (notebookRepo instanceof NotebookRepoSync) {
+      return ((NotebookRepoSync) notebookRepo).isRevisionSupportedInDefaultRepo();
+    } else if (notebookRepo instanceof NotebookRepoWithVersionControl) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+
   @Override
   public void onParagraphRemove(Paragraph p) {
     for (NotebookEventListener listener : notebookEventListeners) {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/257db1d5/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
index cfb2e16..7327bfc 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
@@ -31,6 +31,8 @@ import org.apache.zeppelin.interpreter.InterpreterOption;
 import org.apache.zeppelin.interpreter.InterpreterResult;
 import org.apache.zeppelin.interpreter.InterpreterResultMessage;
 import org.apache.zeppelin.interpreter.InterpreterSetting;
+import org.apache.zeppelin.notebook.repo.FileSystemNotebookRepo;
+import org.apache.zeppelin.notebook.repo.GitHubNotebookRepo;
 import org.apache.zeppelin.interpreter.remote.RemoteInterpreter;
 import org.apache.zeppelin.notebook.repo.NotebookRepo;
 import org.apache.zeppelin.notebook.repo.VFSNotebookRepo;
@@ -111,6 +113,31 @@ public class NotebookTest extends AbstractInterpreterTest implements
JobListener
   }
 
   @Test
+  public void testRevisionSupported() throws IOException, SchedulerException {
+    NotebookRepo notebookRepo;
+    Notebook notebook;
+
+    notebookRepo = new VFSNotebookRepo(conf);
+    notebook = new Notebook(conf, notebookRepo, schedulerFactory, interpreterFactory,
+        interpreterSettingManager, this, null,
+        notebookAuthorization, credentials);
+    assertFalse("Revision is not supported in VFSNotebookRepo", notebook.isRevisionSupported());
+
+    notebookRepo = new GitHubNotebookRepo(conf);
+    notebook = new Notebook(conf, notebookRepo, schedulerFactory, interpreterFactory,
+        interpreterSettingManager, this, null,
+        notebookAuthorization, credentials);
+    assertTrue("Revision is supported in GitHubNotebookRepo", notebook.isRevisionSupported());
+
+    notebookRepo = new FileSystemNotebookRepo(conf);
+    notebook = new Notebook(conf, notebookRepo, schedulerFactory, interpreterFactory,
+        interpreterSettingManager, this, null,
+        notebookAuthorization, credentials);
+    assertFalse("Revision is not supported in FileSystemNotebookRepo",
+        notebook.isRevisionSupported());
+  }
+
+  @Test
   public void testSelectingReplImplementation() throws IOException {
     Note note = notebook.createNote(anonymous);
     interpreterSettingManager.setInterpreterBinding(anonymous.getUser(), note.getId(), interpreterSettingManager.getInterpreterSettingIds());


Mime
View raw message