From 9425a97567b8be9c3d5b8799f02d6c6574a8cb3a Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Tue, 24 Nov 2015 11:16:37 +0900 Subject: [PATCH 1/2] ZEPPELIN-413: fix tabs and formatting --- .../noteName-create/notename.controller.js | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/zeppelin-web/src/components/noteName-create/notename.controller.js b/zeppelin-web/src/components/noteName-create/notename.controller.js index a81ffbad6d3..321f39a55b5 100644 --- a/zeppelin-web/src/components/noteName-create/notename.controller.js +++ b/zeppelin-web/src/components/noteName-create/notename.controller.js @@ -18,37 +18,40 @@ angular.module('zeppelinWebApp').controller('NotenameCtrl', function($scope, $ro 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) { + if (note !== undefined) { window.location = '#/notebook/' + note.id; console.log(note); } }); - 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; + }; + }); From f978f68ac13daee683f7fe0aaff31c8d64432428 Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Tue, 24 Nov 2015 11:20:18 +0900 Subject: [PATCH 2/2] ZEPPELIN-413: restore ability to link single paragraph --- .../components/noteName-create/notename.controller.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zeppelin-web/src/components/noteName-create/notename.controller.js b/zeppelin-web/src/components/noteName-create/notename.controller.js index 321f39a55b5..430e60db38e 100644 --- a/zeppelin-web/src/components/noteName-create/notename.controller.js +++ b/zeppelin-web/src/components/noteName-create/notename.controller.js @@ -14,7 +14,7 @@ '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 = {}; @@ -29,9 +29,10 @@ angular.module('zeppelinWebApp').controller('NotenameCtrl', function($scope, $ro }; $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); } });