diff --git a/zeppelin-web/src/app/search/result-list.controller.js b/zeppelin-web/src/app/search/result-list.controller.js index bba88f086b9..2edf9f55fc1 100644 --- a/zeppelin-web/src/app/search/result-list.controller.js +++ b/zeppelin-web/src/app/search/result-list.controller.js @@ -18,6 +18,8 @@ angular .module('zeppelinWebApp') .controller('SearchResultCtrl', function($scope, $routeParams, searchService) { + $scope.isResult = true ; + $scope.searchTerm = $routeParams.searchTerm; var results = searchService.search({'q': $routeParams.searchTerm}).query(); results.$promise.then(function(result) { @@ -34,6 +36,17 @@ angular return note; }); + if ($scope.notes.length === 0) { + $scope.isResult = false; + } else { + $scope.isResult = true; + } + + $scope.$on('$routeChangeStart', function (event, next, current) { + if (next.originalPath !== '/search/:searchTerm') { + searchService.searchTerm = ''; + } + }); }); $scope.page = 0; diff --git a/zeppelin-web/src/app/search/result-list.html b/zeppelin-web/src/app/search/result-list.html index 87fce5340b9..67b0d7c6f71 100644 --- a/zeppelin-web/src/app/search/result-list.html +++ b/zeppelin-web/src/app/search/result-list.html @@ -11,8 +11,8 @@ See the License for the specific language governing permissions and limitations under the License. --> -
-
+
+
  • @@ -37,6 +37,10 @@

+
+
+ We couldn’t find any notebook matching '{{searchTerm}}' +
diff --git a/zeppelin-web/src/app/search/search.css b/zeppelin-web/src/app/search/search.css index b06b4a94a0c..90a7a3f41d6 100644 --- a/zeppelin-web/src/app/search/search.css +++ b/zeppelin-web/src/app/search/search.css @@ -40,3 +40,12 @@ .search-results .ace_invalid { background: none !important; } + +.search-no-result-found { + border: 1px solid; + margin: 150px 150px; + padding: 15px 10px 15px 0px; + color: #00529B; + text-align: center; + background-color: #f4f6f8; +} diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js index e0c242c518b..e2f40c86b68 100644 --- a/zeppelin-web/src/components/navbar/navbar.controller.js +++ b/zeppelin-web/src/components/navbar/navbar.controller.js @@ -53,7 +53,8 @@ angular.module('zeppelinWebApp') }; }) .controller('NavCtrl', function($scope, $rootScope, $http, $routeParams, - $location, notebookListDataFactory, baseUrlSrv, websocketMsgSrv, arrayOrderingSrv) { + $location, notebookListDataFactory, baseUrlSrv, websocketMsgSrv, arrayOrderingSrv, searchService) { + /** Current list of notes (ids) */ $scope.showLoginWindow = function() { @@ -62,11 +63,14 @@ angular.module('zeppelinWebApp') }, 500); }; + var vm = this; vm.notes = notebookListDataFactory; vm.connected = websocketMsgSrv.isConnected(); vm.websocketMsgSrv = websocketMsgSrv; vm.arrayOrderingSrv = arrayOrderingSrv; + $scope.searchForm = searchService; + if ($rootScope.ticket) { $rootScope.fullUsername = $rootScope.ticket.principal; $rootScope.truncatedUsername = $rootScope.ticket.principal; diff --git a/zeppelin-web/src/components/navbar/navbar.html b/zeppelin-web/src/components/navbar/navbar.html index c21be8c55f9..5e7de3bf61f 100644 --- a/zeppelin-web/src/components/navbar/navbar.html +++ b/zeppelin-web/src/components/navbar/navbar.html @@ -63,15 +63,17 @@