Skip to content

Commit

Permalink
Merge pull request #143 from NFLabs/banch-0.4-cherry-pick
Browse files Browse the repository at this point in the history
Bringing some important changes from master to branch-0.4
  • Loading branch information
Leemoonsoo committed Oct 13, 2014
2 parents 6c41787 + a0f5b10 commit d5a9027
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 11 deletions.
8 changes: 4 additions & 4 deletions bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ if [ "x$ZEPPELIN_WAR" == "x" ]; then
if [ -d "${ZEPPELIN_HOME}/zeppelin-web/src/main/webapp" ]; then
export ZEPPELIN_WAR="${ZEPPELIN_HOME}/zeppelin-web/src/main/webapp"
else
export ZEPPELIN_WAR=`find ${ZEPPELIN_HOME} -name "zeppelin-web-*.war"`
export ZEPPELIN_WAR=`find ${ZEPPELIN_HOME}/zeppelin-web -name "zeppelin-web*.war"`
fi
fi

if [ "x$ZEPPELIN_API_WAR" == "x" ]; then
if [ -d "${ZEPPELIN_HOME}/zeppelin-docs/src/main/swagger" ]; then
export ZEPPELIN_API_WAR="${ZEPPELIN_HOME}/zeppelin-docs/src/main/swagger"
else
export ZEPPELIN_API_WAR=`find ${ZEPPELIN_HOME} -name "zeppelin-api-ui-*.war"`
export ZEPPELIN_API_WAR=`find ${ZEPPELIN_HOME}/zeppelin-docs -name "zeppelin-api-ui*.war"`
fi
fi

if [ "x$ZEPPELIN_REPL_DIR" == "x" ]; then
export ZEPPELIN_REPL_DIR="$ZEPPELIN_HOME/repl"
if [ "x$ZEPPELIN_INTERPRETER_DIR" == "x" ]; then
export ZEPPELIN_INTERPRETER_DIR="$ZEPPELIN_HOME/interpreter"
fi


Expand Down
17 changes: 16 additions & 1 deletion zeppelin-web/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,28 @@
/** get the current port pf the websocket */
function getPort() {
var port = Number(location.port);
/** case of binding default port (80 / 443) */
if (port === 'undifined' || port === 0) {
port = 80;
if (location.protocol === 'https:') {
port = 443;
}
}
// brunch port
if (port === 3333 || port === 9000) {
port = 8080;
}
return port+1;
}

function getWebsocketProtocol() {
var protocol = 'ws';
if (location.protocol === 'https:') {
protocol = 'wss';
}
return protocol;
}

/**
* @ngdoc overview
* @name zeppelinWebApp
Expand All @@ -50,7 +65,7 @@ angular
.config(function ($routeProvider, WebSocketProvider) {
WebSocketProvider
.prefix('')
.uri('ws://'+location.hostname+':' + getPort());
.uri(getWebsocketProtocol() + '://' + location.hostname + ':' + getPort());

$routeProvider
.when('/', {
Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web/app/scripts/controllers/notebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
$scope.paragraphUrl = $routeParams.paragraphId;
$scope.asIframe = $routeParams.asIframe;
if ($scope.paragraphUrl) {
note = cleanParagraphExcept($scope.paragraphUrl, note)
note = cleanParagraphExcept($scope.paragraphUrl, note);
$rootScope.$emit('setIframe', $scope.asIframe);
}
if ($scope.note === null) {
Expand Down
18 changes: 14 additions & 4 deletions zeppelin-web/app/scripts/controllers/paragraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ angular.module('zeppelinWebApp')
// update column class
// TODO : do it in angualr way
var el = $('#'+$scope.paragraph.id+"_paragraphColumn");
el.removeClass(el.attr('class'))
el.addClass("paragraph-col col-md-"+$scope.paragraph.config.colWidth);
el.removeClass(el.attr('class'));
var col_width = 12;
if ($scope.paragraph.config.colWidth) {
col_width = $scope.paragraph.config.colWidth;
}
el.addClass("paragraph-col col-md-" + col_width);


if (newType==="TABLE") {
Expand Down Expand Up @@ -396,7 +400,13 @@ angular.module('zeppelinWebApp')

$scope.editor.getSession().setUseWrapMode(true);

$scope.editor.setKeyboardHandler("ace/keyboard/emacs");
if (navigator.appVersion.indexOf("Mac")!=-1 ||
navigator.appVersion.indexOf("X11")!=-1 ||
navigator.appVersion.indexOf("Linux")!=-1) {
$scope.editor.setKeyboardHandler("ace/keyboard/emacs");
} else if (navigator.appVersion.indexOf("Win")!=-1) {
// not applying emacs key binding while the binding override Ctrl-v. default behavior of paste text on windows.
}

$scope.editor.setOptions({
enableBasicAutocompletion: true,
Expand Down Expand Up @@ -856,7 +866,7 @@ angular.module('zeppelinWebApp')

$scope.goToSingleParagraph = function () {
var noteId = $route.current.pathParams.noteId;
var redirectToUrl = 'http://' + location.host + '/#/notebook/' + noteId + "/paragraph/" + $scope.paragraph.id+"?asIframe";
var redirectToUrl = location.protocol + '//' + location.host + '/#/notebook/' + noteId + "/paragraph/" + $scope.paragraph.id+"?asIframe";
$window.open(redirectToUrl);
};
});
3 changes: 2 additions & 1 deletion zeppelin-web/app/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@import url(http://fonts.googleapis.com/css?family=Patua+One);

@import url(//fonts.googleapis.com/css?family=Patua+One);

body {
padding-top: 60px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ public synchronized Interpreter getRepl(String replName){
}

public void destroyAll(){
if(staticMode){
// not destroying when it is static mode
return;
}

Set<String> keys = loadedInterpreters.keySet();
for(String k : keys) {
Interpreter repl = loadedInterpreters.get(k);
repl.close();
repl.destroy();
loadedInterpreters.remove(k);
}
}

Expand Down

0 comments on commit d5a9027

Please sign in to comment.