http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/fonts/fontawesome-webfont.woff ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/fonts/fontawesome-webfont.woff b/zeppelin-web/app/fonts/fontawesome-webfont.woff deleted file mode 100644 index 628b6a5..0000000 Binary files a/zeppelin-web/app/fonts/fontawesome-webfont.woff and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/images/zepLogo.png ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/images/zepLogo.png b/zeppelin-web/app/images/zepLogo.png deleted file mode 100644 index f11f022..0000000 Binary files a/zeppelin-web/app/images/zepLogo.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/images/zepLogoW.png ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/images/zepLogoW.png b/zeppelin-web/app/images/zepLogoW.png deleted file mode 100644 index 0b45fa4..0000000 Binary files a/zeppelin-web/app/images/zepLogoW.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/index.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/index.html b/zeppelin-web/app/index.html deleted file mode 100644 index 4d0ff08..0000000 --- a/zeppelin-web/app/index.html +++ /dev/null @@ -1,156 +0,0 @@ -<!-- -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -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 --> - <meta http-equiv="cache-control" content="max-age=0" /> - <meta http-equiv="cache-control" content="no-cache" /> - <meta http-equiv="cache-control" content="no-store" /> - <meta http-equiv="expires" content="0" /> - <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> - <meta http-equiv="pragma" content="no-cache" /> - - <meta name="description" content=""> - <meta name="viewport" content="width=device-width"> - <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> - <!-- build:css(.) styles/vendor.css --> - <!-- bower:css --> - <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" /> - <link rel="stylesheet" href="bower_components/nvd3/src/nv.d3.css" /> - <link rel="stylesheet" href="bower_components/perfect-scrollbar/src/perfect-scrollbar.css" /> - <link rel="stylesheet" href="bower_components/ng-sortable/dist/ng-sortable.css" /> - <link rel="stylesheet" href="bower_components/angular-xeditable/dist/css/xeditable.css" /> - <link rel="stylesheet" href="bower_components/highlightjs/styles/github.css" /> - <!-- endbower --> - <link rel="stylesheet" href="bower_components/jquery-ui/themes/base/all.css" /> - <!-- endbuild --> - <!-- build:css(.tmp) styles/main.css --> - <link href='https://fonts.googleapis.com/css?family=RobotoDraft:400,500,700,400italic' rel='stylesheet' type='text/css'> - <link rel="stylesheet" href="styles/main.css"> - <link rel="stylesheet" href="styles/typography.css"> - <link rel="stylesheet" href="styles/notebook.css"> - <link rel="stylesheet" href="styles/interpreter.css"> - <link rel="stylesheet" href="styles/font-awesome.min.css"> - <link rel="stylesheet" href="styles/simple-line-icons.css"> - <link rel="stylesheet" href="styles/custom-font.css"> - <!-- endbuild --> - <link rel="stylesheet" ng-href="styles/looknfeel/{{looknfeel}}.css"> - </head> - <body ng-class="{'bodyAsIframe': asIframe}" > - <!--[if lt IE 7]> - <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> - <![endif]--> - <div class="navbar navbar-inverse navbar-fixed-top" style="display: none;" role="navigation" ng-class="{'displayNavBar': !asIframe}"> - <div class="container"> - <div class="navbar-header"> - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a class="navbar-brand" href="#/"><img style="margin-top: -7px;s" src="images/zepLogoW.png" width="50" alt="I'm zeppelin"> Zeppelin</a> - </div> - - <div class="collapse navbar-collapse" ng-controller="NavCtrl"> - <ul class="nav navbar-nav"> - <li class="dropdown"> - <a href="#" class="dropdown-toggle">Notebook <span class="caret"></span></a> - <ul class="dropdown-menu" role="menu"> - <li><a href="javascript:void(0);" ng-click="createNewNote()"><i class="fa fa-plus"></i> Create new note</a></li> - <li class="divider"></li> - <div id="notebook-list" class="scrollbar-container"> - <li ng-repeat="note in notes track by $index" ng-class="{'active' : isActive(note.id)}"><a href="#/notebook/{{note.id}}">{{note.name || 'Note ' + note.id}} </a></li> - </div> - </ul> - </li> - <li> - <a href="#/interpreter">Interpreter</a> - </li> - </ul> - <ul class="nav navbar-nav navbar-right" style="margin-top:10px; margin-right:5px;"> - <li class="server-status"> - <i class="fa fa-circle" ng-class="{'server-connected':connected, 'server-disconnected':!connected }"></i> - <span ng-show="connected">Connected</span> - <span ng-show="!connected">Disconnected</span> - </li> - </ul> - </div> - </div> - </div> - <!-- Add your site or application content here --> - <div id="main" class="container"> - <div ng-view></div> - </div> - <!-- Modal :: Keyboard shortcuts --> - <div ng-include src="'views/modal-shortcut.html'"></div> - <!-- build:js(.) scripts/oldieshim.js --> - <!--[if lt IE 9]> - <script src="bower_components/es5-shim/es5-shim.js"></script> - <script src="bower_components/json3/lib/json3.min.js"></script> - <![endif]--> - <!-- endbuild --> - - <!-- build:js(.) scripts/vendor.js --> - <!-- bower:js --> - <script src="bower_components/jquery/dist/jquery.js"></script> - <script src="bower_components/angular/angular.js"></script> - <script src="bower_components/json3/lib/json3.js"></script> - <script src="bower_components/bootstrap/dist/js/bootstrap.js"></script> - <script src="bower_components/angular-cookies/angular-cookies.js"></script> - <script src="bower_components/angular-sanitize/angular-sanitize.js"></script> - <script src="bower_components/angular-animate/angular-animate.js"></script> - <script src="bower_components/angular-touch/angular-touch.js"></script> - <script src="bower_components/angular-route/angular-route.js"></script> - <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script> - <script src="bower_components/angular-websocket/angular-websocket.js"></script> - <script src="bower_components/ace-builds/src-noconflict/ace.js"></script> - <script src="bower_components/ace-builds/src-noconflict/mode-scala.js"></script> - <script src="bower_components/ace-builds/src-noconflict/mode-sql.js"></script> - <script src="bower_components/ace-builds/src-noconflict/mode-markdown.js"></script> - <script src="bower_components/ace-builds/src-noconflict/keybinding-emacs.js"></script> - <script src="bower_components/ace-builds/src-noconflict/ext-language_tools.js"></script> - <script src="bower_components/ace-builds/src-noconflict/theme-github.js"></script> - <script src="bower_components/angular-ui-ace/ui-ace.js"></script> - <script src="bower_components/jquery.scrollTo/jquery.scrollTo.js"></script> - <script src="bower_components/d3/d3.js"></script> - <script src="bower_components/nvd3/nv.d3.js"></script> - <script src="bower_components/jquery-ui/jquery-ui.js"></script> - <script src="bower_components/angular-dragdrop/src/angular-dragdrop.js"></script> - <script src="bower_components/perfect-scrollbar/src/perfect-scrollbar.js"></script> - <script src="bower_components/ng-sortable/dist/ng-sortable.js"></script> - <script src="bower_components/angular-elastic/elastic.js"></script> - <script src="bower_components/angular-elastic-input/dist/angular-elastic-input.min.js"></script> - <script src="bower_components/angular-xeditable/dist/js/xeditable.js"></script> - <script src="bower_components/highlightjs/highlight.pack.js"></script> - <!-- endbower --> - <!-- endbuild --> - <!-- build:js({.tmp,app}) scripts/scripts.js --> - <script src="scripts/app.js"></script> - <script src="scripts/controllers/main.js"></script> - <script src="scripts/controllers/notebook.js"></script> - <script src="scripts/controllers/interpreter.js"></script> - <script src="scripts/directives/ngenter.js"></script> - <script src="scripts/directives/dropdowninput.js"></script> - <script src="scripts/directives/resizable.js"></script> - <script src="scripts/controllers/paragraph.js"></script> - <script src="scripts/controllers/nav.js"></script> - <script src="scripts/directives/ngdelete.js"></script> - <script src="scripts/directives/popover-html-unsafe.js"></script> - <!-- endbuild --> - </body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/scripts/ace/textarea/src/ace-bookmarklet.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/scripts/ace/textarea/src/ace-bookmarklet.js b/zeppelin-web/app/scripts/ace/textarea/src/ace-bookmarklet.js deleted file mode 100644 index f723f43..0000000 --- a/zeppelin-web/app/scripts/ace/textarea/src/ace-bookmarklet.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -alert("moved to https://ajaxorg.github.io/ace-builds/demo/bookmarklet/index.html. Please update your bookmark") http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/scripts/app.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/scripts/app.js b/zeppelin-web/app/scripts/app.js deleted file mode 100644 index b311b7c..0000000 --- a/zeppelin-web/app/scripts/app.js +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -/** Get the current port of the websocket - * - * 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 - * when the client requests the script. - * - * If the config value is not defined, it defaults to the HTTP port + 1 - * - * At the moment, the key delimiter denoting the end of this function - * during the replacement is the '}' character. - * - * !!! - * Avoid using '}' inside the function body or you will fail running - * in server mode. - * !!! - * - * In the case of running "grunt serve", this function will appear - * as is. - */ -function getPort() { - var port = Number(location.port); - if (location.protocol !== 'https:' && !!port) - port = 80; - else if (location.protocol === 'https:' && !!port) - port = 443; - else if (port === 3333 || port === 9000) - port = 8080; - - return port+1; -} - -function getWebsocketProtocol() { - return location.protocol === 'https:' ? 'wss' : 'ws'; -} - -function getRestApiBase() { - var port = Number(location.port); - if (!!port) { - port = 80; - if (location.protocol === 'https:') { - port = 443; - } - } - - if (port === 3333 || port === 9000) { - port = 8080; - } - return location.protocol + "//" + location.hostname + ":" + port + skipTrailingSlash(location.pathname) + "/api"; -} - -function skipTrailingSlash(path) { - return path.replace(/\/$/, ""); -} - -/** - * @ngdoc overview - * @name zeppelinWebApp - * @description - * # zeppelinWebApp - * - * Main module of the application. - * - * @author anthonycorbacho - */ -angular - .module('zeppelinWebApp', [ - 'ngAnimate', - 'ngCookies', - 'ngRoute', - 'ngSanitize', - 'angular-websocket', - 'ui.ace', - 'ui.bootstrap', - 'ui.sortable', - 'ngTouch', - 'ngDragDrop', - 'monospaced.elastic', - 'puElasticInput', - 'xeditable' - ]) - .filter('breakFilter', function () { - return function (text) { - if (!!text) return text.replace(/\n/g, '<br />'); - }; - }) - .config(function ($routeProvider, WebSocketProvider) { - WebSocketProvider - .prefix('') - .uri(getWebsocketProtocol() + '://' + location.hostname + ':' + getPort()); - - $routeProvider - .when('/', { - templateUrl: 'views/main.html' - }) - .when('/notebook/:noteId', { - templateUrl: 'views/notebooks.html', - controller: 'NotebookCtrl' - }) - .when('/notebook/:noteId/paragraph/:paragraphId?', { - templateUrl: 'views/notebooks.html', - controller: 'NotebookCtrl' - }) - .when('/interpreter', { - templateUrl: 'views/interpreter.html', - controller: 'InterpreterCtrl' - }) - .otherwise({ - redirectTo: '/' - }); - }); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/scripts/controllers/interpreter.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/scripts/controllers/interpreter.js b/zeppelin-web/app/scripts/controllers/interpreter.js deleted file mode 100644 index 0da1baa..0000000 --- a/zeppelin-web/app/scripts/controllers/interpreter.js +++ /dev/null @@ -1,313 +0,0 @@ -/* global confirm:false, alert:false */ -/* jshint loopfunc: true */ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -/** - * @ngdoc function - * @name zeppelinWebApp.controller:InterpreterCtrl - * @description - * # InterpreterCtrl - * Controller of interpreter, manage the note (update) - */ -angular.module('zeppelinWebApp').controller('InterpreterCtrl', function($scope, $route, $routeParams, $location, $rootScope, $http) { - - var remoteSettingToLocalSetting = function(settingId, setting) { - var property = {}; - for (var key in setting.properties) { - property[key] = { - value : setting.properties[key] - }; - } - return { - id : settingId, - name : setting.name, - group : setting.group, - option : angular.copy(setting.option), - properties : property, - interpreters : setting.interpreterGroup - }; - }; - - var getInterpreterSettings = function() { - $http.get(getRestApiBase()+'/interpreter/setting'). - success(function(data, status, headers, config) { - var interpreterSettings = []; - //console.log("getInterpreterSettings=%o", data); - - for (var settingId in data.body) { - var setting = data.body[settingId]; - interpreterSettings.push(remoteSettingToLocalSetting(setting.id, setting)); - } - $scope.interpreterSettings = interpreterSettings; - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - var getAvailableInterpreters = function() { - $http.get(getRestApiBase()+'/interpreter'). - success(function(data, status, headers, config) { - var groupedInfo = {}; - var info; - for (var k in data.body) { - info = data.body[k]; - if (!groupedInfo[info.group]) { - groupedInfo[info.group] = []; - } - groupedInfo[info.group].push({ - name : info.name, - className : info.className, - properties : info.properties - }); - } - - $scope.availableInterpreters = groupedInfo; - //console.log("getAvailableInterpreters=%o", data); - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - $scope.copyOriginInterpreterSettingProperties = function(settingId) { - $scope.interpreterSettingProperties = {}; - for (var i=0; i < $scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if(setting.id === settingId) { - angular.copy(setting.properties, $scope.interpreterSettingProperties); - angular.copy(setting.option, $scope.interpreterSettingOption); - break; - } - } - console.log('%o, %o', $scope.interpreterSettings[i], $scope.interpreterSettingProperties); - }; - - $scope.updateInterpreterSetting = function(settingId) { - var result = confirm('Do you want to update this interpreter and restart with new settings?'); - if (!result) { - return; - } - - $scope.addNewInterpreterProperty(settingId); - - var request = { - option : { - remote : true - }, - properties : {}, - }; - - for (var i=0; i < $scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if(setting.id === settingId) { - request.option = angular.copy(setting.option); - for (var p in setting.properties) { - request.properties[p] = setting.properties[p].value; - } - break; - } - } - - $http.put(getRestApiBase()+'/interpreter/setting/'+settingId, request). - success(function(data, status, headers, config) { - for (var i=0; i < $scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if (setting.id === settingId) { - $scope.interpreterSettings.splice(i, 1); - $scope.interpreterSettings.splice(i, 0, remoteSettingToLocalSetting(settingId, data.body)); - break; - } - } - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - $scope.resetInterpreterSetting = function(settingId){ - for (var i=0; i<$scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if (setting.id === settingId) { - angular.copy($scope.interpreterSettingProperties, setting.properties); - angular.copy($scope.interpreterSettingOption, setting.option); - break; - } - } - }; - - $scope.removeInterpreterSetting = function(settingId) { - var result = confirm('Do you want to delete this interpreter setting?'); - if (!result) { - return; - } - - console.log('Delete setting %o', settingId); - $http.delete(getRestApiBase()+'/interpreter/setting/'+settingId). - success(function(data, status, headers, config) { - for (var i=0; i < $scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if (setting.id === settingId) { - $scope.interpreterSettings.splice(i, 1); - break; - } - } - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - $scope.newInterpreterGroupChange = function() { - var property = {}; - var intpGroupInfo = $scope.availableInterpreters[$scope.newInterpreterSetting.group]; - for (var i=0; i<intpGroupInfo.length; i++) { - var intpInfo = intpGroupInfo[i]; - for (var key in intpInfo.properties) { - property[key] = { - value : intpInfo.properties[key].defaultValue, - description : intpInfo.properties[key].description - }; - } - } - $scope.newInterpreterSetting.properties = property; - }; - - $scope.restartInterpreterSetting = function(settingId) { - var result = confirm('Do you want to restart this interpreter?'); - if (!result) { - return; - } - - $http.put(getRestApiBase()+'/interpreter/setting/restart/'+settingId). - success(function(data, status, headers, config) { - for (var i=0; i < $scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if (setting.id === settingId) { - $scope.interpreterSettings.splice(i, 1); - $scope.interpreterSettings.splice(i, 0, remoteSettingToLocalSetting(settingId, data.body)); - break; - } - } - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - $scope.addNewInterpreterSetting = function() { - if (!$scope.newInterpreterSetting.name || !$scope.newInterpreterSetting.group) { - alert('Please determine name and interpreter'); - return; - } - - for (var i=0; i<$scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if (setting.name === $scope.newInterpreterSetting.name) { - alert('Name ' + setting.name + ' already exists'); - return; - } - } - - $scope.addNewInterpreterProperty(); - - var newSetting = { - name : $scope.newInterpreterSetting.name, - group : $scope.newInterpreterSetting.group, - option : angular.copy($scope.newInterpreterSetting.option), - properties : {} - }; - - for (var p in $scope.newInterpreterSetting.properties) { - newSetting.properties[p] = $scope.newInterpreterSetting.properties[p].value; - } - - $http.post(getRestApiBase()+'/interpreter/setting', newSetting). - success(function(data, status, headers, config) { - $scope.resetNewInterpreterSetting(); - getInterpreterSettings(); - $scope.showAddNewSetting = false; - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - - $scope.resetNewInterpreterSetting = function() { - $scope.newInterpreterSetting = { - name : undefined, - group : undefined, - option : { remote : true }, - properties : {} - }; - $scope.newInterpreterSetting.propertyValue = ''; - $scope.newInterpreterSetting.propertyKey = ''; - }; - - $scope.removeInterpreterProperty = function(key, settingId) { - if (settingId === undefined) { - delete $scope.newInterpreterSetting.properties[key]; - } - else { - for (var i=0; i < $scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if (setting.id === settingId) { - delete $scope.interpreterSettings[i].properties[key] - break; - } - } - } - }; - - $scope.addNewInterpreterProperty = function(settingId) { - if(settingId === undefined) { - if (!$scope.newInterpreterSetting.propertyKey || $scope.newInterpreterSetting.propertyKey === '') { - return; - } - $scope.newInterpreterSetting.properties[$scope.newInterpreterSetting.propertyKey] = { value : $scope.newInterpreterSetting.propertyValue}; - $scope.newInterpreterSetting.propertyValue = ''; - $scope.newInterpreterSetting.propertyKey = ''; - } - else { - for (var i=0; i < $scope.interpreterSettings.length; i++) { - var setting = $scope.interpreterSettings[i]; - if (setting.id === settingId){ - if (!setting.propertyKey || setting.propertyKey === '') { - return; - } - setting.properties[setting.propertyKey] = { value : setting.propertyValue }; - setting.propertyValue = ''; - setting.propertyKey = ''; - break; - } - } - } - }; - - var init = function() { - // when interpreter page opened after seeing non-default looknfeel note, the css remains unchanged. that's what interpreter page want. Force set default looknfeel. - $rootScope.$emit('setLookAndFeel', 'default'); - $scope.interpreterSettings = []; - $scope.availableInterpreters = {}; - $scope.resetNewInterpreterSetting(); - - getInterpreterSettings(); - getAvailableInterpreters(); - }; - - init(); -}); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/scripts/controllers/main.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/scripts/controllers/main.js b/zeppelin-web/app/scripts/controllers/main.js deleted file mode 100644 index 2720cbd..0000000 --- a/zeppelin-web/app/scripts/controllers/main.js +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -/** - * @ngdoc function - * @name zeppelinWebApp.controller:MainCtrl - * @description - * # MainCtrl - * Controller of the zeppelinWebApp - * - * @author anthonycorbacho - */ -angular.module('zeppelinWebApp') - .controller('MainCtrl', function($scope, WebSocket, $rootScope, $window) { - $rootScope.compiledScope = $scope.$new(true, $rootScope); - $scope.WebSocketWaitingList = []; - $scope.connected = false; - $scope.looknfeel = 'default'; - - var init = function() { - $scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false); - }; - init(); - - /** - * Web socket - */ - WebSocket.onopen(function() { - console.log('Websocket created'); - $scope.connected = true; - if ($scope.WebSocketWaitingList.length > 0) { - for (var o in $scope.WebSocketWaitingList) { - WebSocket.send(JSON.stringify($scope.WebSocketWaitingList[o])); - } - } - setInterval(function(){ - $rootScope.$emit('sendNewEvent', {op: 'PING'}) - } - ,60000); - }); - - WebSocket.onmessage(function(event) { - var payload; - if (event.data) { - payload = angular.fromJson(event.data); - } - console.log('Receive << %o, %o, %o', payload.op, payload, $scope); - var op = payload.op; - var data = payload.data; - if (op === 'NOTE') { - $scope.$broadcast('setNoteContent', data.note); - } else if (op === 'NOTES_INFO') { - $scope.$broadcast('setNoteMenu', data.notes); - } else if (op === 'PARAGRAPH') { - $scope.$broadcast('updateParagraph', data); - } else if (op === 'PROGRESS') { - $scope.$broadcast('updateProgress', data); - } else if (op === 'COMPLETION_LIST') { - $scope.$broadcast('completionList', data); - } else if (op === 'ANGULAR_OBJECT_UPDATE') { - $scope.$broadcast('angularObjectUpdate', data); - } - }); - - WebSocket.onerror(function(event) { - console.log('error message: ', event); - $scope.connected = false; - }); - - WebSocket.onclose(function(event) { - console.log('close message: ', event); - $scope.connected = false; - }); - - /** Send info to the websocket server */ - var send = function(data) { - if (WebSocket.currentState() !== 'OPEN') { - $scope.WebSocketWaitingList.push(data); - } else { - console.log('Send >> %o, %o', data.op, data); - WebSocket.send(JSON.stringify(data)); - } - }; - - - /** get the childs event and sebd to the websocket server */ - $rootScope.$on('sendNewEvent', function(event, data) { - if (!event.defaultPrevented) { - send(data); - event.preventDefault(); - } - }); - - $rootScope.$on('setIframe', function(event, data) { - if (!event.defaultPrevented) { - $scope.asIframe = data; - event.preventDefault(); - } - }); - - $rootScope.$on('setLookAndFeel', function(event, data) { - if (!event.defaultPrevented && data && data !== '') { - $scope.looknfeel = data; - event.preventDefault(); - } - }); - -}); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/scripts/controllers/nav.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/scripts/controllers/nav.js b/zeppelin-web/app/scripts/controllers/nav.js deleted file mode 100644 index 3925845..0000000 --- a/zeppelin-web/app/scripts/controllers/nav.js +++ /dev/null @@ -1,54 +0,0 @@ -/* global $:false */ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -/** - * @ngdoc function - * @name zeppelinWebApp.controller:NavCtrl - * @description - * # NavCtrl - * Controller of the top navigation, mainly use for the dropdown menu - * - * @author anthonycorbacho - */ -angular.module('zeppelinWebApp').controller('NavCtrl', function($scope, $rootScope, $routeParams) { - /** Current list of notes (ids) */ - $scope.notes = []; - $('#notebook-list').perfectScrollbar({suppressScrollX: true}); - - /** Set the new menu */ - $scope.$on('setNoteMenu', function(event, notes) { - $scope.notes = notes; - }); - - var loadNotes = function() { - $rootScope.$emit('sendNewEvent', {op: 'LIST_NOTES'}); - }; - loadNotes(); - - /** Create a new note */ - $scope.createNewNote = function() { - $rootScope.$emit('sendNewEvent', {op: 'NEW_NOTE'}); - }; - - /** Check if the note url is equal to the current note */ - $scope.isActive = function(noteId) { - if ($routeParams.noteId === noteId) { - return true; - } - return false; - }; - -}); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/8c7424a1/zeppelin-web/app/scripts/controllers/notebook.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/scripts/controllers/notebook.js b/zeppelin-web/app/scripts/controllers/notebook.js deleted file mode 100644 index 9a9fcd7..0000000 --- a/zeppelin-web/app/scripts/controllers/notebook.js +++ /dev/null @@ -1,494 +0,0 @@ -/* global confirm:false, alert:false */ -/* jshint loopfunc: true */ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -/** - * @ngdoc function - * @name zeppelinWebApp.controller:NotebookCtrl - * @description - * # NotebookCtrl - * Controller of notes, manage the note (update) - * - */ -angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $route, $routeParams, $location, $rootScope, $http) { - $scope.note = null; - $scope.showEditor = false; - $scope.editorToggled = false; - $scope.tableToggled = false; - $scope.viewOnly = false; - $scope.looknfeelOption = [ 'default', 'simple', 'report']; - $scope.cronOption = [ - {name: 'None', value : undefined}, - {name: '1m', value: '0 0/1 * * * ?'}, - {name: '5m', value: '0 0/5 * * * ?'}, - {name: '1h', value: '0 0 0/1 * * ?'}, - {name: '3h', value: '0 0 0/3 * * ?'}, - {name: '6h', value: '0 0 0/6 * * ?'}, - {name: '12h', value: '0 0 0/12 * * ?'}, - {name: '1d', value: '0 0 0 * * ?'} - ]; - - $scope.interpreterSettings = []; - $scope.interpreterBindings = []; - - var angularObjectRegistry = {}; - - $scope.getCronOptionNameFromValue = function(value) { - if (!value) { - return ''; - } - - for (var o in $scope.cronOption) { - if ($scope.cronOption[o].value===value) { - return $scope.cronOption[o].name; - } - } - return value; - }; - - /** Init the new controller */ - var initNotebook = function() { - $rootScope.$emit('sendNewEvent', {op: 'GET_NOTE', data: {id: $routeParams.noteId}}); - }; - - initNotebook(); - - /** Remove the note and go back tot he main page */ - /** TODO(anthony): In the nearly future, go back to the main page and telle to the dude that the note have been remove */ - $scope.removeNote = function(noteId) { - var result = confirm('Do you want to delete this notebook?'); - if (result) { - $rootScope.$emit('sendNewEvent', {op: 'DEL_NOTE', data: {id: noteId}}); - $location.path('/#'); - } - }; - - $scope.runNote = function() { - var result = confirm('Run all paragraphs?'); - if (result) { - $scope.$broadcast('runParagraph'); - } - }; - - $scope.toggleAllEditor = function() { - if ($scope.editorToggled) { - $scope.$broadcast('closeEditor'); - } else { - $scope.$broadcast('openEditor'); - } - $scope.editorToggled = !$scope.editorToggled; - }; - - $scope.showAllEditor = function() { - $scope.$broadcast('openEditor'); - }; - - $scope.hideAllEditor = function() { - $scope.$broadcast('closeEditor'); - }; - - $scope.toggleAllTable = function() { - if ($scope.tableToggled) { - $scope.$broadcast('closeTable'); - } else { - $scope.$broadcast('openTable'); - } - $scope.tableToggled = !$scope.tableToggled; - }; - - $scope.showAllTable = function() { - $scope.$broadcast('openTable'); - }; - - $scope.hideAllTable = function() { - $scope.$broadcast('closeTable'); - }; - - $scope.isNoteRunning = function() { - var running = false; - if(!$scope.note){ return false; } - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if ( $scope.note.paragraphs[i].status === 'PENDING' || $scope.note.paragraphs[i].status === 'RUNNING') { - running = true; - break; - } - } - return running; - }; - - $scope.setLookAndFeel = function(looknfeel) { - $scope.note.config.looknfeel = looknfeel; - $scope.setConfig(); - }; - - /** Set cron expression for this note **/ - $scope.setCronScheduler = function(cronExpr) { - $scope.note.config.cron = cronExpr; - $scope.setConfig(); - }; - - /** Update note config **/ - $scope.setConfig = function(config) { - if(config) { - $scope.note.config = config; - } - $rootScope.$emit('sendNewEvent', {op: 'NOTE_UPDATE', data: {id: $scope.note.id, name: $scope.note.name, config : $scope.note.config}}); - }; - - /** Update the note name */ - $scope.sendNewName = function() { - $scope.showEditor = false; - if ($scope.note.name) { - $rootScope.$emit('sendNewEvent', {op: 'NOTE_UPDATE', data: {id: $scope.note.id, name: $scope.note.name, config : $scope.note.config}}); - } - }; - - /** update the current note */ - $scope.$on('setNoteContent', function(event, note) { - $scope.paragraphUrl = $routeParams.paragraphId; - $scope.asIframe = $routeParams.asIframe; - if ($scope.paragraphUrl) { - note = cleanParagraphExcept($scope.paragraphUrl, note); - $rootScope.$emit('setIframe', $scope.asIframe); - } - - if ($scope.note === null) { - $scope.note = note; - } else { - updateNote(note); - } - initializeLookAndFeel(); - //open interpreter binding setting when there're none selected - getInterpreterBindings(getInterpreterBindingsCallBack); - }); - - - var initializeLookAndFeel = function() { - if (!$scope.note.config.looknfeel) { - $scope.note.config.looknfeel = 'default'; - } else { - $scope.viewOnly = $scope.note.config.looknfeel === 'report' ? true : false; - } - $rootScope.$emit('setLookAndFeel', $scope.note.config.looknfeel); - }; - - - - - - var cleanParagraphExcept = function(paragraphId, note) { - var noteCopy = {}; - noteCopy.id = note.id; - noteCopy.name = note.name; - noteCopy.config = note.config; - noteCopy.info = note.info; - noteCopy.paragraphs = []; - for (var i=0; i<note.paragraphs.length; i++) { - if (note.paragraphs[i].id === paragraphId) { - noteCopy.paragraphs[0] = note.paragraphs[i]; - if (!noteCopy.paragraphs[0].config) { - noteCopy.paragraphs[0].config = {}; - } - noteCopy.paragraphs[0].config.editorHide = true; - noteCopy.paragraphs[0].config.tableHide = false; - break; - } - } - return noteCopy; - }; - - $scope.$on('moveParagraphUp', function(event, paragraphId) { - var newIndex = -1; - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if ($scope.note.paragraphs[i].id === paragraphId) { - newIndex = i-1; - break; - } - } - - if (newIndex<0 || newIndex>=$scope.note.paragraphs.length) { - return; - } - $rootScope.$emit('sendNewEvent', { op: 'MOVE_PARAGRAPH', data : {id: paragraphId, index: newIndex}}); - }); - - // create new paragraph on current position - $scope.$on('insertParagraph', function(event, paragraphId) { - var newIndex = -1; - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if ($scope.note.paragraphs[i].id === paragraphId) { - newIndex = i+1; - break; - } - } - - if (newIndex === $scope.note.paragraphs.length) { - alert('Cannot insert after the last paragraph.'); - return; - } - if (newIndex < 0 || newIndex > $scope.note.paragraphs.length) { - return; - } - $rootScope.$emit('sendNewEvent', { op: 'INSERT_PARAGRAPH', data : {index: newIndex}}); - }); - - $scope.$on('moveParagraphDown', function(event, paragraphId) { - var newIndex = -1; - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if ($scope.note.paragraphs[i].id === paragraphId) { - newIndex = i+1; - break; - } - } - - if (newIndex<0 || newIndex>=$scope.note.paragraphs.length) { - return; - } - $rootScope.$emit('sendNewEvent', { op: 'MOVE_PARAGRAPH', data : {id: paragraphId, index: newIndex}}); - }); - - $scope.$on('moveFocusToPreviousParagraph', function(event, currentParagraphId){ - var focus = false; - for (var i=$scope.note.paragraphs.length-1; i>=0; i--) { - if (focus === false ) { - if ($scope.note.paragraphs[i].id === currentParagraphId) { - focus = true; - continue; - } - } else { - var p = $scope.note.paragraphs[i]; - if (!p.config.hide && !p.config.editorHide && !p.config.tableHide) { - $scope.$broadcast('focusParagraph', $scope.note.paragraphs[i].id); - break; - } - } - } - }); - - $scope.$on('moveFocusToNextParagraph', function(event, currentParagraphId){ - var focus = false; - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if (focus === false ) { - if ($scope.note.paragraphs[i].id === currentParagraphId) { - focus = true; - continue; - } - } else { - var p = $scope.note.paragraphs[i]; - if (!p.config.hide && !p.config.editorHide && !p.config.tableHide) { - $scope.$broadcast('focusParagraph', $scope.note.paragraphs[i].id); - break; - } - } - } - }); - - var updateNote = function(note) { - /** update Note name */ - if (note.name !== $scope.note.name) { - console.log('change note name: %o to %o', $scope.note.name, note.name); - $scope.note.name = note.name; - } - - $scope.note.config = note.config; - $scope.note.info = note.info; - - var newParagraphIds = note.paragraphs.map(function(x) {return x.id;}); - var oldParagraphIds = $scope.note.paragraphs.map(function(x) {return x.id;}); - - var numNewParagraphs = newParagraphIds.length; - var numOldParagraphs = oldParagraphIds.length; - - /** add a new paragraph */ - if (numNewParagraphs > numOldParagraphs) { - for (var index in newParagraphIds) { - if (oldParagraphIds[index] !== newParagraphIds[index]) { - $scope.note.paragraphs.splice(index, 0, note.paragraphs[index]); - break; - } - } - } - - /** update or move paragraph */ - if (numNewParagraphs === numOldParagraphs) { - for (var idx in newParagraphIds) { - var newEntry = note.paragraphs[idx]; - if (oldParagraphIds[idx] === newParagraphIds[idx]) { - $scope.$broadcast('updateParagraph', {paragraph: newEntry}); - } else { - // move paragraph - var oldIdx = oldParagraphIds.indexOf(newParagraphIds[idx]); - $scope.note.paragraphs.splice(oldIdx, 1); - $scope.note.paragraphs.splice(idx, 0, newEntry); - // rebuild id list since paragraph has moved. - oldParagraphIds = $scope.note.paragraphs.map(function(x) {return x.id;}); - } - } - } - - /** remove paragraph */ - if (numNewParagraphs < numOldParagraphs) { - for (var oldidx in oldParagraphIds) { - if(oldParagraphIds[oldidx] !== newParagraphIds[oldidx]) { - $scope.note.paragraphs.splice(oldidx, 1); - break; - } - } - } - }; - - var getInterpreterBindings = function(callback) { - $http.get(getRestApiBase()+ '/notebook/interpreter/bind/' +$scope.note.id). - success(function(data, status, headers, config) { - $scope.interpreterBindings = data.body; - $scope.interpreterBindingsOrig = jQuery.extend(true, [], $scope.interpreterBindings); // to check dirty - if (callback) { - callback(); - } - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - var getInterpreterBindingsCallBack = function() { - var selected = false; - for (var i in $scope.interpreterBindings) { - var setting = $scope.interpreterBindings[i]; - if (setting.selected) { - selected = true; - break; - } - } - - if (!selected) { - // make default selection - var selectedIntp = {}; - for (var i in $scope.interpreterBindings) { - var setting = $scope.interpreterBindings[i]; - if (!selectedIntp[setting.group]) { - setting.selected = true; - selectedIntp[setting.group] = true; - } - } - $scope.showSetting = true; - } - }; - - $scope.interpreterSelectionListeners = { - accept : function(sourceItemHandleScope, destSortableScope) {return true;}, - itemMoved: function (event) {}, - orderChanged: function(event) {} - }; - - $scope.openSetting = function() { - $scope.showSetting = true; - getInterpreterBindings(); - }; - - $scope.closeSetting = function() { - if (isSettingDirty()) { - var result = confirm('Changes will be discarded'); - if (!result) { - return; - } - } - $scope.showSetting = false; - }; - - $scope.saveSetting = function() { - var selectedSettingIds = []; - for (var no in $scope.interpreterBindings) { - var setting = $scope.interpreterBindings[no]; - if (setting.selected) { - selectedSettingIds.push(setting.id); - } - } - - $http.put(getRestApiBase() + '/notebook/interpreter/bind/' + $scope.note.id, - selectedSettingIds). - success(function(data, status, headers, config) { - console.log('Interpreter binding %o saved', selectedSettingIds); - $scope.showSetting = false; - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - $scope.toggleSetting = function() { - if ($scope.showSetting) { - $scope.closeSetting(); - } else { - $scope.openSetting(); - } - }; - - var isSettingDirty = function() { - if (angular.equals($scope.interpreterBindings, $scope.interpreterBindingsOrig)) { - return false; - } else { - return true; - } - }; - - $scope.$on('angularObjectUpdate', function(event, data) { - if (data.noteId === $scope.note.id) { - var scope = $rootScope.compiledScope; - var varName = data.angularObject.name; - - if (angular.equals(data.angularObject.object, scope[varName])) { - // return when update has no change - return; - } - - if (!angularObjectRegistry[varName]) { - angularObjectRegistry[varName] = { - interpreterGroupId : data.interpreterGroupId, - } - } - - angularObjectRegistry[varName].skipEmit = true; - - if (!angularObjectRegistry[varName].clearWatcher) { - angularObjectRegistry[varName].clearWatcher = scope.$watch(varName, function(newValue, oldValue) { - if (angularObjectRegistry[varName].skipEmit) { - angularObjectRegistry[varName].skipEmit = false; - return; - } - - $rootScope.$emit('sendNewEvent', { - op: 'ANGULAR_OBJECT_UPDATED', - data: { - noteId: $routeParams.noteId, - name:varName, - value:newValue, - interpreterGroupId:angularObjectRegistry[varName].interpreterGroupId - } - }); - }); - } - scope[varName] = data.angularObject.object; - } - - }); - - var isFunction = function(functionToCheck) { - var getType = {}; - return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; - } - -});
