Uh oh!
There was an error while loading. Please reload this page.
[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.
heruka-urgyen
commented
Jun 12, 2016
Also, I would recommend modify so it doesn't fire when there is an empty field |
heruka-urgyen
commented
Jun 12, 2016
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:
|
heruka-urgyen
commented
Jun 12, 2016
Thanks for contribution by the way :) |
rranjan03
commented
Jun 13, 2016
Hi @felizbear thanks for the review. |
…into ZEPPELIN-869 Conflicts: zeppelin-web/src/components/navbar/navbar.html
heruka-urgyen
commented
Jun 13, 2016
@ravicodder except for this remark, LGTM |
| $scope.isResult = true; | ||
| } | ||
| var routeChangeEvent = $rootScope.$on('$routeChangeStart', function (event, next, current) { |
corneadoug
commented
Jun 13, 2016
The |
rranjan03
commented
Jun 13, 2016
@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
corneadoug
commented
Jun 14, 2016
@ravicodder Thank you for rebasing, I left a few more comments |
rranjan03
commented
Jun 14, 2016
@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
be51289Compare…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: