zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject zeppelin git commit: [ZEPPELIN-2442] button to create note into folder (navbar)
Date Fri, 28 Apr 2017 09:58:28 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/master 5c3291c71 -> a593a8b35


[ZEPPELIN-2442] button to create note into folder (navbar)

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

### What type of PR is it?
Feature

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

### Screenshots (if appropriate)
![peek 2017-04-21 15-48](https://cloud.githubusercontent.com/assets/25951039/25274624/5c4707be-26aa-11e7-8aa5-2c895fc1efb8.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 <tinkoff.dwh@gmail.com>

Closes #2275 from tinkoff-dwh/ZEPPELIN-2442 and squashes the following commits:

715520b [Tinkoff DWH] ZEPPELIN-2442 added tooltip
2ae5bdc [Tinkoff DWH] Merge remote-tracking branch 'origin/master' into ZEPPELIN-2442
39846f4 [Tinkoff DWH] [ZEPPELIN-2442] button to create note into folder (navbar)


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

Branch: refs/heads/master
Commit: a593a8b3506efcb60063e1fcee189fcef9e61d6f
Parents: 5c3291c
Author: Tinkoff DWH <tinkoff.dwh@gmail.com>
Authored: Tue Apr 25 16:41:01 2017 +0500
Committer: Lee moon soo <moon@apache.org>
Committed: Fri Apr 28 02:58:25 2017 -0700

----------------------------------------------------------------------
 zeppelin-web/src/app/home/home.css              |  3 ++-
 .../src/app/home/notebook-template.html         | 14 +++++-----
 .../expandCollapse/expandCollapse.directive.js  |  9 +++++++
 .../components/navbar/navbar-noteList-elem.html | 27 ++++++++++++--------
 .../src/components/navbar/navbar.controller.js  | 12 +++++++++
 zeppelin-web/src/components/navbar/navbar.html  |  8 +++---
 6 files changed, 50 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a593a8b3/zeppelin-web/src/app/home/home.css
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/home/home.css b/zeppelin-web/src/app/home/home.css
index c670f6b..ce30e66 100644
--- a/zeppelin-web/src/app/home/home.css
+++ b/zeppelin-web/src/app/home/home.css
@@ -133,6 +133,7 @@ a.navbar-brand:hover {
 .dropdown-menu > .scrollbar-container > li > a,
 .dropdown-menu .notebook-list-item {
   display: block;
+  text-decoration: none;
   padding: 1px 10px;
   clear: both;
   font-weight: normal;
@@ -294,7 +295,7 @@ a.navbar-brand:hover {
 #notebook-list {
   position: relative;
   overflow: hidden;
-  display: inline;
+  display: inline-block;
 }
 
 @media (min-width: 768px) {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a593a8b3/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 cf665bb..0456a39 100644
--- a/zeppelin-web/src/app/home/notebook-template.html
+++ b/zeppelin-web/src/app/home/notebook-template.html
@@ -58,14 +58,12 @@ limitations under the License.
       <a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)">
         <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;">
-        <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 ng-if="!node.isTrash" 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 ng-if="!node.isTrash" style="text-decoration: none;">
         <i class="fa fa-pencil notebook-list-btn" ng-show="showFolderButton" ng-click="renameFolder(node)"

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a593a8b3/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js b/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js
index 9e28098..5d51818 100644
--- a/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js
+++ b/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js
@@ -30,6 +30,15 @@ function expandCollapse () {
             }
           })
         }
+
+        let target = event.target
+
+        // add note
+        if (target.classList !== undefined && target.classList.contains('fa-plus')
&&
+          target.tagName.toLowerCase() === 'i') {
+          return
+        }
+
         event.stopPropagation()
       })
     }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a593a8b3/zeppelin-web/src/components/navbar/navbar-noteList-elem.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/navbar/navbar-noteList-elem.html b/zeppelin-web/src/components/navbar/navbar-noteList-elem.html
index b63efd8..d5fb4a1 100644
--- a/zeppelin-web/src/components/navbar/navbar-noteList-elem.html
+++ b/zeppelin-web/src/components/navbar/navbar-noteList-elem.html
@@ -12,20 +12,27 @@ See the License for the specific language governing permissions and
 limitations under the License.
 -->
 
-<a class="notebook-list-item" ng-if="navbar.isFilterNote(note) && !note.children"
href="#/notebook/{{note.id}}">
-  <i style="font-size: 10px; margin-right: 5px;" ng-class="query.q && note.isTrash
? 'fa fa-trash-o' : 'icon-doc'" ></i>
-  <span>{{noteName(note)}}</span>
+<a class="notebook-list-item" ng-if="navbar.isFilterNote(node) && !node.children"
href="#/notebook/{{node.id}}">
+  <i style="font-size: 10px; margin-right: 5px;" ng-class="query.q && node.isTrash
? 'fa fa-trash-o' : 'icon-doc'" ></i>
+  <span>{{noteName(node)}}</span>
 </a>
 
-<li ng-if="note.children" ng-click="$event.stopPropagation()">
+<li ng-if="node.children">
   <expand-collapse>
-      <div>
+      <div ng-mouseenter="showFolderButton=true" ng-mouseleave="showFolderButton=false">
         <a class="notebook-list-item" href="javascript:void(0)">
-          <div ng-if="note.id !== navbar.TRASH_FOLDER_ID">
+          <div ng-if="node.id !== navbar.TRASH_FOLDER_ID">
             <i style="font-size: 10px; margin-right: 5px;"  class="icon-folder"></i>
-            <span>{{noteName(note)}}</span>
+            <span>{{noteName(node)}}</span>
+            <i data-toggle="modal" data-target="#noteNameModal" ng-controller="NotenameCtrl
as notenamectrl"
+              ng-click="notenamectrl.getInterpreterSettings()" data-path="{{node.id}}"
+              style="font-size: 12px; margin-left: 5px; margin-right: 5px;"
+              ng-show="showFolderButton" class="fa fa-plus"
+              uib-tooltip="Create new note"
+              tooltip-placement="{{calculateTooltipPlacement(node)}}">
+            </i>
           </div>
-          <div ng-if="note.id === navbar.TRASH_FOLDER_ID">
+          <div ng-if="node.id === navbar.TRASH_FOLDER_ID">
             <i style="font-size: 12px; margin-right: 5px;" class="fa fa-trash-o"></i>
             <span>Trash</span>
           </div>
@@ -33,8 +40,8 @@ limitations under the License.
       </div>
       <div class="expandable" style="color: black;">
         <ul>
-          <li ng-repeat="note in note.children | orderBy:node:false:navbar.arrayOrderingSrv.noteComparator
track by $index"
-              ng-class="{'active' : navbar.isActive(note.id)}"
+          <li ng-repeat="node in node.children | orderBy:node:false:navbar.arrayOrderingSrv.noteComparator
track by $index"
+              ng-class="{'active' : navbar.isActive(node.id)}"
               ng-include="'components/navbar/navbar-noteList-elem.html'">
           </li>
         </ul>

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a593a8b3/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 a2ca20a..8bf3d19 100644
--- a/zeppelin-web/src/components/navbar/navbar.controller.js
+++ b/zeppelin-web/src/components/navbar/navbar.controller.js
@@ -150,4 +150,16 @@ function NavCtrl ($scope, $rootScope, $http, $routeParams, $location,
       })
     })
   }
+
+  $scope.calculateTooltipPlacement = function (note) {
+    if (note !== undefined && note.name !== undefined) {
+      let length = note.name.length
+      if (length < 2) {
+        return 'top-left'
+      } else if (length > 7) {
+        return 'top-right'
+      }
+    }
+    return 'top'
+  }
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a593a8b3/zeppelin-web/src/components/navbar/navbar.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/navbar/navbar.html b/zeppelin-web/src/components/navbar/navbar.html
index dec48a6..7d33c02 100644
--- a/zeppelin-web/src/components/navbar/navbar.html
+++ b/zeppelin-web/src/components/navbar/navbar.html
@@ -35,13 +35,13 @@ limitations under the License.
             <div id="notebook-list" class="scrollbar-container" ng-if="isDrawNavbarNoteList">
               <li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li>
               <div ng-if="!query.q || query.q === ''">
-              <li ng-repeat="note in navbar.notes.root.children | orderBy:node:false:navbar.arrayOrderingSrv.noteComparator
track by note.id"
-                  ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'components/navbar/navbar-noteList-elem.html'">
+              <li ng-repeat="node in navbar.notes.root.children | orderBy:node:false:navbar.arrayOrderingSrv.noteComparator
track by node.id"
+                  ng-class="{'active' : navbar.isActive(node.id)}" ng-include="'components/navbar/navbar-noteList-elem.html'">
               </li>
             </div>
             <div ng-if="query.q">
-              <li ng-repeat="note in navbar.notes.flatList | filter : query.q | orderBy:navbar.arrayOrderingSrv.noteFlatListOrdering
track by note.id"
-                  ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'components/navbar/navbar-noteList-elem.html'">
+              <li ng-repeat="node in navbar.notes.flatList | filter : query.q | orderBy:navbar.arrayOrderingSrv.noteFlatListOrdering
track by node.id"
+                  ng-class="{'active' : navbar.isActive(node.id)}" ng-include="'components/navbar/navbar-noteList-elem.html'">
               </li>
             </div>
             </div>


Mime
View raw message