Repository: zeppelin Updated Branches: refs/heads/master 23a7e1b45 -> a9e7bc381
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/app/search/result-list.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/search/result-list.controller.js b/zeppelin-web/src/app/search/result-list.controller.js index cc07a99..5472ebc 100644 --- a/zeppelin-web/src/app/search/result-list.controller.js +++ b/zeppelin-web/src/app/search/result-list.controller.js @@ -12,11 +12,13 @@ * limitations under the License. */ 'use strict'; +(function() { -angular - .module('zeppelinWebApp') - .controller('SearchResultCtrl', function($scope, $routeParams, searchService) { + angular.module('zeppelinWebApp').controller('SearchResultCtrl', SearchResultCtrl); + SearchResultCtrl.$inject = ['$scope', '$routeParams', 'searchService']; + + function SearchResultCtrl($scope, $routeParams, searchService) { $scope.isResult = true ; $scope.searchTerm = $routeParams.searchTerm; var results = searchService.search({'q': $routeParams.searchTerm}).query(); @@ -152,4 +154,6 @@ angular }; }; - }); + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js b/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js index 00f827b..3f7d1b8 100644 --- a/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js +++ b/zeppelin-web/src/components/arrayOrderingSrv/arrayOrdering.service.js @@ -12,21 +12,24 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').service('arrayOrderingSrv', function() { + angular.module('zeppelinWebApp').service('arrayOrderingSrv', arrayOrderingSrv); - var arrayOrderingSrv = this; + function arrayOrderingSrv() { + var arrayOrderingSrv = this; - this.notebookListOrdering = function(note) { - return arrayOrderingSrv.getNoteName(note); - }; + this.notebookListOrdering = function(note) { + return arrayOrderingSrv.getNoteName(note); + }; - this.getNoteName = function(note) { - if (note.name === undefined || note.name.trim() === '') { - return 'Note ' + note.id; - } else { - return note.name; - } - }; + this.getNoteName = function(note) { + if (note.name === undefined || note.name.trim() === '') { + return 'Note ' + note.id; + } else { + return note.name; + } + }; + } -}); +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/baseUrl/baseUrl.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/baseUrl/baseUrl.service.js b/zeppelin-web/src/components/baseUrl/baseUrl.service.js index 656df63..8452a93 100644 --- a/zeppelin-web/src/components/baseUrl/baseUrl.service.js +++ b/zeppelin-web/src/components/baseUrl/baseUrl.service.js @@ -12,36 +12,41 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').service('baseUrlSrv', function() { + angular.module('zeppelinWebApp').service('baseUrlSrv', baseUrlSrv); - this.getPort = function() { - var port = Number(location.port); - if (!port) { - port = 80; - if (location.protocol === 'https:') { - port = 443; + function baseUrlSrv() { + this.getPort = function() { + var port = Number(location.port); + if (!port) { + port = 80; + if (location.protocol === 'https:') { + port = 443; + } } - } - //Exception for when running locally via grunt - if (port === 3333 || port === 9000) { - port = 8080; - } - return port; - }; + //Exception for when running locally via grunt + if (port === 3333 || port === 9000) { + port = 8080; + } + return port; + }; - this.getWebsocketUrl = function() { - var wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:'; - return wsProtocol + '//' + location.hostname + ':' + this.getPort() + skipTrailingSlash(location.pathname) + '/ws'; - }; + this.getWebsocketUrl = function() { + var wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:'; + return wsProtocol + '//' + location.hostname + ':' + this.getPort() + + skipTrailingSlash(location.pathname) + '/ws'; + }; - this.getRestApiBase = function() { - return location.protocol + '//' + location.hostname + ':' + this.getPort() + skipTrailingSlash(location.pathname) + - '/api'; - }; + this.getRestApiBase = function() { + return location.protocol + '//' + location.hostname + ':' + + this.getPort() + skipTrailingSlash(location.pathname) + + '/api'; + }; - var skipTrailingSlash = function(path) { - return path.replace(/\/$/, ''); - }; + var skipTrailingSlash = function(path) { + return path.replace(/\/$/, ''); + }; + } -}); +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/browser-detect/browserDetect.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/browser-detect/browserDetect.service.js b/zeppelin-web/src/components/browser-detect/browserDetect.service.js index 2e70175..780b446 100644 --- a/zeppelin-web/src/components/browser-detect/browserDetect.service.js +++ b/zeppelin-web/src/components/browser-detect/browserDetect.service.js @@ -12,29 +12,32 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').service('browserDetectService', function() { + angular.module('zeppelinWebApp').service('browserDetectService', browserDetectService); - this.detectIE = function() { - var ua = window.navigator.userAgent; - var msie = ua.indexOf('MSIE '); - if (msie > 0) { - // IE 10 or older => return version number - return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); - } - var trident = ua.indexOf('Trident/'); - if (trident > 0) { - // IE 11 => return version number - var rv = ua.indexOf('rv:'); - return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); - } - var edge = ua.indexOf('Edge/'); - if (edge > 0) { - // IE 12 (aka Edge) => return version number - return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); - } - // other browser - return false; - }; + function browserDetectService() { + this.detectIE = function() { + var ua = window.navigator.userAgent; + var msie = ua.indexOf('MSIE '); + if (msie > 0) { + // IE 10 or older => return version number + return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); + } + var trident = ua.indexOf('Trident/'); + if (trident > 0) { + // IE 11 => return version number + var rv = ua.indexOf('rv:'); + return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); + } + var edge = ua.indexOf('Edge/'); + if (edge > 0) { + // IE 12 (aka Edge) => return version number + return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); + } + // other browser + return false; + }; + } -}); +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/dropdowninput/dropdowninput.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/dropdowninput/dropdowninput.directive.js b/zeppelin-web/src/components/dropdowninput/dropdowninput.directive.js index 6095da6..29e25b0 100644 --- a/zeppelin-web/src/components/dropdowninput/dropdowninput.directive.js +++ b/zeppelin-web/src/components/dropdowninput/dropdowninput.directive.js @@ -12,14 +12,19 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').directive('dropdownInput', function() { - return { - restrict: 'A', - link: function(scope, element) { - element.bind('click', function(event) { - event.stopPropagation(); - }); - } - }; -}); + angular.module('zeppelinWebApp').directive('dropdownInput', dropdownInput); + + function dropdownInput() { + return { + restrict: 'A', + link: function(scope, element) { + element.bind('click', function(event) { + event.stopPropagation(); + }); + } + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/elasticInputCtrl/elasticInput.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/elasticInputCtrl/elasticInput.controller.js b/zeppelin-web/src/components/elasticInputCtrl/elasticInput.controller.js index ec19e93..48d4cb2 100644 --- a/zeppelin-web/src/components/elasticInputCtrl/elasticInput.controller.js +++ b/zeppelin-web/src/components/elasticInputCtrl/elasticInput.controller.js @@ -12,9 +12,13 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp') -.controller('ElasticInputCtrl', function() { - var vm = this; - vm.showEditor = false; -}); + angular.module('zeppelinWebApp').controller('ElasticInputCtrl', ElasticInputCtrl); + + function ElasticInputCtrl() { + var vm = this; + vm.showEditor = false; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js b/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js index 1c83188..2457048 100644 --- a/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js +++ b/zeppelin-web/src/components/expandCollapse/expandCollapse.directive.js @@ -12,22 +12,27 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').directive('expandCollapse', function() { - return { - restrict: 'EA', - link: function(scope, element, attrs) { - angular.element(element).click(function(event) { - if (angular.element(element).find('.expandable:visible').length > 1) { - angular.element(element).find('.expandable:visible').slideUp('slow'); - angular.element(element).find('i.icon-folder-alt').toggleClass('icon-folder icon-folder-alt'); - } else { - angular.element(element).find('.expandable').first().slideToggle('200',function() { - angular.element(element).find('i').first().toggleClass('icon-folder icon-folder-alt'); - }); - } - event.stopPropagation(); + angular.module('zeppelinWebApp').directive('expandCollapse', expandCollapse); + + function expandCollapse() { + return { + restrict: 'EA', + link: function(scope, element, attrs) { + angular.element(element).click(function(event) { + if (angular.element(element).find('.expandable:visible').length > 1) { + angular.element(element).find('.expandable:visible').slideUp('slow'); + angular.element(element).find('i.icon-folder-alt').toggleClass('icon-folder icon-folder-alt'); + } else { + angular.element(element).find('.expandable').first().slideToggle('200',function() { + angular.element(element).find('i').first().toggleClass('icon-folder icon-folder-alt'); }); } - }; -}); + event.stopPropagation(); + }); + } + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/interpreter/interpreter.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/interpreter/interpreter.directive.js b/zeppelin-web/src/components/interpreter/interpreter.directive.js index 1cf1ab2..25a4d3e 100644 --- a/zeppelin-web/src/components/interpreter/interpreter.directive.js +++ b/zeppelin-web/src/components/interpreter/interpreter.directive.js @@ -12,17 +12,24 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').directive('interpreterDirective', function($timeout) { - return { - restrict: 'A', - link: function(scope, element, attr) { - if (scope.$last === true) { - $timeout(function() { - var id = 'ngRenderFinished'; - scope.$emit(id); - }); + angular.module('zeppelinWebApp').directive('interpreterDirective', interpreterDirective); + + interpreterDirective.$inject = ['$timeout']; + + function interpreterDirective($timeout) { + return { + restrict: 'A', + link: function(scope, element, attr) { + if (scope.$last === true) { + $timeout(function() { + var id = 'ngRenderFinished'; + scope.$emit(id); + }); + } } - } - }; -}); + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/login/login.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/login/login.controller.js b/zeppelin-web/src/components/login/login.controller.js index e47ca50..c30110c 100644 --- a/zeppelin-web/src/components/login/login.controller.js +++ b/zeppelin-web/src/components/login/login.controller.js @@ -11,11 +11,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +(function() { + + angular.module('zeppelinWebApp').controller('LoginCtrl', LoginCtrl); -angular.module('zeppelinWebApp').controller('LoginCtrl', - function($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv) { + LoginCtrl.$inject = ['$scope', '$rootScope', '$http', '$httpParamSerializer', 'baseUrlSrv']; + + function LoginCtrl($scope, $rootScope, $http, $httpParamSerializer, baseUrlSrv) { $scope.loginParams = {}; $scope.login = function() { @@ -55,4 +58,5 @@ angular.module('zeppelinWebApp').controller('LoginCtrl', initValues(); }); } -); + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/navbar/navbar.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js index 2007322..7838a82 100644 --- a/zeppelin-web/src/components/navbar/navbar.controller.js +++ b/zeppelin-web/src/components/navbar/navbar.controller.js @@ -11,102 +11,117 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +(function() { + + angular.module('zeppelinWebApp').controller('NavCtrl', NavCtrl); + + NavCtrl.$inject = [ + '$scope', + '$rootScope', + '$http', + '$routeParams', + '$location', + 'notebookListDataFactory', + 'baseUrlSrv', + 'websocketMsgSrv', + 'arrayOrderingSrv', + 'searchService' + ]; + + function NavCtrl($scope, $rootScope, $http, $routeParams, $location, + notebookListDataFactory, baseUrlSrv, websocketMsgSrv, + arrayOrderingSrv, searchService) { + var vm = this; + vm.arrayOrderingSrv = arrayOrderingSrv; + vm.connected = websocketMsgSrv.isConnected(); + vm.isActive = isActive; + vm.logout = logout; + vm.notes = notebookListDataFactory; + vm.search = search; + vm.searchForm = searchService; + vm.showLoginWindow = showLoginWindow; + + $scope.query = {q: ''}; + + initController(); + + function getZeppelinVersion() { + $http.get(baseUrlSrv.getRestApiBase() + '/version').success( + function(data, status, headers, config) { + $rootScope.zeppelinVersion = data.body; + }).error( + function(data, status, headers, config) { + console.log('Error %o %o', status, data.message); + }); + } -angular.module('zeppelinWebApp') -.controller('NavCtrl', function($scope, $rootScope, $http, $routeParams, - $location, notebookListDataFactory, baseUrlSrv, websocketMsgSrv, arrayOrderingSrv, searchService) { - - var vm = this; - vm.arrayOrderingSrv = arrayOrderingSrv; - vm.connected = websocketMsgSrv.isConnected(); - vm.isActive = isActive; - vm.logout = logout; - vm.notes = notebookListDataFactory; - vm.search = search; - vm.searchForm = searchService; - vm.showLoginWindow = showLoginWindow; - - $scope.query = {q: ''}; - - initController(); - - function getZeppelinVersion() { - $http.get(baseUrlSrv.getRestApiBase() + '/version').success( - function(data, status, headers, config) { - $rootScope.zeppelinVersion = data.body; - }).error( - function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - } - - function initController() { - angular.element('#notebook-list').perfectScrollbar({suppressScrollX: true}); + function initController() { + angular.element('#notebook-list').perfectScrollbar({suppressScrollX: true}); - angular.element(document).click(function() { - $scope.query.q = ''; - }); + angular.element(document).click(function() { + $scope.query.q = ''; + }); - getZeppelinVersion(); - loadNotes(); - } + getZeppelinVersion(); + loadNotes(); + } - function isActive(noteId) { - return ($routeParams.noteId === noteId); - } + function isActive(noteId) { + return ($routeParams.noteId === noteId); + } - function loadNotes() { - websocketMsgSrv.getNotebookList(); - } + function loadNotes() { + websocketMsgSrv.getNotebookList(); + } - function logout() { - var logoutURL = baseUrlSrv.getRestApiBase() + '/login/logout'; + function logout() { + var logoutURL = baseUrlSrv.getRestApiBase() + '/login/logout'; - //for firefox and safari - logoutURL = logoutURL.replace('//', '//false:false@'); - $http.post(logoutURL).error(function() { - //force authcBasic (if configured) to logout + //for firefox and safari + logoutURL = logoutURL.replace('//', '//false:false@'); $http.post(logoutURL).error(function() { - $rootScope.userName = ''; - $rootScope.ticket.principal = ''; - $rootScope.ticket.ticket = ''; - $rootScope.ticket.roles = ''; - BootstrapDialog.show({ - message: 'Logout Success' + //force authcBasic (if configured) to logout + $http.post(logoutURL).error(function() { + $rootScope.userName = ''; + $rootScope.ticket.principal = ''; + $rootScope.ticket.ticket = ''; + $rootScope.ticket.roles = ''; + BootstrapDialog.show({ + message: 'Logout Success' + }); + setTimeout(function() { + window.location.replace('/'); + }, 1000); }); - setTimeout(function() { - window.location.replace('/'); - }, 1000); }); - }); - } + } - function search(searchTerm) { - $location.path('/search/' + searchTerm); - } + function search(searchTerm) { + $location.path('/search/' + searchTerm); + } - function showLoginWindow() { - setTimeout(function() { - angular.element('#userName').focus(); - }, 500); - } + function showLoginWindow() { + setTimeout(function() { + angular.element('#userName').focus(); + }, 500); + } - /* - ** $scope.$on functions below - */ + /* + ** $scope.$on functions below + */ - $scope.$on('setNoteMenu', function(event, notes) { - notebookListDataFactory.setNotes(notes); - }); + $scope.$on('setNoteMenu', function(event, notes) { + notebookListDataFactory.setNotes(notes); + }); - $scope.$on('setConnectedStatus', function(event, param) { - vm.connected = param; - }); + $scope.$on('setConnectedStatus', function(event, param) { + vm.connected = param; + }); - $scope.$on('loginSuccess', function(event, param) { - loadNotes(); - }); + $scope.$on('loginSuccess', function(event, param) { + loadNotes(); + }); + } -}); +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/ngenter/ngenter.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/ngenter/ngenter.directive.js b/zeppelin-web/src/components/ngenter/ngenter.directive.js index 89826c9..88e5c75 100644 --- a/zeppelin-web/src/components/ngenter/ngenter.directive.js +++ b/zeppelin-web/src/components/ngenter/ngenter.directive.js @@ -12,18 +12,23 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').directive('ngEnter', function() { - return function(scope, element, attrs) { - element.bind('keydown keypress', function(event) { - if (event.which === 13) { - if (!event.shiftKey) { - scope.$apply(function() { - scope.$eval(attrs.ngEnter); - }); + angular.module('zeppelinWebApp').directive('ngEnter', ngEnter); + + function ngEnter() { + return function(scope, element, attrs) { + element.bind('keydown keypress', function(event) { + if (event.which === 13) { + if (!event.shiftKey) { + scope.$apply(function() { + scope.$eval(attrs.ngEnter); + }); + } + event.preventDefault(); } - event.preventDefault(); - } - }); - }; -}); + }); + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/ngescape/ngescape.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/ngescape/ngescape.directive.js b/zeppelin-web/src/components/ngescape/ngescape.directive.js index 8b88b85..4bf8c37 100644 --- a/zeppelin-web/src/components/ngescape/ngescape.directive.js +++ b/zeppelin-web/src/components/ngescape/ngescape.directive.js @@ -12,16 +12,21 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').directive('ngEscape', function() { - return function(scope, element, attrs) { - element.bind('keydown keyup', function(event) { - if (event.which === 27) { - scope.$apply(function() { - scope.$eval(attrs.ngEscape); - }); - event.preventDefault(); - } - }); - }; -}); + angular.module('zeppelinWebApp').directive('ngEscape', ngEscape); + + function ngEscape() { + return function(scope, element, attrs) { + element.bind('keydown keyup', function(event) { + if (event.which === 27) { + scope.$apply(function() { + scope.$eval(attrs.ngEscape); + }); + event.preventDefault(); + } + }); + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/noteName-create/notename.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/noteName-create/notename.controller.js b/zeppelin-web/src/components/noteName-create/notename.controller.js index e42f862..5090a77 100644 --- a/zeppelin-web/src/components/noteName-create/notename.controller.js +++ b/zeppelin-web/src/components/noteName-create/notename.controller.js @@ -11,76 +11,85 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +(function() { + + angular.module('zeppelinWebApp').controller('NotenameCtrl', NotenameCtrl); -angular.module('zeppelinWebApp').controller('NotenameCtrl', function($scope, notebookListDataFactory, - $routeParams, websocketMsgSrv) { - var vm = this; - vm.clone = false; - vm.notes = notebookListDataFactory; - vm.websocketMsgSrv = websocketMsgSrv; - $scope.note = {}; + NotenameCtrl.$inject = [ + '$scope', + 'notebookListDataFactory', + '$routeParams', + 'websocketMsgSrv' + ]; - vm.createNote = function() { - if (!vm.clone) { - vm.websocketMsgSrv.createNotebook($scope.note.notename); - } else { - var noteId = $routeParams.noteId; - vm.websocketMsgSrv.cloneNotebook(noteId, $scope.note.notename); - } - }; + function NotenameCtrl($scope, notebookListDataFactory, $routeParams, websocketMsgSrv) { + var vm = this; + vm.clone = false; + vm.notes = notebookListDataFactory; + vm.websocketMsgSrv = websocketMsgSrv; + $scope.note = {}; + + vm.createNote = function() { + if (!vm.clone) { + vm.websocketMsgSrv.createNotebook($scope.note.notename); + } else { + var noteId = $routeParams.noteId; + vm.websocketMsgSrv.cloneNotebook(noteId, $scope.note.notename); + } + }; - vm.handleNameEnter = function() { - angular.element('#noteNameModal').modal('toggle'); - vm.createNote(); - }; + vm.handleNameEnter = function() { + angular.element('#noteNameModal').modal('toggle'); + vm.createNote(); + }; - vm.preVisible = function(clone, sourceNoteName) { - vm.clone = clone; - vm.sourceNoteName = sourceNoteName; - $scope.note.notename = vm.clone ? vm.cloneNoteName() : vm.newNoteName(); - $scope.$apply(); - }; + vm.preVisible = function(clone, sourceNoteName) { + vm.clone = clone; + vm.sourceNoteName = sourceNoteName; + $scope.note.notename = vm.clone ? vm.cloneNoteName() : vm.newNoteName(); + $scope.$apply(); + }; - vm.newNoteName = function() { - var newCount = 1; - angular.forEach(vm.notes.flatList, function(noteName) { - noteName = noteName.name; - if (noteName.match(/^Untitled Note [0-9]*$/)) { - var lastCount = noteName.substr(14) * 1; - if (newCount <= lastCount) { - newCount = lastCount + 1; + vm.newNoteName = function() { + var newCount = 1; + angular.forEach(vm.notes.flatList, function(noteName) { + noteName = noteName.name; + if (noteName.match(/^Untitled Note [0-9]*$/)) { + var lastCount = noteName.substr(14) * 1; + if (newCount <= lastCount) { + newCount = lastCount + 1; + } } - } - }); - return 'Untitled Note ' + newCount; - }; + }); + return 'Untitled Note ' + newCount; + }; - vm.cloneNoteName = function() { - var copyCount = 1; - var newCloneName = ''; - var lastIndex = vm.sourceNoteName.lastIndexOf(' '); - var endsWithNumber = !!vm.sourceNoteName.match('^.+?\\s\\d$'); - var noteNamePrefix = endsWithNumber ? vm.sourceNoteName.substr(0, lastIndex) : vm.sourceNoteName; - var regexp = new RegExp('^' + noteNamePrefix + ' .+'); + vm.cloneNoteName = function() { + var copyCount = 1; + var newCloneName = ''; + var lastIndex = vm.sourceNoteName.lastIndexOf(' '); + var endsWithNumber = !!vm.sourceNoteName.match('^.+?\\s\\d$'); + var noteNamePrefix = endsWithNumber ? vm.sourceNoteName.substr(0, lastIndex) : vm.sourceNoteName; + var regexp = new RegExp('^' + noteNamePrefix + ' .+'); - angular.forEach(vm.notes.flatList, function(noteName) { - noteName = noteName.name; - if (noteName.match(regexp)) { - var lastCopyCount = noteName.substr(lastIndex).trim(); - newCloneName = noteNamePrefix; - lastCopyCount = parseInt(lastCopyCount); - if (copyCount <= lastCopyCount) { - copyCount = lastCopyCount + 1; + angular.forEach(vm.notes.flatList, function(noteName) { + noteName = noteName.name; + if (noteName.match(regexp)) { + var lastCopyCount = noteName.substr(lastIndex).trim(); + newCloneName = noteNamePrefix; + lastCopyCount = parseInt(lastCopyCount); + if (copyCount <= lastCopyCount) { + copyCount = lastCopyCount + 1; + } } - } - }); + }); - if (!newCloneName) { - newCloneName = vm.sourceNoteName; - } - return newCloneName + ' ' + copyCount; - }; + if (!newCloneName) { + newCloneName = vm.sourceNoteName; + } + return newCloneName + ' ' + copyCount; + }; + } -}); +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/noteName-create/visible.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/noteName-create/visible.directive.js b/zeppelin-web/src/components/noteName-create/visible.directive.js index e50864b..ff70c5e 100644 --- a/zeppelin-web/src/components/noteName-create/visible.directive.js +++ b/zeppelin-web/src/components/noteName-create/visible.directive.js @@ -12,32 +12,37 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').directive('modalvisible', function() { - return { - restrict: 'A', - scope: { - preVisibleCallback: '&previsiblecallback', - postVisibleCallback: '&postvisiblecallback', - targetinput: '@targetinput' - }, - link: function(scope, element, attrs) { - // Add some listeners - var previsibleMethod = scope.preVisibleCallback; - var postVisibleMethod = scope.postVisibleCallback; - element.on('show.bs.modal',function(e) { - var relatedTarget = angular.element(e.relatedTarget); - var clone = relatedTarget.data('clone'); - var sourceNoteName = relatedTarget.data('source-note-name'); - var cloneNote = clone ? true : false; - previsibleMethod()(cloneNote, sourceNoteName); - }); - element.on('shown.bs.modal', function(e) { - if (scope.targetinput) { - angular.element(e.target).find('input#' + scope.targetinput).select(); - } - postVisibleMethod(); - }); - } - }; -}); + angular.module('zeppelinWebApp').directive('modalvisible', modalvisible); + + function modalvisible() { + return { + restrict: 'A', + scope: { + preVisibleCallback: '&previsiblecallback', + postVisibleCallback: '&postvisiblecallback', + targetinput: '@targetinput' + }, + link: function(scope, element, attrs) { + // Add some listeners + var previsibleMethod = scope.preVisibleCallback; + var postVisibleMethod = scope.postVisibleCallback; + element.on('show.bs.modal',function(e) { + var relatedTarget = angular.element(e.relatedTarget); + var clone = relatedTarget.data('clone'); + var sourceNoteName = relatedTarget.data('source-note-name'); + var cloneNote = clone ? true : false; + previsibleMethod()(cloneNote, sourceNoteName); + }); + element.on('shown.bs.modal', function(e) { + if (scope.targetinput) { + angular.element(e.target).find('input#' + scope.targetinput).select(); + } + postVisibleMethod(); + }); + } + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/noteName-import/notenameImport.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/noteName-import/notenameImport.controller.js b/zeppelin-web/src/components/noteName-import/notenameImport.controller.js index 4c9aa32..abcff43 100644 --- a/zeppelin-web/src/components/noteName-import/notenameImport.controller.js +++ b/zeppelin-web/src/components/noteName-import/notenameImport.controller.js @@ -1,128 +1,133 @@ /* - * 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. - */ - +* 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'; +(function() { + + angular.module('zeppelinWebApp').controller('NoteImportCtrl', NoteImportCtrl); -angular.module('zeppelinWebApp').controller('NoteImportCtrl', function($scope, $timeout, websocketMsgSrv) { - var vm = this; - $scope.note = {}; - $scope.note.step1 = true; - $scope.note.step2 = false; - $scope.maxLimit = ''; - var limit = 0; - - websocketMsgSrv.listConfigurations(); - $scope.$on('configurationsInfo', function(scope, event) { - limit = event.configurations['zeppelin.websocket.max.text.message.size']; - $scope.maxLimit = Math.round(limit / 1048576); - }); - - vm.resetFlags = function() { + NoteImportCtrl.$inject = ['$scope', '$timeout', 'websocketMsgSrv']; + + function NoteImportCtrl($scope, $timeout, websocketMsgSrv) { + var vm = this; $scope.note = {}; $scope.note.step1 = true; $scope.note.step2 = false; - angular.element('#noteImportFile').val(''); - }; - - $scope.uploadFile = function() { - angular.element('#noteImportFile').click(); - }; + $scope.maxLimit = ''; + var limit = 0; - $scope.importFile = function(element) { - $scope.note.errorText = ''; - $scope.note.importFile = element.files[0]; - var file = $scope.note.importFile; - var reader = new FileReader(); + websocketMsgSrv.listConfigurations(); + $scope.$on('configurationsInfo', function(scope, event) { + limit = event.configurations['zeppelin.websocket.max.text.message.size']; + $scope.maxLimit = Math.round(limit / 1048576); + }); - if (file.size > limit) { - $scope.note.errorText = 'File size limit Exceeded!'; - $scope.$apply(); - return; - } + vm.resetFlags = function() { + $scope.note = {}; + $scope.note.step1 = true; + $scope.note.step2 = false; + angular.element('#noteImportFile').val(''); + }; - reader.onloadend = function() { - vm.processImportJson(reader.result); + $scope.uploadFile = function() { + angular.element('#noteImportFile').click(); }; - if (file) { - reader.readAsText(file); - } - }; - - $scope.uploadURL = function() { - $scope.note.errorText = ''; - $scope.note.step1 = false; - $timeout(function() { - $scope.note.step2 = true; - }, 400); - }; - - vm.importBack = function() { - $scope.note.errorText = ''; - $timeout(function() { - $scope.note.step1 = true; - }, 400); - $scope.note.step2 = false; - }; - - vm.importNote = function() { - $scope.note.errorText = ''; - if ($scope.note.importUrl) { - jQuery.getJSON($scope.note.importUrl, function(result) { - vm.processImportJson(result); - }).fail(function() { - $scope.note.errorText = 'Unable to Fetch URL'; - $scope.$apply(); - }); - } else { - $scope.note.errorText = 'Enter URL'; - $scope.$apply(); - } - }; - - vm.processImportJson = function(result) { - if (typeof result !== 'object') { - try { - result = JSON.parse(result); - } catch (e) { - $scope.note.errorText = 'JSON parse exception'; + $scope.importFile = function(element) { + $scope.note.errorText = ''; + $scope.note.importFile = element.files[0]; + var file = $scope.note.importFile; + var reader = new FileReader(); + + if (file.size > limit) { + $scope.note.errorText = 'File size limit Exceeded!'; $scope.$apply(); return; } - } - if (result.paragraphs && result.paragraphs.length > 0) { - if (!$scope.note.noteImportName) { - $scope.note.noteImportName = result.name; + reader.onloadend = function() { + vm.processImportJson(reader.result); + }; + + if (file) { + reader.readAsText(file); + } + }; + + $scope.uploadURL = function() { + $scope.note.errorText = ''; + $scope.note.step1 = false; + $timeout(function() { + $scope.note.step2 = true; + }, 400); + }; + + vm.importBack = function() { + $scope.note.errorText = ''; + $timeout(function() { + $scope.note.step1 = true; + }, 400); + $scope.note.step2 = false; + }; + + vm.importNote = function() { + $scope.note.errorText = ''; + if ($scope.note.importUrl) { + jQuery.getJSON($scope.note.importUrl, function(result) { + vm.processImportJson(result); + }).fail(function() { + $scope.note.errorText = 'Unable to Fetch URL'; + $scope.$apply(); + }); + } else { + $scope.note.errorText = 'Enter URL'; + $scope.$apply(); + } + }; + + vm.processImportJson = function(result) { + if (typeof result !== 'object') { + try { + result = JSON.parse(result); + } catch (e) { + $scope.note.errorText = 'JSON parse exception'; + $scope.$apply(); + return; + } + + } + if (result.paragraphs && result.paragraphs.length > 0) { + if (!$scope.note.noteImportName) { + $scope.note.noteImportName = result.name; + } else { + result.name = $scope.note.noteImportName; + } + websocketMsgSrv.importNotebook(result); + //angular.element('#noteImportModal').modal('hide'); } else { - result.name = $scope.note.noteImportName; + $scope.note.errorText = 'Invalid JSON'; } - websocketMsgSrv.importNotebook(result); - //angular.element('#noteImportModal').modal('hide'); - } else { - $scope.note.errorText = 'Invalid JSON'; - } - $scope.$apply(); - }; - - /* - ** $scope.$on functions below - */ - - $scope.$on('setNoteMenu', function(event, notes) { - vm.resetFlags(); - angular.element('#noteImportModal').modal('hide'); - }); - -}); + $scope.$apply(); + }; + + /* + ** $scope.$on functions below + */ + + $scope.$on('setNoteMenu', function(event, notes) { + vm.resetFlags(); + angular.element('#noteImportModal').modal('hide'); + }); + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js b/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js index 730ea09..709edf2 100644 --- a/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js +++ b/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js @@ -12,54 +12,58 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').factory('notebookListDataFactory', function() { + angular.module('zeppelinWebApp').factory('notebookListDataFactory', notebookListDataFactory); - var notes = { - root: {children: []}, - flatList: [], + function notebookListDataFactory() { + var notes = { + root: {children: []}, + flatList: [], - setNotes: function(notesList) { - // a flat list to boost searching - notes.flatList = angular.copy(notesList); + setNotes: function(notesList) { + // a flat list to boost searching + notes.flatList = angular.copy(notesList); - // construct the folder-based tree - notes.root = {children: []}; - _.reduce(notesList, function(root, note) { - var noteName = note.name || note.id; - var nodes = noteName.match(/([^\/][^\/]*)/g); + // construct the folder-based tree + notes.root = {children: []}; + _.reduce(notesList, function(root, note) { + var noteName = note.name || note.id; + var nodes = noteName.match(/([^\/][^\/]*)/g); - // recursively add nodes - addNode(root, nodes, note.id); + // recursively add nodes + addNode(root, nodes, note.id); - return root; - }, notes.root); - } - }; + return root; + }, notes.root); + } + }; - var addNode = function(curDir, nodes, noteId) { - if (nodes.length === 1) { // the leaf - curDir.children.push({ - name: nodes[0], - id: noteId - }); - } else { // a folder node - var node = nodes.shift(); - var dir = _.find(curDir.children, - function(c) {return c.name === node && c.children !== undefined;}); - if (dir !== undefined) { // found an existing dir - addNode(dir, nodes, noteId); - } else { - var newDir = { - name: node, - hidden: true, - children: [] - }; - curDir.children.push(newDir); - addNode(newDir, nodes, noteId); + var addNode = function(curDir, nodes, noteId) { + if (nodes.length === 1) { // the leaf + curDir.children.push({ + name: nodes[0], + id: noteId + }); + } else { // a folder node + var node = nodes.shift(); + var dir = _.find(curDir.children, + function(c) {return c.name === node && c.children !== undefined;}); + if (dir !== undefined) { // found an existing dir + addNode(dir, nodes, noteId); + } else { + var newDir = { + name: node, + hidden: true, + children: [] + }; + curDir.children.push(newDir); + addNode(newDir, nodes, noteId); + } } - } - }; + }; + + return notes; + } - return notes; -}); +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe-popup.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe-popup.directive.js b/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe-popup.directive.js new file mode 100644 index 0000000..057e188 --- /dev/null +++ b/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe-popup.directive.js @@ -0,0 +1,28 @@ +/* + * 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'; +(function() { + + angular.module('zeppelinWebApp').directive('popoverHtmlUnsafePopup', popoverHtmlUnsafePopup); + + function popoverHtmlUnsafePopup() { + return { + restrict: 'EA', + replace: true, + scope: {title: '@', content: '@', placement: '@', animation: '&', isOpen: '&'}, + templateUrl: 'components/popover-html-unsafe/popover-html-unsafe-popup.html' + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe.directive.js b/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe.directive.js index 274e011..52499a0 100644 --- a/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe.directive.js +++ b/zeppelin-web/src/components/popover-html-unsafe/popover-html-unsafe.directive.js @@ -12,17 +12,14 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp') - .directive('popoverHtmlUnsafePopup', function() { - return { - restrict: 'EA', - replace: true, - scope: {title: '@', content: '@', placement: '@', animation: '&', isOpen: '&'}, - templateUrl: 'components/popover-html-unsafe/popover-html-unsafe-popup.html' - }; - }) + angular.module('zeppelinWebApp').directive('popoverHtmlUnsafe', popoverHtmlUnsafe); - .directive('popoverHtmlUnsafe', ['$tooltip', function($tooltip) { + popoverHtmlUnsafe.$inject = ['$tooltip']; + + function popoverHtmlUnsafe($tooltip) { return $tooltip('popoverHtmlUnsafe', 'popover', 'click'); - }]); + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/resizable/resizable.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/resizable/resizable.directive.js b/zeppelin-web/src/components/resizable/resizable.directive.js index 2dcfe0a..912d474 100644 --- a/zeppelin-web/src/components/resizable/resizable.directive.js +++ b/zeppelin-web/src/components/resizable/resizable.directive.js @@ -12,58 +12,62 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').directive('resizable', function() { + angular.module('zeppelinWebApp').directive('resizable', resizable); - var resizableConfig = { - autoHide: true, - handles: 'se', - helper: 'resizable-helper', - stop: function() { - angular.element(this).css({'width': '100%', 'height': '100%'}); - } - }; + function resizable() { + var resizableConfig = { + autoHide: true, + handles: 'se', + helper: 'resizable-helper', + stop: function() { + angular.element(this).css({'width': '100%', 'height': '100%'}); + } + }; - return { - restrict: 'A', - scope: { - callback: '&onResize' - }, - link: function postLink(scope, elem, attrs) { - attrs.$observe('resize', function(resize) { - var resetResize = function(elem, resize) { - var colStep = window.innerWidth / 12; - elem.off('resizestop'); - var conf = angular.copy(resizableConfig); - if (resize.graphType === 'TABLE' || resize.graphType === 'TEXT') { - conf.grid = [colStep, 10]; - conf.minHeight = 100; - } else { - conf.grid = [colStep, 10000]; - conf.minHeight = 0; - } - conf.maxWidth = window.innerWidth; + return { + restrict: 'A', + scope: { + callback: '&onResize' + }, + link: function postLink(scope, elem, attrs) { + attrs.$observe('resize', function(resize) { + var resetResize = function(elem, resize) { + var colStep = window.innerWidth / 12; + elem.off('resizestop'); + var conf = angular.copy(resizableConfig); + if (resize.graphType === 'TABLE' || resize.graphType === 'TEXT') { + conf.grid = [colStep, 10]; + conf.minHeight = 100; + } else { + conf.grid = [colStep, 10000]; + conf.minHeight = 0; + } + conf.maxWidth = window.innerWidth; - elem.resizable(conf); - elem.on('resizestop', function() { - if (scope.callback) { - var height = elem.height(); - if (height < 50) { - height = 300; + elem.resizable(conf); + elem.on('resizestop', function() { + if (scope.callback) { + var height = elem.height(); + if (height < 50) { + height = 300; + } + scope.callback({width: Math.ceil(elem.width() / colStep), height: height}); } - scope.callback({width: Math.ceil(elem.width() / colStep), height: height}); - } - }); - }; + }); + }; - resize = JSON.parse(resize); - if (resize.allowresize === 'true') { - resetResize(elem, resize); - angular.element(window).resize(function() { + resize = JSON.parse(resize); + if (resize.allowresize === 'true') { resetResize(elem, resize); - }); - } - }); - } - }; -}); + angular.element(window).resize(function() { + resetResize(elem, resize); + }); + } + }); + } + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/saveAs/saveAs.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/saveAs/saveAs.service.js b/zeppelin-web/src/components/saveAs/saveAs.service.js index 83f25e7..4d73b69 100644 --- a/zeppelin-web/src/components/saveAs/saveAs.service.js +++ b/zeppelin-web/src/components/saveAs/saveAs.service.js @@ -12,38 +12,44 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').service('saveAsService', function(browserDetectService) { + angular.module('zeppelinWebApp').service('saveAsService', saveAsService); - this.saveAs = function(content, filename, extension) { - var BOM = '\uFEFF'; - if (browserDetectService.detectIE()) { - angular.element('body').append('<iframe id="SaveAsId" style="display: none"></iframe>'); - var frameSaveAs = angular.element('body > iframe#SaveAsId')[0].contentWindow; - content = BOM + content; - frameSaveAs.document.open('text/json', 'replace'); - frameSaveAs.document.write(content); - frameSaveAs.document.close(); - frameSaveAs.focus(); - var t1 = Date.now(); - frameSaveAs.document.execCommand('SaveAs', false, filename + '.' + extension); - var t2 = Date.now(); + saveAsService.$inject = ['browserDetectService']; - //This means, this version of IE dosen't support auto download of a file with extension provided in param - //falling back to ".txt" - if (t1 === t2) { - frameSaveAs.document.execCommand('SaveAs', true, filename + '.txt'); + function saveAsService(browserDetectService) { + this.saveAs = function(content, filename, extension) { + var BOM = '\uFEFF'; + if (browserDetectService.detectIE()) { + angular.element('body').append('<iframe id="SaveAsId" style="display: none"></iframe>'); + var frameSaveAs = angular.element('body > iframe#SaveAsId')[0].contentWindow; + content = BOM + content; + frameSaveAs.document.open('text/json', 'replace'); + frameSaveAs.document.write(content); + frameSaveAs.document.close(); + frameSaveAs.focus(); + var t1 = Date.now(); + frameSaveAs.document.execCommand('SaveAs', false, filename + '.' + extension); + var t2 = Date.now(); + + //This means, this version of IE dosen't support auto download of a file with extension provided in param + //falling back to ".txt" + if (t1 === t2) { + frameSaveAs.document.execCommand('SaveAs', true, filename + '.txt'); + } + angular.element('body > iframe#SaveAsId').remove(); + } else { + content = 'data:image/svg;charset=utf-8,' + BOM + encodeURIComponent(content); + angular.element('body').append('<a id="SaveAsId"></a>'); + var saveAsElement = angular.element('body > a#SaveAsId'); + saveAsElement.attr('href', content); + saveAsElement.attr('download', filename + '.' + extension); + saveAsElement.attr('target', '_blank'); + saveAsElement[0].click(); + saveAsElement.remove(); } - angular.element('body > iframe#SaveAsId').remove(); - } else { - content = 'data:image/svg;charset=utf-8,' + BOM + encodeURIComponent(content); - angular.element('body').append('<a id="SaveAsId"></a>'); - var saveAsElement = angular.element('body > a#SaveAsId'); - saveAsElement.attr('href', content); - saveAsElement.attr('download', filename + '.' + extension); - saveAsElement.attr('target', '_blank'); - saveAsElement[0].click(); - saveAsElement.remove(); - } - }; -}); + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/searchService/search.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/searchService/search.service.js b/zeppelin-web/src/components/searchService/search.service.js index a2bc7cf..46e2fb5 100644 --- a/zeppelin-web/src/components/searchService/search.service.js +++ b/zeppelin-web/src/components/searchService/search.service.js @@ -12,21 +12,26 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').service('searchService', function($resource, baseUrlSrv) { + angular.module('zeppelinWebApp').service('searchService', searchService); - this.search = function(term) { - this.searchTerm = term.q; - console.log('Searching for: %o', term.q); - if (!term.q) { //TODO(bzz): empty string check - return; - } - var encQuery = window.encodeURIComponent(term.q); - return $resource(baseUrlSrv.getRestApiBase() + '/notebook/search?q=' + encQuery, {}, { - query: {method: 'GET'} - }); - }; + searchService.$inject = ['$resource', 'baseUrlSrv']; - this.searchTerm = ''; + function searchService($resource, baseUrlSrv) { + this.search = function(term) { + this.searchTerm = term.q; + console.log('Searching for: %o', term.q); + if (!term.q) { //TODO(bzz): empty string check + return; + } + var encQuery = window.encodeURIComponent(term.q); + return $resource(baseUrlSrv.getRestApiBase() + '/notebook/search?q=' + encQuery, {}, { + query: {method: 'GET'} + }); + }; -}); + this.searchTerm = ''; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js index e99d6aa..da261ea 100644 --- a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js +++ b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js @@ -12,140 +12,146 @@ * limitations under the License. */ 'use strict'; +(function() { -angular.module('zeppelinWebApp').factory('websocketEvents', - function($rootScope, $websocket, $location, baseUrlSrv) { - var websocketCalls = {}; + angular.module('zeppelinWebApp').factory('websocketEvents', websocketEvents); - websocketCalls.ws = $websocket(baseUrlSrv.getWebsocketUrl()); - websocketCalls.ws.reconnectIfNotNormalClose = true; + websocketEvents.$inject = ['$rootScope', '$websocket', '$location', 'baseUrlSrv']; - websocketCalls.ws.onOpen(function() { - console.log('Websocket created'); - $rootScope.$broadcast('setConnectedStatus', true); - setInterval(function() { - websocketCalls.sendNewEvent({op: 'PING'}); - }, 10000); - }); + function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) { + var websocketCalls = {}; - websocketCalls.sendNewEvent = function(data) { - if ($rootScope.ticket !== undefined) { - data.principal = $rootScope.ticket.principal; - data.ticket = $rootScope.ticket.ticket; - data.roles = $rootScope.ticket.roles; - } else { - data.principal = ''; - data.ticket = ''; - data.roles = ''; - } - console.log('Send >> %o, %o, %o, %o, %o', data.op, data.principal, data.ticket, data.roles, data); - websocketCalls.ws.send(JSON.stringify(data)); - }; + websocketCalls.ws = $websocket(baseUrlSrv.getWebsocketUrl()); + websocketCalls.ws.reconnectIfNotNormalClose = true; - websocketCalls.isConnected = function() { - return (websocketCalls.ws.socket.readyState === 1); - }; + websocketCalls.ws.onOpen(function() { + console.log('Websocket created'); + $rootScope.$broadcast('setConnectedStatus', true); + setInterval(function() { + websocketCalls.sendNewEvent({op: 'PING'}); + }, 10000); + }); - websocketCalls.ws.onMessage(function(event) { - var payload; - if (event.data) { - payload = angular.fromJson(event.data); - } - console.log('Receive << %o, %o', payload.op, payload); - var op = payload.op; - var data = payload.data; - if (op === 'NOTE') { - $rootScope.$broadcast('setNoteContent', data.note); - } else if (op === 'NEW_NOTE') { - $location.path('/notebook/' + data.note.id); - } else if (op === 'NOTES_INFO') { - $rootScope.$broadcast('setNoteMenu', data.notes); - } else if (op === 'LIST_NOTEBOOK_JOBS') { - $rootScope.$broadcast('setNotebookJobs', data.notebookJobs); - } else if (op === 'LIST_UPDATE_NOTEBOOK_JOBS') { - $rootScope.$broadcast('setUpdateNotebookJobs', data.notebookRunningJobs); - } else if (op === 'AUTH_INFO') { - BootstrapDialog.show({ - closable: false, - closeByBackdrop: false, - closeByKeyboard: false, - title: 'Insufficient privileges', - message: data.info.toString(), - buttons: [{ - label: 'Login', - action: function(dialog) { - dialog.close(); - angular.element('#loginModal').modal({ - show: 'true' - }); - } - }, { - label: 'Cancel', - action: function(dialog) { - dialog.close(); - $location.path('/'); - } - }] - }); - } else if (op === 'PARAGRAPH') { - $rootScope.$broadcast('updateParagraph', data); - } else if (op === 'PARAGRAPH_APPEND_OUTPUT') { - $rootScope.$broadcast('appendParagraphOutput', data); - } else if (op === 'PARAGRAPH_UPDATE_OUTPUT') { - $rootScope.$broadcast('updateParagraphOutput', data); - } else if (op === 'PROGRESS') { - $rootScope.$broadcast('updateProgress', data); - } else if (op === 'COMPLETION_LIST') { - $rootScope.$broadcast('completionList', data); - } else if (op === 'EDITOR_SETTING') { - $rootScope.$broadcast('editorSetting', data); - } else if (op === 'ANGULAR_OBJECT_UPDATE') { - $rootScope.$broadcast('angularObjectUpdate', data); - } else if (op === 'ANGULAR_OBJECT_REMOVE') { - $rootScope.$broadcast('angularObjectRemove', data); - } else if (op === 'APP_APPEND_OUTPUT') { - $rootScope.$broadcast('appendAppOutput', data); - } else if (op === 'APP_UPDATE_OUTPUT') { - $rootScope.$broadcast('updateAppOutput', data); - } else if (op === 'APP_LOAD') { - $rootScope.$broadcast('appLoad', data); - } else if (op === 'APP_STATUS_CHANGE') { - $rootScope.$broadcast('appStatusChange', data); - } else if (op === 'LIST_REVISION_HISTORY') { - $rootScope.$broadcast('listRevisionHistory', data); - } else if (op === 'NOTE_REVISION') { - $rootScope.$broadcast('noteRevision', data); - } else if (op === 'INTERPRETER_BINDINGS') { - $rootScope.$broadcast('interpreterBindings', data); - } else if (op === 'ERROR_INFO') { - BootstrapDialog.show({ - closable: false, - closeByBackdrop: false, - closeByKeyboard: false, - title: 'Details', - message: data.info.toString(), - buttons: [{ - // close all the dialogs when there are error on running all paragraphs - label: 'Close', - action: function() { - BootstrapDialog.closeAll(); - } - }] - }); - } else if (op === 'CONFIGURATIONS_INFO') { - $rootScope.$broadcast('configurationsInfo', data); - } - }); + websocketCalls.sendNewEvent = function(data) { + if ($rootScope.ticket !== undefined) { + data.principal = $rootScope.ticket.principal; + data.ticket = $rootScope.ticket.ticket; + data.roles = $rootScope.ticket.roles; + } else { + data.principal = ''; + data.ticket = ''; + data.roles = ''; + } + console.log('Send >> %o, %o, %o, %o, %o', data.op, data.principal, data.ticket, data.roles, data); + websocketCalls.ws.send(JSON.stringify(data)); + }; - websocketCalls.ws.onError(function(event) { - console.log('error message: ', event); - $rootScope.$broadcast('setConnectedStatus', false); - }); + websocketCalls.isConnected = function() { + return (websocketCalls.ws.socket.readyState === 1); + }; - websocketCalls.ws.onClose(function(event) { - console.log('close message: ', event); - $rootScope.$broadcast('setConnectedStatus', false); - }); + websocketCalls.ws.onMessage(function(event) { + var payload; + if (event.data) { + payload = angular.fromJson(event.data); + } + console.log('Receive << %o, %o', payload.op, payload); + var op = payload.op; + var data = payload.data; + if (op === 'NOTE') { + $rootScope.$broadcast('setNoteContent', data.note); + } else if (op === 'NEW_NOTE') { + $location.path('/notebook/' + data.note.id); + } else if (op === 'NOTES_INFO') { + $rootScope.$broadcast('setNoteMenu', data.notes); + } else if (op === 'LIST_NOTEBOOK_JOBS') { + $rootScope.$broadcast('setNotebookJobs', data.notebookJobs); + } else if (op === 'LIST_UPDATE_NOTEBOOK_JOBS') { + $rootScope.$broadcast('setUpdateNotebookJobs', data.notebookRunningJobs); + } else if (op === 'AUTH_INFO') { + BootstrapDialog.show({ + closable: false, + closeByBackdrop: false, + closeByKeyboard: false, + title: 'Insufficient privileges', + message: data.info.toString(), + buttons: [{ + label: 'Login', + action: function(dialog) { + dialog.close(); + angular.element('#loginModal').modal({ + show: 'true' + }); + } + }, { + label: 'Cancel', + action: function(dialog) { + dialog.close(); + $location.path('/'); + } + }] + }); + } else if (op === 'PARAGRAPH') { + $rootScope.$broadcast('updateParagraph', data); + } else if (op === 'PARAGRAPH_APPEND_OUTPUT') { + $rootScope.$broadcast('appendParagraphOutput', data); + } else if (op === 'PARAGRAPH_UPDATE_OUTPUT') { + $rootScope.$broadcast('updateParagraphOutput', data); + } else if (op === 'PROGRESS') { + $rootScope.$broadcast('updateProgress', data); + } else if (op === 'COMPLETION_LIST') { + $rootScope.$broadcast('completionList', data); + } else if (op === 'EDITOR_SETTING') { + $rootScope.$broadcast('editorSetting', data); + } else if (op === 'ANGULAR_OBJECT_UPDATE') { + $rootScope.$broadcast('angularObjectUpdate', data); + } else if (op === 'ANGULAR_OBJECT_REMOVE') { + $rootScope.$broadcast('angularObjectRemove', data); + } else if (op === 'APP_APPEND_OUTPUT') { + $rootScope.$broadcast('appendAppOutput', data); + } else if (op === 'APP_UPDATE_OUTPUT') { + $rootScope.$broadcast('updateAppOutput', data); + } else if (op === 'APP_LOAD') { + $rootScope.$broadcast('appLoad', data); + } else if (op === 'APP_STATUS_CHANGE') { + $rootScope.$broadcast('appStatusChange', data); + } else if (op === 'LIST_REVISION_HISTORY') { + $rootScope.$broadcast('listRevisionHistory', data); + } else if (op === 'NOTE_REVISION') { + $rootScope.$broadcast('noteRevision', data); + } else if (op === 'INTERPRETER_BINDINGS') { + $rootScope.$broadcast('interpreterBindings', data); + } else if (op === 'ERROR_INFO') { + BootstrapDialog.show({ + closable: false, + closeByBackdrop: false, + closeByKeyboard: false, + title: 'Details', + message: data.info.toString(), + buttons: [{ + // close all the dialogs when there are error on running all paragraphs + label: 'Close', + action: function() { + BootstrapDialog.closeAll(); + } + }] + }); + } else if (op === 'CONFIGURATIONS_INFO') { + $rootScope.$broadcast('configurationsInfo', data); + } + }); - return websocketCalls; -}); + websocketCalls.ws.onError(function(event) { + console.log('error message: ', event); + $rootScope.$broadcast('setConnectedStatus', false); + }); + + websocketCalls.ws.onClose(function(event) { + console.log('close message: ', event); + $rootScope.$broadcast('setConnectedStatus', false); + }); + + return websocketCalls; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/components/websocketEvents/websocketMsg.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/websocketEvents/websocketMsg.service.js b/zeppelin-web/src/components/websocketEvents/websocketMsg.service.js index 6a27475..b163a8e 100644 --- a/zeppelin-web/src/components/websocketEvents/websocketMsg.service.js +++ b/zeppelin-web/src/components/websocketEvents/websocketMsg.service.js @@ -12,215 +12,220 @@ * limitations under the License. */ 'use strict'; - -angular.module('zeppelinWebApp').service('websocketMsgSrv', function($rootScope, websocketEvents) { - - return { - - getHomeNotebook: function() { - websocketEvents.sendNewEvent({op: 'GET_HOME_NOTE'}); - }, - - createNotebook: function(noteName) { - websocketEvents.sendNewEvent({op: 'NEW_NOTE',data: {name: noteName}}); - }, - - deleteNotebook: function(noteId) { - websocketEvents.sendNewEvent({op: 'DEL_NOTE', data: {id: noteId}}); - }, - - cloneNotebook: function(noteIdToClone, newNoteName) { - websocketEvents.sendNewEvent({op: 'CLONE_NOTE', data: {id: noteIdToClone, name: newNoteName}}); - }, - - getNotebookList: function() { - websocketEvents.sendNewEvent({op: 'LIST_NOTES'}); - }, - - reloadAllNotesFromRepo: function() { - websocketEvents.sendNewEvent({op: 'RELOAD_NOTES_FROM_REPO'}); - }, - - getNotebook: function(noteId) { - websocketEvents.sendNewEvent({op: 'GET_NOTE', data: {id: noteId}}); - }, - - updateNotebook: function(noteId, noteName, noteConfig) { - websocketEvents.sendNewEvent({op: 'NOTE_UPDATE', data: {id: noteId, name: noteName, config: noteConfig}}); - }, - - moveParagraph: function(paragraphId, newIndex) { - websocketEvents.sendNewEvent({op: 'MOVE_PARAGRAPH', data: {id: paragraphId, index: newIndex}}); - }, - - insertParagraph: function(newIndex) { - websocketEvents.sendNewEvent({op: 'INSERT_PARAGRAPH', data: {index: newIndex}}); - }, - - updateAngularObject: function(noteId, paragraphId, name, value, interpreterGroupId) { - websocketEvents.sendNewEvent({ - op: 'ANGULAR_OBJECT_UPDATED', - data: { - noteId: noteId, - paragraphId: paragraphId, - name: name, - value: value, - interpreterGroupId: interpreterGroupId - } - }); - }, - - clientBindAngularObject: function(noteId, name, value, paragraphId) { - websocketEvents.sendNewEvent({ - op: 'ANGULAR_OBJECT_CLIENT_BIND', - data: { - noteId: noteId, - name: name, - value: value, - paragraphId: paragraphId - } - }); - }, - - clientUnbindAngularObject: function(noteId, name, paragraphId) { - websocketEvents.sendNewEvent({ - op: 'ANGULAR_OBJECT_CLIENT_UNBIND', - data: { - noteId: noteId, - name: name, - paragraphId: paragraphId - } - }); - }, - - cancelParagraphRun: function(paragraphId) { - websocketEvents.sendNewEvent({op: 'CANCEL_PARAGRAPH', data: {id: paragraphId}}); - }, - - runParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { - websocketEvents.sendNewEvent({ - op: 'RUN_PARAGRAPH', - data: { - id: paragraphId, - title: paragraphTitle, - paragraph: paragraphData, - config: paragraphConfig, - params: paragraphParams - } - }); - }, - - removeParagraph: function(paragraphId) { - websocketEvents.sendNewEvent({op: 'PARAGRAPH_REMOVE', data: {id: paragraphId}}); - }, - - clearParagraphOutput: function(paragraphId) { - websocketEvents.sendNewEvent({op: 'PARAGRAPH_CLEAR_OUTPUT', data: {id: paragraphId}}); - }, - - completion: function(paragraphId, buf, cursor) { - websocketEvents.sendNewEvent({ - op: 'COMPLETION', - data: { - id: paragraphId, - buf: buf, - cursor: cursor - } - }); - }, - - commitParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { - websocketEvents.sendNewEvent({ - op: 'COMMIT_PARAGRAPH', - data: { - id: paragraphId, - title: paragraphTitle, - paragraph: paragraphData, - config: paragraphConfig, - params: paragraphParams - } - }); - }, - - importNotebook: function(notebook) { - websocketEvents.sendNewEvent({ - op: 'IMPORT_NOTE', - data: { - notebook: notebook - } - }); - }, - - checkpointNotebook: function(noteId, commitMessage) { - websocketEvents.sendNewEvent({ - op: 'CHECKPOINT_NOTEBOOK', - data: { - noteId: noteId, - commitMessage: commitMessage - } - }); - }, - - listRevisionHistory: function(noteId) { - websocketEvents.sendNewEvent({ - op: 'LIST_REVISION_HISTORY', - data: { - noteId: noteId - } - }); - }, - - getNoteByRevision: function(noteId, revisionId) { - websocketEvents.sendNewEvent({ - op: 'NOTE_REVISION', - data: { - noteId: noteId, - revisionId: revisionId - } - }); - }, - - getEditorSetting: function(paragraphId, replName) { - websocketEvents.sendNewEvent({ - op: 'EDITOR_SETTING', - data: { - paragraphId: paragraphId, - magic: replName - } - }); - }, - - isConnected: function() { - return websocketEvents.isConnected(); - }, - - getNotebookJobsList: function() { - websocketEvents.sendNewEvent({op: 'LIST_NOTEBOOK_JOBS'}); - }, - - getUpdateNotebookJobsList: function(lastUpdateServerUnixTime) { - websocketEvents.sendNewEvent( - {op: 'LIST_UPDATE_NOTEBOOK_JOBS', data: {lastUpdateUnixTime: lastUpdateServerUnixTime * 1}} - ); - }, - - unsubscribeJobManager: function() { - websocketEvents.sendNewEvent({op: 'UNSUBSCRIBE_UPDATE_NOTEBOOK_JOBS'}); - }, - - getInterpreterBindings: function(noteID) { - websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_BINDINGS', data: {noteID: noteID}}); - }, - - saveInterpreterBindings: function(noteID, selectedSettingIds) { - websocketEvents.sendNewEvent({op: 'SAVE_INTERPRETER_BINDINGS', - data: {noteID: noteID, selectedSettingIds: selectedSettingIds}}); - }, - - listConfigurations: function() { - websocketEvents.sendNewEvent({op: 'LIST_CONFIGURATIONS'}); - } - - }; - -}); +(function() { + + angular.module('zeppelinWebApp').service('websocketMsgSrv', websocketMsgSrv); + + websocketMsgSrv.$inject = ['$rootScope', 'websocketEvents']; + + function websocketMsgSrv($rootScope, websocketEvents) { + return { + + getHomeNotebook: function() { + websocketEvents.sendNewEvent({op: 'GET_HOME_NOTE'}); + }, + + createNotebook: function(noteName) { + websocketEvents.sendNewEvent({op: 'NEW_NOTE',data: {name: noteName}}); + }, + + deleteNotebook: function(noteId) { + websocketEvents.sendNewEvent({op: 'DEL_NOTE', data: {id: noteId}}); + }, + + cloneNotebook: function(noteIdToClone, newNoteName) { + websocketEvents.sendNewEvent({op: 'CLONE_NOTE', data: {id: noteIdToClone, name: newNoteName}}); + }, + + getNotebookList: function() { + websocketEvents.sendNewEvent({op: 'LIST_NOTES'}); + }, + + reloadAllNotesFromRepo: function() { + websocketEvents.sendNewEvent({op: 'RELOAD_NOTES_FROM_REPO'}); + }, + + getNotebook: function(noteId) { + websocketEvents.sendNewEvent({op: 'GET_NOTE', data: {id: noteId}}); + }, + + updateNotebook: function(noteId, noteName, noteConfig) { + websocketEvents.sendNewEvent({op: 'NOTE_UPDATE', data: {id: noteId, name: noteName, config: noteConfig}}); + }, + + moveParagraph: function(paragraphId, newIndex) { + websocketEvents.sendNewEvent({op: 'MOVE_PARAGRAPH', data: {id: paragraphId, index: newIndex}}); + }, + + insertParagraph: function(newIndex) { + websocketEvents.sendNewEvent({op: 'INSERT_PARAGRAPH', data: {index: newIndex}}); + }, + + updateAngularObject: function(noteId, paragraphId, name, value, interpreterGroupId) { + websocketEvents.sendNewEvent({ + op: 'ANGULAR_OBJECT_UPDATED', + data: { + noteId: noteId, + paragraphId: paragraphId, + name: name, + value: value, + interpreterGroupId: interpreterGroupId + } + }); + }, + + clientBindAngularObject: function(noteId, name, value, paragraphId) { + websocketEvents.sendNewEvent({ + op: 'ANGULAR_OBJECT_CLIENT_BIND', + data: { + noteId: noteId, + name: name, + value: value, + paragraphId: paragraphId + } + }); + }, + + clientUnbindAngularObject: function(noteId, name, paragraphId) { + websocketEvents.sendNewEvent({ + op: 'ANGULAR_OBJECT_CLIENT_UNBIND', + data: { + noteId: noteId, + name: name, + paragraphId: paragraphId + } + }); + }, + + cancelParagraphRun: function(paragraphId) { + websocketEvents.sendNewEvent({op: 'CANCEL_PARAGRAPH', data: {id: paragraphId}}); + }, + + runParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { + websocketEvents.sendNewEvent({ + op: 'RUN_PARAGRAPH', + data: { + id: paragraphId, + title: paragraphTitle, + paragraph: paragraphData, + config: paragraphConfig, + params: paragraphParams + } + }); + }, + + removeParagraph: function(paragraphId) { + websocketEvents.sendNewEvent({op: 'PARAGRAPH_REMOVE', data: {id: paragraphId}}); + }, + + clearParagraphOutput: function(paragraphId) { + websocketEvents.sendNewEvent({op: 'PARAGRAPH_CLEAR_OUTPUT', data: {id: paragraphId}}); + }, + + completion: function(paragraphId, buf, cursor) { + websocketEvents.sendNewEvent({ + op: 'COMPLETION', + data: { + id: paragraphId, + buf: buf, + cursor: cursor + } + }); + }, + + commitParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { + websocketEvents.sendNewEvent({ + op: 'COMMIT_PARAGRAPH', + data: { + id: paragraphId, + title: paragraphTitle, + paragraph: paragraphData, + config: paragraphConfig, + params: paragraphParams + } + }); + }, + + importNotebook: function(notebook) { + websocketEvents.sendNewEvent({ + op: 'IMPORT_NOTE', + data: { + notebook: notebook + } + }); + }, + + checkpointNotebook: function(noteId, commitMessage) { + websocketEvents.sendNewEvent({ + op: 'CHECKPOINT_NOTEBOOK', + data: { + noteId: noteId, + commitMessage: commitMessage + } + }); + }, + + listRevisionHistory: function(noteId) { + websocketEvents.sendNewEvent({ + op: 'LIST_REVISION_HISTORY', + data: { + noteId: noteId + } + }); + }, + + getNoteByRevision: function(noteId, revisionId) { + websocketEvents.sendNewEvent({ + op: 'NOTE_REVISION', + data: { + noteId: noteId, + revisionId: revisionId + } + }); + }, + + getEditorSetting: function(paragraphId, replName) { + websocketEvents.sendNewEvent({ + op: 'EDITOR_SETTING', + data: { + paragraphId: paragraphId, + magic: replName + } + }); + }, + + isConnected: function() { + return websocketEvents.isConnected(); + }, + + getNotebookJobsList: function() { + websocketEvents.sendNewEvent({op: 'LIST_NOTEBOOK_JOBS'}); + }, + + getUpdateNotebookJobsList: function(lastUpdateServerUnixTime) { + websocketEvents.sendNewEvent( + {op: 'LIST_UPDATE_NOTEBOOK_JOBS', data: {lastUpdateUnixTime: lastUpdateServerUnixTime * 1}} + ); + }, + + unsubscribeJobManager: function() { + websocketEvents.sendNewEvent({op: 'UNSUBSCRIBE_UPDATE_NOTEBOOK_JOBS'}); + }, + + getInterpreterBindings: function(noteID) { + websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_BINDINGS', data: {noteID: noteID}}); + }, + + saveInterpreterBindings: function(noteID, selectedSettingIds) { + websocketEvents.sendNewEvent({op: 'SAVE_INTERPRETER_BINDINGS', + data: {noteID: noteID, selectedSettingIds: selectedSettingIds}}); + }, + + listConfigurations: function() { + websocketEvents.sendNewEvent({op: 'LIST_CONFIGURATIONS'}); + } + + }; + } + +})(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a9e7bc38/zeppelin-web/src/index.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html index 9b04955..b5521be 100644 --- a/zeppelin-web/src/index.html +++ b/zeppelin-web/src/index.html @@ -171,6 +171,7 @@ limitations under the License. <script src="components/noteName-create/notename.controller.js"></script> <script src="components/noteName-import/notenameImport.controller.js"></script> <script src="components/popover-html-unsafe/popover-html-unsafe.directive.js"></script> + <script src="components/popover-html-unsafe/popover-html-unsafe-popup.directive.js"></script> <script src="components/ngenter/ngenter.directive.js"></script> <script src="components/dropdowninput/dropdowninput.directive.js"></script> <script src="components/resizable/resizable.directive.js"></script>