You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by bz...@apache.org on 2015/11/24 18:27:06 UTC

incubator-zeppelin git commit: ZEPPELIN-413: Fix ability to link a single paragraph

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 4b109c19c -> f162615fb


ZEPPELIN-413: Fix ability to link a single paragraph

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

Relevant changes in `setNoteContent ` handler

Test plan:
 - Link a paragraph from Zeppelin Tutorial i.e [/#/notebook/2A94M5J1Z/paragraph/20150210-015302_1492795503?asIframe](http://localhost:9000/#/notebook/2A94M5J1Z/paragraph/20150210-015302_1492795503?asIframe)

\cc minahlee corneadoug for a review

Author: Alexander Bezzubov <bz...@apache.org>

Closes #464 from bzz/bugfix/link-par-ZEPPELIN-413 and squashes the following commits:

f978f68 [Alexander Bezzubov] ZEPPELIN-413: restore ability to link single paragraph
9425a97 [Alexander Bezzubov] ZEPPELIN-413: fix tabs and formatting


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

Branch: refs/heads/master
Commit: f162615fba5243612c8db45013c6930116978a46
Parents: 4b109c1
Author: Alexander Bezzubov <bz...@apache.org>
Authored: Tue Nov 24 11:20:18 2015 +0900
Committer: Alexander Bezzubov <bz...@apache.org>
Committed: Wed Nov 25 02:26:44 2015 +0900

----------------------------------------------------------------------
 .../noteName-create/notename.controller.js      | 56 +++++++++++---------
 1 file changed, 30 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f162615f/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 a81ffba..430e60d 100644
--- a/zeppelin-web/src/components/noteName-create/notename.controller.js
+++ b/zeppelin-web/src/components/noteName-create/notename.controller.js
@@ -14,41 +14,45 @@
 
 'use strict';
 
-angular.module('zeppelinWebApp').controller('NotenameCtrl', function($scope, $rootScope, $routeParams, websocketMsgSrv) {
+angular.module('zeppelinWebApp').controller('NotenameCtrl', function($scope, $rootScope, $routeParams, websocketMsgSrv, $location) {
   var vm = this;
   vm.websocketMsgSrv = websocketMsgSrv;
   $scope.note = {};
-  vm.createNote = function(){
-  	  if(!vm.clone){
-		  vm.websocketMsgSrv.createNotebook($scope.note.notename);
-  	  }else{
-	  	 var noteId = $routeParams.noteId;
-  	  	 vm.websocketMsgSrv.cloneNotebook(noteId, $scope.note.notename);
-  	  }
+
+  vm.createNote = function() {
+      if (!vm.clone) {
+        vm.websocketMsgSrv.createNotebook($scope.note.notename);
+      } else {
+       var noteId = $routeParams.noteId;
+       vm.websocketMsgSrv.cloneNotebook(noteId, $scope.note.notename);
+      }
   };
 
   $scope.$on('setNoteContent', function(event, note) {
-    if(note !== undefined) {
-      window.location = '#/notebook/' + note.id;
-      console.log(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;
-		vm.clone = clone;
-		$scope.$apply();
+  vm.preVisible = function(clone) {
+    var generatedName = vm.generateName();
+    $scope.note.notename = 'Note ' + generatedName;
+    vm.clone = clone;
+    $scope.$apply();
   };
+
   vm.generateName = function () {
-		var DICTIONARY = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
-				'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P', 'Q', 'R',
-				'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ];
-		var randIndex, name = '';
-		for (var i = 0; i < 9; i++) {
-			randIndex = Math.floor(Math.random() * 32);
-			name += DICTIONARY[randIndex];
-		}
-		return name;
-	};
+    var DICTIONARY = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
+        'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P', 'Q', 'R',
+        'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ];
+    var randIndex, name = '';
+    for (var i = 0; i < 9; i++) {
+      randIndex = Math.floor(Math.random() * 32);
+      name += DICTIONARY[randIndex];
+    }
+    return name;
+  };
+
 });