mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Merge Master and Fix ports
This commit is contained in:
commit
453af1a641
5 changed files with 40 additions and 30 deletions
|
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta charset="utf-8">
|
||||
<title>Page Not Found :(</title>
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ angular.module('zeppelinWebApp', [
|
|||
])
|
||||
.filter('breakFilter', function() {
|
||||
return function (text) {
|
||||
if (text !== undefined) {
|
||||
if (!!text) {
|
||||
return text.replace(/\n/g, '<br />');
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -421,27 +421,35 @@ angular.module('zeppelinWebApp')
|
|||
enableLiveAutocompletion:false
|
||||
});
|
||||
var remoteCompleter = {
|
||||
getCompletions : function(editor, session, pos, prefix, callback) {
|
||||
if (!$scope.editor.isFocused() ){ return;}
|
||||
getCompletions : function(editor, session, pos, prefix, callback) {
|
||||
if (!$scope.editor.isFocused() ){ return;}
|
||||
|
||||
var buf = session.getTextRange(new Range(0, 0, pos.row, pos.column));
|
||||
websocketMsgSrv.completion($scope.paragraph.id, buf, buf.length);
|
||||
var pos = session.getTextRange(new Range(0, 0, pos.row, pos.column)).length;
|
||||
var buf = session.getValue();
|
||||
$rootScope.$emit('sendNewEvent', {
|
||||
op : 'COMPLETION',
|
||||
data : {
|
||||
id : $scope.paragraph.id,
|
||||
buf : buf,
|
||||
cursor : pos
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('completionList', function(event, data) {
|
||||
if (data.completions) {
|
||||
var completions = [];
|
||||
for (var c in data.completions) {
|
||||
var v = data.completions[c];
|
||||
completions.push({
|
||||
name:v,
|
||||
value:v,
|
||||
score:300
|
||||
});
|
||||
}
|
||||
callback(null, completions);
|
||||
}
|
||||
});
|
||||
}
|
||||
$scope.$on('completionList', function(event, data) {
|
||||
if (data.completions) {
|
||||
var completions = [];
|
||||
for (var c in data.completions) {
|
||||
var v = data.completions[c];
|
||||
completions.push({
|
||||
name:v,
|
||||
value:v,
|
||||
score:300
|
||||
});
|
||||
}
|
||||
callback(null, completions);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
langTools.addCompleter(remoteCompleter);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,28 +29,24 @@ angular.module('zeppelinWebApp').service('baseUrlSrv', function() {
|
|||
/* @preserve AppScriptServlet - getPort */
|
||||
this.getPort = function() {
|
||||
var port = Number(location.port);
|
||||
if (location.protocol !== 'https:' && (port === 'undifined' || port === 0)) {
|
||||
if (location.protocol !== 'https:' && !port) {
|
||||
port = 80;
|
||||
} else if (location.protocol === 'https:' && (port === 'undifined' || port === 0)) {
|
||||
} else if (location.protocol === 'https:' && !port) {
|
||||
port = 443;
|
||||
} else if (port === 3333 || port === 9000) {
|
||||
port = 8080;
|
||||
}
|
||||
return port+1;
|
||||
return port + 1;
|
||||
};
|
||||
/* @preserve AppScriptServlet - close */
|
||||
|
||||
this.getWebsocketProtocol = function() {
|
||||
var protocol = 'ws';
|
||||
if (location.protocol === 'https:') {
|
||||
protocol = 'wss';
|
||||
}
|
||||
return protocol;
|
||||
return location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
};
|
||||
|
||||
this.getRestApiBase = function() {
|
||||
var port = Number(location.port);
|
||||
if (port === 'undefined' || port === 0) {
|
||||
if (!port) {
|
||||
port = 80;
|
||||
if (location.protocol === 'https:') {
|
||||
port = 443;
|
||||
|
|
@ -60,7 +56,11 @@ angular.module('zeppelinWebApp').service('baseUrlSrv', function() {
|
|||
if (port === 3333 || port === 9000) {
|
||||
port = 8080;
|
||||
}
|
||||
return location.protocol + '//' + location.hostname + ':' + port + '/api';
|
||||
return location.protocol + '//' + location.hostname + ':' + port + skipTrailingSlash(location.pathname) + '/api';
|
||||
};
|
||||
|
||||
var skipTrailingSlash = function(path) {
|
||||
return path.replace(/\/$/, '');
|
||||
};
|
||||
|
||||
});
|
||||
|
|
@ -14,6 +14,7 @@ limitations under the License.
|
|||
<!doctype html>
|
||||
<html ng-app="zeppelinWebApp" ng-controller="MainCtrl" class="no-js">
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<!-- disable caches for all browser -->
|
||||
|
|
|
|||
Loading…
Reference in a new issue