Uh oh!
There was an error while loading. Please reload this page.
[Zeppelin-945] Interpreter authorization - #1257
Conversation
| <div> | ||
| <p> | ||
| Enter comma separated interpreters in the fields. <br /> | ||
| Empty field (*) implies anyone can run the interpreters. |
There was a problem hiding this comment.
It's a minor thing; how about this interpreter instead of the interpreters?
AhyoungRyu
commented
Aug 4, 2016
@astroshim Awesome. I saw many people have talked about this feature :) I tested your patch locally, it works well as expected. But I found one issue regarding user suggestion, The suggestion list doesn't disappear after pressing |
astroshim
commented
Aug 4, 2016
@AhyoungRyu Let me check. Thanks. |
I think we need a documentation for "Interpreter Authorization" feature as well like we have below docs pages. But separated PR would be okay i think :) |
astroshim
commented
Aug 4, 2016
@AhyoungRyu I fixed you pointed out and I'll create the document for this separated PR. |
| if (event.keyCode === 13) { | ||
| closeAutoComplete(); | ||
| } | ||
| else if (event.keyCode < 37 || event.keyCode > 40) { // arrow buttons. |
There was a problem hiding this comment.
Can we move this line to the above line? As google code style said https://google.github.io/styleguide/javaguide.html#s4.1.2-blocks-k-r-style. Maybe you can't build this with grunt because of disallowKeywordsOnNewLine error.
AhyoungRyu
commented
Aug 4, 2016
@astroshim Tested again and checked the bug is gone. Thanks for the prompt fix 👍 |
| var checkIfSelected = function() { | ||
| if (($scope.suggestions.length === 0) && | ||
| ($scope.selectIndex < 0 || $scope.selectIndex >= $scope.suggestions.length) || | ||
| ($scope.suggestions.length !== 0 && ($scope.selectIndex < 0 || $scope.selectIndex >= $scope.suggestions.length)) |
There was a problem hiding this comment.
Long condition inside the if becomes quite hard to understand and follow here.
What do you think, could this be changed a bit to make it more readable i.e:
if(suggestionSelected($scope.suggestions.length,$scope.selectIndex)){//....}functionsuggestionSelected(len,i){return(len===0)&&(i<0||i>=len)||(len!==0&&(i<0||i>=len))}And now it's easy to see how suggestionSelected can be further improved, keeping invariants.
Normalizing the parantheses according to logical operator precedence in javascript we get
return(len===0&&(i<0||i>=len))||(len!==0&&(i<0||i>=len))}which, in turn, is the same as
return(i<0||i>=len)&&(len===0||len!==0)and as the right side of the && is always true for an integer, we get
functionsuggestionSelected(len,i){returni<0||i>=len}At the end, this might not worth extracting to a separate function, but this shows the benefits we can get from it.
The result is much simpler to understand and reason about.
@astroshim what do you think?
astroshim
commented
Aug 4, 2016
Thank you for detail review @bzz and @felizbear |
@astroshim A lot of these complications are already reduced with #1236 (which is already merged in master), take a look at it. |
astroshim
commented
Aug 4, 2016
@prabhjyotsingh Great. Thank you for giving me the guidance. |
astroshim
commented
Aug 6, 2016
\cc @AhyoungRyu@prabhjyotsingh@bzz @felizbear |
prabhjyotsingh
commented
Aug 6, 2016
I'll try it out, in the mean while, can you update screen-shot in description. |
astroshim
commented
Aug 6, 2016
@prabhjyotsingh I just updated screen-shot. Thank you for taking care of this. |
| angular.module('zeppelinWebApp').controller('InterpreterCtrl', | ||
| angular.module('zeppelinWebApp') | ||
| .directive('interpreterDirective', function($timeout) { |
There was a problem hiding this comment.
can you move this directive to a different file zeppelin-web/src/components/*
There was a problem hiding this comment.
I moved the directive. Thanks!
prabhjyotsingh
commented
Aug 8, 2016
Except for minor fixes, looks good. |
astroshim
commented
Aug 9, 2016
@prabhjyotsingh Thank you for your detail review. I fixed all that you mentioned. |
| this.host = host; | ||
| } | ||
| public boolean isSetPermission() { |
There was a problem hiding this comment.
This is quite an ambiguous naming - usually in Java set\get used as a convention for getters and setters, so may be here we better call it like permissionIsSet() or permissionWasSet() - in this way we keep the almos-eglish readability in case of the code like
if (permissionIsSet()) {
//....
}bzz
commented
Aug 11, 2016
@astroshim your changes look awesome to me! There is one more improvement on Java side noted above, other than that - looks good to merge. |
astroshim
commented
Aug 15, 2016
@bzz please review and Thanks again. |
bzz
commented
Aug 16, 2016
@astroshim changes looks great to me. There is one more comment above on Will merge to master right after that, and if there is no further discussion |
astroshim
commented
Aug 16, 2016
@bzz I just fixed, I missed that. |
bzz
commented
Aug 16, 2016
Thank you @astroshim ! Merging to master if there is no further discussion. |
bzz
commented
Aug 16, 2016
CI fails on web-app \w networking issue :\ which is not relevant here |

What is this PR for?
This PR is derived from #1223
What type of PR is it?
Improvement
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-945
How should this be tested?
You can change user permission of interpreter at interpreter setting page.
Screenshots (if appropriate)
Questions: