You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pr...@apache.org on 2016/05/10 05:18:13 UTC

incubator-zeppelin git commit: [ZEPPELIN-834]Handle Note-name with spaces

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 57555f5ba -> b15964544


[ZEPPELIN-834]Handle Note-name with spaces

### What is this PR for?
Handle notename to have only white spaces.

### What type of PR is it?
[Bug Fix ]

### Todos

### What is the Jira issue?
[ZEPPELIN-834] (https://issues.apache.org/jira/browse/ZEPPELIN-834)

### How should this be tested?
Create note with name having only white spaces.
you should be able to see note id for those note.

### Screenshots (if appropriate)
Before:
![screen shot 2016-04-29 at 10 40 27 am](https://cloud.githubusercontent.com/assets/7026661/14908845/3129c82e-0dfa-11e6-8732-53623974e10f.png)
![screen shot 2016-04-29 at 10 37 56 am](https://cloud.githubusercontent.com/assets/7026661/14908849/3762f13e-0dfa-11e6-9b72-b0c0b032b06d.png)
![screen shot 2016-04-29 at 10 36 23 am](https://cloud.githubusercontent.com/assets/7026661/14908851/3cc8a5e2-0dfa-11e6-8bc9-051da61cf806.png)
 After:
![screen shot 2016-04-29 at 10 40 17 am](https://cloud.githubusercontent.com/assets/7026661/14908854/47e7f3ec-0dfa-11e6-8c02-7979dc04cabb.png)
![screen shot 2016-04-29 at 10 39 57 am](https://cloud.githubusercontent.com/assets/7026661/14908856/4a23675e-0dfa-11e6-9d5b-7dca6faf0998.png)
![screen shot 2016-04-29 at 10 38 16 am](https://cloud.githubusercontent.com/assets/7026661/14908858/4d06a8d2-0dfa-11e6-9b62-63bbe7bdf1e7.png)

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

Author: Ravi Ranjan <ra...@gmail.com>

Closes #866 from ravicodder/handleBlankNoteName and squashes the following commits:

3c88876 [Ravi Ranjan] Refactor the logic into common function
6625360 [Ravi Ranjan] Merge branch 'master' of https://github.com/apache/incubator-zeppelin into handleBlankNoteName
67f3cab [Ravi Ranjan] Handle blank note name


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

Branch: refs/heads/master
Commit: b15964544cc86c19007119bab2086c7f1e65cdc9
Parents: 57555f5
Author: Ravi Ranjan <ra...@gmail.com>
Authored: Wed May 4 11:32:15 2016 +0530
Committer: Prabhjyot Singh <pr...@gmail.com>
Committed: Tue May 10 10:48:06 2016 +0530

----------------------------------------------------------------------
 docs/manual/notebookashomepage.md                       |  2 +-
 zeppelin-web/src/app/home/home.controller.js            |  4 ++++
 zeppelin-web/src/app/home/home.html                     | 12 ++++++++----
 zeppelin-web/src/app/notebook/notebook-actionBar.html   |  4 ++--
 zeppelin-web/src/app/search/result-list.html            |  2 +-
 .../arrayOrderingSrv/arrayOrdering.service.js           | 12 +++++++++++-
 zeppelin-web/src/components/navbar/navbar.html          |  8 ++++++--
 7 files changed, 33 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b1596454/docs/manual/notebookashomepage.md
----------------------------------------------------------------------
diff --git a/docs/manual/notebookashomepage.md b/docs/manual/notebookashomepage.md
index 7b090ec..48f06a6 100644
--- a/docs/manual/notebookashomepage.md
+++ b/docs/manual/notebookashomepage.md
@@ -88,7 +88,7 @@ you need to do is use our %angular support.
           <i style="font-size: 15px;" class="icon-notebook"></i> Create new note</a></h5>
           <ul style="list-style-type: none;">
             <li ng-repeat="note in home.notes.list track by $index"><i style="font-size: 10px;" class="icon-doc"></i>
-              <a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{note.name || 'Note ' + note.id}}</a>
+              <a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{noteName(note)}}</a>
             </li>
           </ul>
       </div>

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b1596454/zeppelin-web/src/app/home/home.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/home/home.controller.js b/zeppelin-web/src/app/home/home.controller.js
index 63410ce..a87ac91 100644
--- a/zeppelin-web/src/app/home/home.controller.js
+++ b/zeppelin-web/src/app/home/home.controller.js
@@ -76,4 +76,8 @@ angular.module('zeppelinWebApp').controller('HomeCtrl', function($scope, noteboo
     node.hidden = !node.hidden;
   };
 
+  $rootScope.noteName = function(note) {
+    return arrayOrderingSrv.getNoteName(note);
+  };
+
 });

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b1596454/zeppelin-web/src/app/home/home.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/home/home.html b/zeppelin-web/src/app/home/home.html
index 7255f68..b6466cf 100644
--- a/zeppelin-web/src/app/home/home.html
+++ b/zeppelin-web/src/app/home/home.html
@@ -15,12 +15,12 @@ limitations under the License.
 <script type="text/ng-template" id="notebook_folder_renderer.html">
   <div ng-if="node.children == null">
     <a style="text-decoration: none;" href="#/notebook/{{node.id}}">
-      <i style="font-size: 10px;" class="icon-doc"/> {{node.name || 'Note ' + node.id}}
+      <i style="font-size: 10px;" class="icon-doc"/> {{noteName(node)}}
     </a>
   </div>
   <div ng-if="node.children != null">
     <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'" /> {{node.name}}
+      <i style="font-size: 10px;" ng-class="node.hidden ? 'icon-folder' : 'icon-folder-alt'" /> {{noteName(node)}}
     </a>
     <div ng-if="!node.hidden">
       <ul style="list-style-type: none; padding-left:15px;">
@@ -59,13 +59,17 @@ limitations under the License.
               <i style="font-size: 15px;" class="icon-notebook"></i> Create new note</a></h5>
             <ul id="notebook-names">
               <li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li>
+              <li ng-repeat="note in home.notes.list | filter:query | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index">
+                <i style="font-size: 10px;" class="icon-doc"></i>
+                <a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{noteName(note)}}</a>
+              </li>
               <div ng-if="!query || query.name === ''">
-                <li ng-repeat="node in home.notes.root.children" ng-include="'notebook_folder_renderer.html'" />
+                <li ng-repeat="node in home.notes.root.children | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index" ng-include="'notebook_folder_renderer.html'" />
               </div>
               <div ng-if="query && query.name !== ''">
                 <li ng-repeat="note in home.notes.flatList | filter:query | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index">
                   <i style="font-size: 10px;" class="icon-doc"></i>
-                  <a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{note.name || 'Note ' + note.id}}</a>
+                  <a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{noteName(note)}}</a>
                 </li>
               </div>
             </ul>

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b1596454/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 f371bd3..558c338 100644
--- a/zeppelin-web/src/app/notebook/notebook-actionBar.html
+++ b/zeppelin-web/src/app/notebook/notebook-actionBar.html
@@ -13,9 +13,9 @@ limitations under the License.
 -->
 <div class="noteAction" ng-show="note.id && !paragraphUrl">
   <h3>
-    <input type="text" pu-elastic-input class="form-control2" placeholder="{{note.name || 'Note ' + note.id}}" style="min-width: 200px; max-width: 600px;"
+    <input type="text" pu-elastic-input class="form-control2" placeholder="{{noteName(note)}}" style="min-width: 200px; max-width: 600px;"
            ng-show="showEditor" ng-model="note.name" ng-blur="sendNewName();showEditor = false;" ng-enter="sendNewName();showEditor = false;" ng-escape="note.name = oldName; showEditor = false" focus-if="showEditor" />
-    <p class="form-control-static2" ng-click="showEditor = true; oldName = note.name" ng-show="!showEditor">{{note.name || 'Note ' + note.id}}</p>
+    <p class="form-control-static2" ng-click="showEditor = true; oldName = note.name" ng-show="!showEditor">{{noteName(note)}}</p>
     <span class="labelBtn btn-group">
       <button type="button"
               class="btn btn-default btn-xs"

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b1596454/zeppelin-web/src/app/search/result-list.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/search/result-list.html b/zeppelin-web/src/app/search/result-list.html
index 2d2b6cf..87fce53 100644
--- a/zeppelin-web/src/app/search/result-list.html
+++ b/zeppelin-web/src/app/search/result-list.html
@@ -21,7 +21,7 @@ limitations under the License.
               <i style="font-size: 10px;" class="icon-doc"></i>
               <a class="search-results-header"
                  href="#/notebook/{{note.id}}">
-                  {{note.name || 'Note ' + note.id}}
+                  {{note.name.trim()==='' && 'Note ' + note.id.split('/',2)[0] || note.name}}
               </a>
             </h4>
           </div>

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b1596454/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js b/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js
index 13c4b20..da9da18 100644
--- a/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js
+++ b/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js
@@ -15,8 +15,18 @@
 
 angular.module('zeppelinWebApp').service('arrayOrderingSrv', function() {
 
+  var arrayOrderingSrv = this;
+
   this.notebookListOrdering = function(note) {
-    return (note.name ? note.name : 'Note ' + note.id);
+    return arrayOrderingSrv.getNoteName(note);
+  };
+
+  this.getNoteName = function(note) {
+    if(note.name === undefined || note.name.trim() === '') {
+      return'Note ' + note.id;
+    } else {
+      return note.name;
+    }
   };
 
 });

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b1596454/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 272167a..db74317 100644
--- a/zeppelin-web/src/components/navbar/navbar.html
+++ b/zeppelin-web/src/components/navbar/navbar.html
@@ -12,10 +12,10 @@ See the License for the specific language governing permissions and
 limitations under the License.
   -->
 <script type="text/ng-template" id="notebook_list_renderer.html">
-  <a ng-if="note.id" href="#/notebook/{{note.id}}">{{note.name || 'Note ' + note.id}} </a>
+  <a ng-if="note.id" href="#/notebook/{{note.id}}">{{noteName(note)}} </a>
   <li ng-if="!note.id"
       class="dropdown-submenu">
-    <a tabindex="-1" href="javascript: void(0)">{{note.name}}</a>
+    <a tabindex="-1" href="javascript: void(0)">{{noteName(note)}}</a>
     <ul class="dropdown-menu">
       <li ng-repeat="note in note.children track by $index" ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'notebook_list_renderer.html'">
       </li>
@@ -44,6 +44,10 @@ limitations under the License.
             <li><a href="" data-toggle="modal" data-target="#noteNameModal"><i class="fa fa-plus"></i> Create new note</a></li>
             <li class="divider"></li>
             <div id="notebook-list" class="scrollbar-container">
+              <li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li>
+              <li ng-repeat="note in navbar.notes.list | filter:query | orderBy:navbar.arrayOrderingSrv.notebookListOrdering track by $index"
+                  ng-class="{'active' : navbar.isActive(note.id)}">
+                <a href="#/notebook/{{note.id}}">{{noteName(note)}} </a>
               <li ng-repeat="note in navbar.notes.root.children track by $index" ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'notebook_list_renderer.html'">
               </li>
             </div>