You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2015/07/01 23:16:43 UTC
incubator-zeppelin git commit: Code Style fixing and small code
refactoring
Repository: incubator-zeppelin
Updated Branches:
refs/heads/master 0c1b7455a -> 28de33ce5
Code Style fixing and small code refactoring
Author: mkoltsov <ro...@javabean.ru>
Closes #128 from mkoltsov/master and squashes the following commits:
9191cc8 [mkoltsov] Code Style fixing and small code refactoring
Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/28de33ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/28de33ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/28de33ce
Branch: refs/heads/master
Commit: 28de33ce59583d7f9e0e2a6bda660bffd6911e17
Parents: 0c1b745
Author: mkoltsov <ro...@javabean.ru>
Authored: Mon Jun 29 22:18:57 2015 +0200
Committer: Lee moon soo <mo...@apache.org>
Committed: Wed Jul 1 14:16:38 2015 -0700
----------------------------------------------------------------------
zeppelin-web/app/scripts/app.js | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/28de33ce/zeppelin-web/app/scripts/app.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/app/scripts/app.js b/zeppelin-web/app/scripts/app.js
index 3a2c71f..b311b7c 100644
--- a/zeppelin-web/app/scripts/app.js
+++ b/zeppelin-web/app/scripts/app.js
@@ -20,7 +20,7 @@
*
* In the case of running the zeppelin-server normally,
* the body of this function is just filler. It will be dynamically
- * overridden with the AppScriptServlet from zeppelin-site.xml config value
+ * overridden with the AppScriptServlet from zeppelin-site.xml config value
* when the client requests the script.
*
* If the config value is not defined, it defaults to the HTTP port + 1
@@ -38,26 +38,23 @@
*/
function getPort() {
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;
}
function getWebsocketProtocol() {
- var protocol = 'ws';
- if (location.protocol === 'https:') {
- protocol = 'wss';
- }
- return protocol;
+ return location.protocol === 'https:' ? 'wss' : 'ws';
}
function getRestApiBase() {
var port = Number(location.port);
- if (port === 'undefined' || port === 0) {
+ if (!!port) {
port = 80;
if (location.protocol === 'https:') {
port = 443;
@@ -67,11 +64,11 @@ function getRestApiBase() {
if (port === 3333 || port === 9000) {
port = 8080;
}
- return location.protocol+"//"+location.hostname+":"+port + skipTrailingSlash(location.pathname) + "/api";
+ return location.protocol + "//" + location.hostname + ":" + port + skipTrailingSlash(location.pathname) + "/api";
}
function skipTrailingSlash(path) {
- return path.slice(-1) === "/" ? path.substring(0, path.length-1) : path;
+ return path.replace(/\/$/, "");
}
/**
@@ -100,9 +97,9 @@ angular
'puElasticInput',
'xeditable'
])
- .filter('breakFilter', function() {
+ .filter('breakFilter', function () {
return function (text) {
- if (text !== undefined) return text.replace(/\n/g, '<br />');
+ if (!!text) return text.replace(/\n/g, '<br />');
};
})
.config(function ($routeProvider, WebSocketProvider) {
@@ -130,6 +127,3 @@ angular
redirectTo: '/'
});
});
-
-
-