diff --git a/zeppelin-web/src/components/filterNoteNames/filter-note-names.html b/zeppelin-web/src/components/filterNoteNames/filter-note-names.html index a354cda70b8..f8fd22f2e52 100644 --- a/zeppelin-web/src/components/filterNoteNames/filter-note-names.html +++ b/zeppelin-web/src/components/filterNoteNames/filter-note-names.html @@ -11,4 +11,4 @@ See the License for the specific language governing permissions and limitations under the License. --> - + diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js index 50c769f1c3c..fb5957addba 100644 --- a/zeppelin-web/src/components/navbar/navbar.controller.js +++ b/zeppelin-web/src/components/navbar/navbar.controller.js @@ -14,7 +14,45 @@ 'use strict'; -angular.module('zeppelinWebApp').controller('NavCtrl', function($scope, $rootScope, $http, $routeParams, +angular.module('zeppelinWebApp') +.filter('notebookFilter', function() { + return function (notebooks, searchText) + { + if (!searchText) { + return notebooks; + } + + var filteringNote = function(notebooks, filteredNotes) { + _.each(notebooks, function(notebook) { + + if (notebook.name.toLowerCase().indexOf(searchText) !== -1) { + filteredNotes.push(notebook); + return notebook; + } + + if (notebook.children) { + filteringNote(notebook.children, filteredNotes); + } + }); + }; + + return _.filter(notebooks, function(notebook) { + if (notebook.children) { + var filteredNotes = []; + filteringNote(notebook.children, filteredNotes); + + if (filteredNotes.length > 0) { + return filteredNotes; + } + } + + if (notebook.name.toLowerCase().indexOf(searchText) !== -1) { + return notebook; + } + }); + }; +}) +.controller('NavCtrl', function($scope, $rootScope, $http, $routeParams, $location, notebookListDataFactory, baseUrlSrv, websocketMsgSrv, arrayOrderingSrv) { /** Current list of notes (ids) */ diff --git a/zeppelin-web/src/components/navbar/navbar.html b/zeppelin-web/src/components/navbar/navbar.html index 148d67d3311..c6f5e36f8e6 100644 --- a/zeppelin-web/src/components/navbar/navbar.html +++ b/zeppelin-web/src/components/navbar/navbar.html @@ -44,8 +44,7 @@