-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-869] Search notebook to handle empty result. #978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder, why do you recursively call routeChangeEvent here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think now $rootScope can be removed, its unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prabhjyotsingh removed $rootScope in latest commit.
3f62ed6 to
be51289
Compare
…tion remove rootscope
|
Merging if there is no more discussions |
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: