mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
[ZEPPELIN-2297] compute caption of copletion
This commit is contained in:
parent
1c74384759
commit
7b5835d3e1
1 changed files with 12 additions and 0 deletions
|
|
@ -650,6 +650,17 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
websocketMsgSrv.completion($scope.paragraph.id, buf, pos);
|
||||
|
||||
$scope.$on('completionList', function(event, data) {
|
||||
var computeCaption = function(value, meta) {
|
||||
var metaLength = meta !== undefined ? meta.length : 0;
|
||||
var length = 43;
|
||||
var whitespaceLength = 3;
|
||||
var ellipses = '...';
|
||||
var maxLengthCaption = length - metaLength - whitespaceLength - ellipses.length;
|
||||
if (value !== undefined && value.length > maxLengthCaption) {
|
||||
return value.substr(0, maxLengthCaption) + ellipses;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
if (data.completions) {
|
||||
var completions = [];
|
||||
for (var c in data.completions) {
|
||||
|
|
@ -658,6 +669,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
name: v.name,
|
||||
value: v.value,
|
||||
meta: v.meta,
|
||||
caption: computeCaption(v.value, v.meta),
|
||||
score: 300
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue