[ZEPPELIN-869] Search notebook to handle empty result.#978
Conversation
|
@ravicodder thank you for improvement! \cc @felizbear as an original author of search frontend for a review |
|
LGTM, I noticed you are clearing search box on click of any link 👍 |
| var routeChangeEvent = $rootScope.$on('$routeChangeStart', function (event, next, current) { | ||
| if (next.originalPath !== '/search/:searchTerm') { | ||
| angular.element('#searchTermId').val(''); | ||
| routeChangeEvent(); |
There was a problem hiding this comment.
I wonder, why do you recursively call routeChangeEvent here?
There was a problem hiding this comment.
@felizbear by calling routeChangeEvent I am explicitly unbinding the event handler.
$routeScope.$on returns a deregistration function whose reference we are storing in routeChangeEvent.
There was a problem hiding this comment.
Maybe it makes sense to rename routeChangeEvent into something like unbindRouteChangeEvent? with such name no questions would arise about why it is invoked
There was a problem hiding this comment.
@felizbear ya, it makes sense. Renamed routeChangeEvent to unbindRouteChangeEvent.
|
Also, I would recommend modify so it doesn't fire when there is an empty field |
|
Also, I think you will have to clean up scope after you clear the search field value. To see what I mean do the following:
|
|
Thanks for contribution by the way :) |
|
Hi @felizbear thanks for the review. |
…into ZEPPELIN-869 Conflicts: zeppelin-web/src/components/navbar/navbar.html
|
@ravicodder except for this remark, LGTM |
| $scope.isResult = true; | ||
| } | ||
|
|
||
| var routeChangeEvent = $rootScope.$on('$routeChangeStart', function (event, next, current) { |
There was a problem hiding this comment.
This should be $scope.$on
|
The |
|
@corneadoug Thanks for the review. Done required changes, kindly review it. |
…into ZEPPELIN-869 Conflicts: zeppelin-web/src/components/navbar/navbar.controller.js
| }); | ||
| }; | ||
|
|
||
| this.searchTerm = ''; |
There was a problem hiding this comment.
You will need to do a this.searchTerm = term.q; at the beginning of the this.search function, otherwise there is no search field when you reload the page
|
@ravicodder Thank you for rebasing, I left a few more comments |
|
@corneadoug done required changes. |
| angular | ||
| .module('zeppelinWebApp') | ||
| .controller('SearchResultCtrl', function($scope, $routeParams, searchService) { | ||
| .controller('SearchResultCtrl', function($scope, $routeParams, searchService, $rootScope) { |
There was a problem hiding this comment.
I think now $rootScope can be removed, its unused.
There was a problem hiding this comment.
@prabhjyotsingh removed $rootScope in latest commit.
3f62ed6 to
be51289
Compare
…tion remove rootscope
What is this PR for?
Search notebook to handle empty result.
What type of PR is it?
Bug Fix
Todos
What is the Jira issue?
ZEPPELIN-869
How should this be tested?
Screenshots (if appropriate)
Before:

After:

Questions: