You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/04/14 23:52:01 UTC

zeppelin git commit: [ZEPPELIN-2365] button to create note into folder

Repository: zeppelin
Updated Branches:
  refs/heads/master 45cc8a9e8 -> e5922b6bb


[ZEPPELIN-2365] button to create note into folder

### What is this PR for?
Added button to create new note into folder (home page)

### What type of PR is it?
Feature

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

### Screenshots (if appropriate)
![2365](https://cloud.githubusercontent.com/assets/25951039/24740236/86b31468-1ab9-11e7-8906-3f55ab2a7158.gif)

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

Author: Tinkoff DWH <ti...@gmail.com>

Closes #2228 from tinkoff-dwh/ZEPPELIN-2365 and squashes the following commits:

e870ad4 [Tinkoff DWH] Merge remote-tracking branch 'upstream/master' into ZEPPELIN-2365
0fe290e [Tinkoff DWH] [ZEPPELIN-2365] button to create note into folder


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

Branch: refs/heads/master
Commit: e5922b6bbaecacdfdcd279c4ff1f181c482210ca
Parents: 45cc8a9
Author: Tinkoff DWH <ti...@gmail.com>
Authored: Wed Apr 12 09:06:07 2017 +0500
Committer: Lee moon soo <mo...@apache.org>
Committed: Sat Apr 15 08:51:56 2017 +0900

----------------------------------------------------------------------
 zeppelin-web/src/app/home/notebook-template.html        | 12 ++++++++++--
 .../components/noteName-create/notename.controller.js   |  8 ++++----
 .../src/components/noteName-create/visible.directive.js |  3 ++-
 3 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e5922b6b/zeppelin-web/src/app/home/notebook-template.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/home/notebook-template.html b/zeppelin-web/src/app/home/notebook-template.html
index d8daaba..98708f9 100644
--- a/zeppelin-web/src/app/home/notebook-template.html
+++ b/zeppelin-web/src/app/home/notebook-template.html
@@ -59,8 +59,16 @@ limitations under the License.
         <i style="font-size: 10px;" ng-class="node.hidden ? 'icon-folder' : 'icon-folder-alt'"></i> {{getNoteName(node)}}
       </a>
       <a ng-if="!node.isTrash" style="text-decoration: none;">
-        <i style="margin-left: 10px;"
-           class="fa fa-pencil notebook-list-btn" ng-show="showFolderButton" ng-click="renameFolder(node)"
+        <a href="" data-toggle="modal" data-target="#noteNameModal" style="text-decoration: none;"
+           ng-controller="NotenameCtrl as notenamectrl" ng-click="notenamectrl.getInterpreterSettings()" data-path="{{node.id}}">
+          <i style="margin-left: 10px;"
+             class="fa fa-plus notebook-list-btn" ng-show="showFolderButton"
+             tooltip-placement="bottom" uib-tooltip="Create new note">
+          </i>
+        </a>
+      </a>
+      <a ng-if="!node.isTrash" style="text-decoration: none;">
+        <i class="fa fa-pencil notebook-list-btn" ng-show="showFolderButton" ng-click="renameFolder(node)"
            tooltip-placement="bottom" uib-tooltip="Rename folder">
         </i>
       </a>

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e5922b6b/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 43269a6..865d653 100644
--- a/zeppelin-web/src/components/noteName-create/notename.controller.js
+++ b/zeppelin-web/src/components/noteName-create/notename.controller.js
@@ -44,14 +44,14 @@ function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv
     vm.createNote();
   };
 
-  vm.preVisible = function(clone, sourceNoteName) {
+  vm.preVisible = function(clone, sourceNoteName, path) {
     vm.clone = clone;
     vm.sourceNoteName = sourceNoteName;
-    $scope.note.notename = vm.clone ? vm.cloneNoteName() : vm.newNoteName();
+    $scope.note.notename = vm.clone ? vm.cloneNoteName() : vm.newNoteName(path);
     $scope.$apply();
   };
 
-  vm.newNoteName = function() {
+  vm.newNoteName = function(path) {
     var newCount = 1;
     angular.forEach(vm.notes.flatList, function(noteName) {
       noteName = noteName.name;
@@ -62,7 +62,7 @@ function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv
         }
       }
     });
-    return 'Untitled Note ' + newCount;
+    return (path ? path + '/' : '') +'Untitled Note ' + newCount;
   };
 
   vm.cloneNoteName = function() {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e5922b6b/zeppelin-web/src/components/noteName-create/visible.directive.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/noteName-create/visible.directive.js b/zeppelin-web/src/components/noteName-create/visible.directive.js
index 403fd60..6dd19da 100644
--- a/zeppelin-web/src/components/noteName-create/visible.directive.js
+++ b/zeppelin-web/src/components/noteName-create/visible.directive.js
@@ -30,8 +30,9 @@ function modalvisible() {
         var relatedTarget = angular.element(e.relatedTarget);
         var clone = relatedTarget.data('clone');
         var sourceNoteName = relatedTarget.data('source-note-name');
+        var path = relatedTarget.data('path');
         var cloneNote = clone ? true : false;
-        previsibleMethod()(cloneNote, sourceNoteName);
+        previsibleMethod()(cloneNote, sourceNoteName, path);
       });
       element.on('shown.bs.modal', function(e) {
         if (scope.targetinput) {