Repository: zeppelin Updated Branches: refs/heads/master 13aabe3e4 -> 19b0f30f8
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/components/ngenter/ngenter.directive.test.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/ngenter/ngenter.directive.test.js b/zeppelin-web/src/components/ngenter/ngenter.directive.test.js index d347155..49f97cc 100644 --- a/zeppelin-web/src/components/ngenter/ngenter.directive.test.js +++ b/zeppelin-web/src/components/ngenter/ngenter.directive.test.js @@ -1,25 +1,24 @@ -describe('Directive: ngEnter', function() { - +describe('Directive: ngEnter', function () { // load the directive's module - beforeEach(angular.mock.module('zeppelinWebApp')); + beforeEach(angular.mock.module('zeppelinWebApp')) - var element; - var scope; + let element + let scope - beforeEach(inject(function($rootScope) { - scope = $rootScope.$new(); - })); + beforeEach(inject(function ($rootScope) { + scope = $rootScope.$new() + })) - it('should be define', inject(function($compile) { - element = angular.element('<ng-enter></ng-enter>'); - element = $compile(element)(scope); - expect(element.text()).toBeDefined(); - })); + it('should be define', inject(function ($compile) { + element = angular.element('<ng-enter></ng-enter>') + element = $compile(element)(scope) + expect(element.text()).toBeDefined() + })) - //Test the rest of function in ngEnter + // Test the rest of function in ngEnter /* it('should make hidden element visible', inject(function ($compile) { element = angular.element('<ng-enter></ng-enter>'); element = $compile(element)(scope); expect(element.text()).toBe('this is the ngEnter directive'); - }));*/ -}); + })); */ +}) http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 4c404aa..b52a7a7 100644 --- a/zeppelin-web/src/components/ngescape/ngescape.directive.js +++ b/zeppelin-web/src/components/ngescape/ngescape.directive.js @@ -12,18 +12,17 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').directive('ngEscape', ngEscape); +angular.module('zeppelinWebApp').directive('ngEscape', ngEscape) -function ngEscape() { - return function(scope, element, attrs) { - element.bind('keydown keyup', function(event) { +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(); + scope.$apply(function () { + scope.$eval(attrs.ngEscape) + }) + event.preventDefault() } - }); - }; + }) + } } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/components/noteAction/noteAction.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/noteAction/noteAction.service.js b/zeppelin-web/src/components/noteAction/noteAction.service.js index e08a6c3..f925975 100644 --- a/zeppelin-web/src/components/noteAction/noteAction.service.js +++ b/zeppelin-web/src/components/noteAction/noteAction.service.js @@ -12,172 +12,172 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').service('noteActionSrv', noteActionSrv); +angular.module('zeppelinWebApp').service('noteActionSrv', noteActionSrv) -function noteActionSrv(websocketMsgSrv, $location, renameSrv, noteListDataFactory) { - 'ngInject'; +function noteActionSrv (websocketMsgSrv, $location, renameSrv, noteListDataFactory) { + 'ngInject' - this.moveNoteToTrash = function(noteId, redirectToHome) { + this.moveNoteToTrash = function (noteId, redirectToHome) { BootstrapDialog.confirm({ closable: true, title: 'Move this note to trash?', message: 'This note will be moved to <strong>trash</strong>.', - callback: function(result) { + callback: function (result) { if (result) { - websocketMsgSrv.moveNoteToTrash(noteId); + websocketMsgSrv.moveNoteToTrash(noteId) if (redirectToHome) { - $location.path('/'); + $location.path('/') } } } - }); - }; + }) + } - this.moveFolderToTrash = function(folderId) { + this.moveFolderToTrash = function (folderId) { BootstrapDialog.confirm({ closable: true, title: 'Move this folder to trash?', message: 'This folder will be moved to <strong>trash</strong>.', - callback: function(result) { + callback: function (result) { if (result) { - websocketMsgSrv.moveFolderToTrash(folderId); + websocketMsgSrv.moveFolderToTrash(folderId) } } - }); - }; + }) + } - this.removeNote = function(noteId, redirectToHome) { + this.removeNote = function (noteId, redirectToHome) { BootstrapDialog.confirm({ type: BootstrapDialog.TYPE_WARNING, closable: true, title: 'WARNING! This note will be removed permanently', message: 'This cannot be undone. Are you sure?', - callback: function(result) { + callback: function (result) { if (result) { - websocketMsgSrv.deleteNote(noteId); + websocketMsgSrv.deleteNote(noteId) if (redirectToHome) { - $location.path('/'); + $location.path('/') } } } - }); - }; + }) + } - this.removeFolder = function(folderId) { + this.removeFolder = function (folderId) { BootstrapDialog.confirm({ type: BootstrapDialog.TYPE_WARNING, closable: true, title: 'WARNING! This folder will be removed permanently', message: 'This cannot be undone. Are you sure?', - callback: function(result) { + callback: function (result) { if (result) { - websocketMsgSrv.removeFolder(folderId); + websocketMsgSrv.removeFolder(folderId) } } - }); - }; + }) + } - this.restoreAll = function() { + this.restoreAll = function () { BootstrapDialog.confirm({ closable: true, title: 'Are you sure want to restore all notes in the trash?', message: 'Folders and notes in the trash will be ' + '<strong>merged</strong> into their original position.', - callback: function(result) { + callback: function (result) { if (result) { - websocketMsgSrv.restoreAll(); + websocketMsgSrv.restoreAll() } } - }); - }; + }) + } - this.emptyTrash = function() { + this.emptyTrash = function () { BootstrapDialog.confirm({ type: BootstrapDialog.TYPE_WARNING, closable: true, title: 'WARNING! Notes under trash will be removed permanently', message: 'This cannot be undone. Are you sure?', - callback: function(result) { + callback: function (result) { if (result) { - websocketMsgSrv.emptyTrash(); + websocketMsgSrv.emptyTrash() } } - }); - }; + }) + } - this.clearAllParagraphOutput = function(noteId) { + this.clearAllParagraphOutput = function (noteId) { BootstrapDialog.confirm({ closable: true, title: '', message: 'Do you want to clear all output?', - callback: function(result) { + callback: function (result) { if (result) { - websocketMsgSrv.clearAllParagraphOutput(noteId); + websocketMsgSrv.clearAllParagraphOutput(noteId) } } - }); - }; + }) + } - this.renameNote = function(noteId, notePath) { + this.renameNote = function (noteId, notePath) { renameSrv.openRenameModal({ title: 'Rename note', oldName: notePath, - callback: function(newName) { - websocketMsgSrv.renameNote(noteId, newName); + callback: function (newName) { + websocketMsgSrv.renameNote(noteId, newName) } - }); - }; + }) + } - this.renameFolder = function(folderId) { + this.renameFolder = function (folderId) { renameSrv.openRenameModal({ title: 'Rename folder', oldName: folderId, - callback: function(newName) { - var newFolderId = normalizeFolderId(newName); + callback: function (newName) { + let newFolderId = normalizeFolderId(newName) if (_.has(noteListDataFactory.flatFolderMap, newFolderId)) { BootstrapDialog.confirm({ type: BootstrapDialog.TYPE_WARNING, closable: true, title: 'WARNING! The folder will be MERGED', message: 'The folder will be merged into <strong>' + newFolderId + '</strong>. Are you sure?', - callback: function(result) { + callback: function (result) { if (result) { - websocketMsgSrv.renameFolder(folderId, newFolderId); + websocketMsgSrv.renameFolder(folderId, newFolderId) } } - }); + }) } else { - websocketMsgSrv.renameFolder(folderId, newFolderId); + websocketMsgSrv.renameFolder(folderId, newFolderId) } } - }); - }; + }) + } - function normalizeFolderId(folderId) { - folderId = folderId.trim(); + function normalizeFolderId (folderId) { + folderId = folderId.trim() while (folderId.indexOf('\\') > -1) { - folderId = folderId.replace('\\', '/'); + folderId = folderId.replace('\\', '/') } while (folderId.indexOf('///') > -1) { - folderId = folderId.replace('///', '/'); + folderId = folderId.replace('///', '/') } - folderId = folderId.replace('//', '/'); + folderId = folderId.replace('//', '/') if (folderId === '/') { - return '/'; + return '/' } if (folderId[0] === '/') { - folderId = folderId.substring(1); + folderId = folderId.substring(1) } if (folderId.slice(-1) === '/') { - folderId = folderId.slice(0, -1); + folderId = folderId.slice(0, -1) } - return folderId; + return folderId } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.js b/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.js index f92bfaf..ab6956a 100644 --- a/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.js +++ b/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.js @@ -12,71 +12,70 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').factory('noteListDataFactory', noteListDataFactory); +angular.module('zeppelinWebApp').factory('noteListDataFactory', noteListDataFactory) -function noteListDataFactory(TRASH_FOLDER_ID) { - 'ngInject'; +function noteListDataFactory (TRASH_FOLDER_ID) { + 'ngInject' - var notes = { + const notes = { root: {children: []}, flatList: [], flatFolderMap: {}, - setNotes: function(notesList) { + setNotes: function (notesList) { // a flat list to boost searching notes.flatList = _.map(notesList, (note) => { - note.isTrash = note.name ? - note.name.split('/')[0] === TRASH_FOLDER_ID : false; - return note; - }); + note.isTrash = note.name + ? note.name.split('/')[0] === TRASH_FOLDER_ID : false + return note + }) // construct the folder-based tree - notes.root = {children: []}; - notes.flatFolderMap = {}; - _.reduce(notesList, function(root, note) { - var noteName = note.name || note.id; - var nodes = noteName.match(/([^\/][^\/]*)/g); + notes.root = {children: []} + notes.flatFolderMap = {} + _.reduce(notesList, function (root, note) { + let noteName = note.name || note.id + let nodes = noteName.match(/([^\/][^\/]*)/g) // recursively add nodes - addNode(root, nodes, note.id); + addNode(root, nodes, note.id) - return root; - }, notes.root); + return root + }, notes.root) } - }; + } - var addNode = function(curDir, nodes, noteId) { + const addNode = function (curDir, nodes, noteId) { if (nodes.length === 1) { // the leaf curDir.children.push({ name: nodes[0], id: noteId, path: curDir.id ? curDir.id + '/' + nodes[0] : nodes[0], isTrash: curDir.id ? curDir.id.split('/')[0] === TRASH_FOLDER_ID : false - }); + }) } else { // a folder node - var node = nodes.shift(); - var dir = _.find(curDir.children, - function(c) {return c.name === node && c.children !== undefined;}); + let node = nodes.shift() + let dir = _.find(curDir.children, + function (c) { return c.name === node && c.children !== undefined }) if (dir !== undefined) { // found an existing dir - addNode(dir, nodes, noteId); + addNode(dir, nodes, noteId) } else { - var newDir = { + let newDir = { id: curDir.id ? curDir.id + '/' + node : node, name: node, hidden: true, children: [], isTrash: curDir.id ? curDir.id.split('/')[0] === TRASH_FOLDER_ID : false - }; + } // add the folder to flat folder map - notes.flatFolderMap[newDir.id] = newDir; + notes.flatFolderMap[newDir.id] = newDir - curDir.children.push(newDir); - addNode(newDir, nodes, noteId); + curDir.children.push(newDir) + addNode(newDir, nodes, noteId) } } - }; + } - return notes; + return notes } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.test.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.test.js b/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.test.js index 85fb2ba..d1acc5d 100644 --- a/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.test.js +++ b/zeppelin-web/src/components/noteListDataFactory/noteList.datafactory.test.js @@ -1,17 +1,16 @@ -describe('Factory: NoteList', function() { +describe('Factory: NoteList', function () { + let noteList - var noteList; + beforeEach(function () { + angular.mock.module('zeppelinWebApp') - beforeEach(function() { - angular.mock.module('zeppelinWebApp'); + inject(function ($injector) { + noteList = $injector.get('noteListDataFactory') + }) + }) - inject(function($injector) { - noteList = $injector.get('noteListDataFactory'); - }); - }); - - it('should generate both flat list and folder-based list properly', function() { - var notesList = [ + it('should generate both flat list and folder-based list properly', function () { + let notesList = [ {name: 'A', id: '000001'}, {name: 'B', id: '000002'}, {id: '000003'}, // note without name @@ -21,57 +20,56 @@ describe('Factory: NoteList', function() { {name: '/C/CB/CBA', id: '000007'}, // same name with another note {name: 'C///CB//CBB', id: '000008'}, {name: 'D/D[A/DA]B', id: '000009'} // check if '[' and ']' considered as folder seperator - ]; - noteList.setNotes(notesList); - - var flatList = noteList.flatList; - expect(flatList.length).toBe(9); - expect(flatList[0].name).toBe('A'); - expect(flatList[0].id).toBe('000001'); - expect(flatList[1].name).toBe('B'); - expect(flatList[2].name).toBeUndefined(); - expect(flatList[3].name).toBe('/C/CA'); - expect(flatList[4].name).toBe('/C/CB'); - expect(flatList[5].name).toBe('/C/CB/CBA'); - expect(flatList[6].name).toBe('/C/CB/CBA'); - expect(flatList[7].name).toBe('C///CB//CBB'); - expect(flatList[8].name).toBe('D/D[A/DA]B'); + ] + noteList.setNotes(notesList) - var folderList = noteList.root.children; - expect(folderList.length).toBe(5); - expect(folderList[0].name).toBe('A'); - expect(folderList[0].id).toBe('000001'); - expect(folderList[1].name).toBe('B'); - expect(folderList[2].name).toBe('000003'); - expect(folderList[3].name).toBe('C'); - expect(folderList[3].id).toBe('C'); - expect(folderList[3].children.length).toBe(3); - expect(folderList[3].children[0].name).toBe('CA'); - expect(folderList[3].children[0].id).toBe('000004'); - expect(folderList[3].children[0].children).toBeUndefined(); - expect(folderList[3].children[1].name).toBe('CB'); - expect(folderList[3].children[1].id).toBe('000005'); - expect(folderList[3].children[1].children).toBeUndefined(); - expect(folderList[3].children[2].name).toBe('CB'); - expect(folderList[3].children[2].id).toBe('C/CB'); - expect(folderList[3].children[2].children.length).toBe(3); - expect(folderList[3].children[2].children[0].name).toBe('CBA'); - expect(folderList[3].children[2].children[0].id).toBe('000006'); - expect(folderList[3].children[2].children[0].children).toBeUndefined(); - expect(folderList[3].children[2].children[1].name).toBe('CBA'); - expect(folderList[3].children[2].children[1].id).toBe('000007'); - expect(folderList[3].children[2].children[1].children).toBeUndefined(); - expect(folderList[3].children[2].children[2].name).toBe('CBB'); - expect(folderList[3].children[2].children[2].id).toBe('000008'); - expect(folderList[3].children[2].children[2].children).toBeUndefined(); - expect(folderList[4].name).toBe('D'); - expect(folderList[4].id).toBe('D'); - expect(folderList[4].children.length).toBe(1); - expect(folderList[4].children[0].name).toBe('D[A'); - expect(folderList[4].children[0].id).toBe('D/D[A'); - expect(folderList[4].children[0].children[0].name).toBe('DA]B'); - expect(folderList[4].children[0].children[0].id).toBe('000009'); - expect(folderList[4].children[0].children[0].children).toBeUndefined(); - }); + let flatList = noteList.flatList + expect(flatList.length).toBe(9) + expect(flatList[0].name).toBe('A') + expect(flatList[0].id).toBe('000001') + expect(flatList[1].name).toBe('B') + expect(flatList[2].name).toBeUndefined() + expect(flatList[3].name).toBe('/C/CA') + expect(flatList[4].name).toBe('/C/CB') + expect(flatList[5].name).toBe('/C/CB/CBA') + expect(flatList[6].name).toBe('/C/CB/CBA') + expect(flatList[7].name).toBe('C///CB//CBB') + expect(flatList[8].name).toBe('D/D[A/DA]B') -}); + let folderList = noteList.root.children + expect(folderList.length).toBe(5) + expect(folderList[0].name).toBe('A') + expect(folderList[0].id).toBe('000001') + expect(folderList[1].name).toBe('B') + expect(folderList[2].name).toBe('000003') + expect(folderList[3].name).toBe('C') + expect(folderList[3].id).toBe('C') + expect(folderList[3].children.length).toBe(3) + expect(folderList[3].children[0].name).toBe('CA') + expect(folderList[3].children[0].id).toBe('000004') + expect(folderList[3].children[0].children).toBeUndefined() + expect(folderList[3].children[1].name).toBe('CB') + expect(folderList[3].children[1].id).toBe('000005') + expect(folderList[3].children[1].children).toBeUndefined() + expect(folderList[3].children[2].name).toBe('CB') + expect(folderList[3].children[2].id).toBe('C/CB') + expect(folderList[3].children[2].children.length).toBe(3) + expect(folderList[3].children[2].children[0].name).toBe('CBA') + expect(folderList[3].children[2].children[0].id).toBe('000006') + expect(folderList[3].children[2].children[0].children).toBeUndefined() + expect(folderList[3].children[2].children[1].name).toBe('CBA') + expect(folderList[3].children[2].children[1].id).toBe('000007') + expect(folderList[3].children[2].children[1].children).toBeUndefined() + expect(folderList[3].children[2].children[2].name).toBe('CBB') + expect(folderList[3].children[2].children[2].id).toBe('000008') + expect(folderList[3].children[2].children[2].children).toBeUndefined() + expect(folderList[4].name).toBe('D') + expect(folderList[4].id).toBe('D') + expect(folderList[4].children.length).toBe(1) + expect(folderList[4].children[0].name).toBe('D[A') + expect(folderList[4].children[0].id).toBe('D/D[A') + expect(folderList[4].children[0].children[0].name).toBe('DA]B') + expect(folderList[4].children[0].children[0].id).toBe('000009') + expect(folderList[4].children[0].children[0].children).toBeUndefined() + }) +}) http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 865d653..815e9d5 100644 --- a/zeppelin-web/src/components/noteName-create/notename.controller.js +++ b/zeppelin-web/src/components/noteName-create/notename.controller.js @@ -12,96 +12,93 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').controller('NotenameCtrl', NotenameCtrl); +angular.module('zeppelinWebApp').controller('NotenameCtrl', NotenameCtrl) -function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv) { - 'ngInject'; +function NotenameCtrl ($scope, noteListDataFactory, $routeParams, websocketMsgSrv) { + 'ngInject' - var vm = this; - vm.clone = false; - vm.notes = noteListDataFactory; - vm.websocketMsgSrv = websocketMsgSrv; - $scope.note = {}; - $scope.interpreterSettings = {}; - $scope.note.defaultInterpreter = null; + let vm = this + vm.clone = false + vm.notes = noteListDataFactory + vm.websocketMsgSrv = websocketMsgSrv + $scope.note = {} + $scope.interpreterSettings = {} + $scope.note.defaultInterpreter = null - vm.createNote = function() { + vm.createNote = function () { if (!vm.clone) { - var defaultInterpreterId = ''; + let defaultInterpreterId = '' if ($scope.note.defaultInterpreter !== null) { - defaultInterpreterId = $scope.note.defaultInterpreter.id; + defaultInterpreterId = $scope.note.defaultInterpreter.id } - vm.websocketMsgSrv.createNotebook($scope.note.notename, defaultInterpreterId); - $scope.note.defaultInterpreter = $scope.interpreterSettings[0]; + vm.websocketMsgSrv.createNotebook($scope.note.notename, defaultInterpreterId) + $scope.note.defaultInterpreter = $scope.interpreterSettings[0] } else { - var noteId = $routeParams.noteId; - vm.websocketMsgSrv.cloneNote(noteId, $scope.note.notename); + let noteId = $routeParams.noteId + vm.websocketMsgSrv.cloneNote(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, path) { - vm.clone = clone; - vm.sourceNoteName = sourceNoteName; - $scope.note.notename = vm.clone ? vm.cloneNoteName() : vm.newNoteName(path); - $scope.$apply(); - }; + vm.clone = clone + vm.sourceNoteName = sourceNoteName + $scope.note.notename = vm.clone ? vm.cloneNoteName() : vm.newNoteName(path) + $scope.$apply() + } vm.newNoteName = function(path) { - var newCount = 1; - angular.forEach(vm.notes.flatList, function(noteName) { - noteName = noteName.name; + let 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; + let lastCount = noteName.substr(14) * 1 if (newCount <= lastCount) { - newCount = lastCount + 1; + newCount = lastCount + 1 } } - }); - return (path ? path + '/' : '') +'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 + ' .+'); - - angular.forEach(vm.notes.flatList, function(noteName) { - noteName = noteName.name; + }) + return (path ? path + '/' : '') + 'Untitled Note ' + newCount + } + + vm.cloneNoteName = function () { + let copyCount = 1 + let newCloneName = '' + let lastIndex = vm.sourceNoteName.lastIndexOf(' ') + let endsWithNumber = !!vm.sourceNoteName.match('^.+?\\s\\d$') + let noteNamePrefix = endsWithNumber ? vm.sourceNoteName.substr(0, lastIndex) : vm.sourceNoteName + let 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); + let lastCopyCount = noteName.substr(lastIndex).trim() + newCloneName = noteNamePrefix + lastCopyCount = parseInt(lastCopyCount) if (copyCount <= lastCopyCount) { - copyCount = lastCopyCount + 1; + copyCount = lastCopyCount + 1 } } - }); + }) if (!newCloneName) { - newCloneName = vm.sourceNoteName; + newCloneName = vm.sourceNoteName } - return newCloneName + ' ' + copyCount; - }; - - vm.getInterpreterSettings = function() { - vm.websocketMsgSrv.getInterpreterSettings(); - }; + return newCloneName + ' ' + copyCount + } + vm.getInterpreterSettings = function () { + vm.websocketMsgSrv.getInterpreterSettings() + } - $scope.$on('interpreterSettings', function(event, data) { - $scope.interpreterSettings = data.interpreterSettings; - - //initialize default interpreter with Spark interpreter - $scope.note.defaultInterpreter = data.interpreterSettings[0]; - }); + $scope.$on('interpreterSettings', function (event, data) { + $scope.interpreterSettings = data.interpreterSettings + // initialize default interpreter with Spark interpreter + $scope.note.defaultInterpreter = data.interpreterSettings[0] + }) } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/components/noteName-create/notename.controller.test.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/noteName-create/notename.controller.test.js b/zeppelin-web/src/components/noteName-create/notename.controller.test.js index 47e79c1..61bce14 100644 --- a/zeppelin-web/src/components/noteName-create/notename.controller.test.js +++ b/zeppelin-web/src/components/noteName-create/notename.controller.test.js @@ -1,40 +1,39 @@ -describe('Controller: NotenameCtrl', function() { - beforeEach(angular.mock.module('zeppelinWebApp')); +describe('Controller: NotenameCtrl', function () { + beforeEach(angular.mock.module('zeppelinWebApp')) - var scope; - var ctrl; - var noteList; + let scope + let ctrl + let noteList - beforeEach(inject(function($injector, $rootScope, $controller) { - noteList = $injector.get('noteListDataFactory'); - scope = $rootScope.$new(); + beforeEach(inject(function ($injector, $rootScope, $controller) { + noteList = $injector.get('noteListDataFactory') + scope = $rootScope.$new() ctrl = $controller('NotenameCtrl', { $scope: scope, noteListDataFactory: noteList - }); - })); + }) + })) - it('should create a new name from current name when cloneNoteName is called', function() { - var notesList = [ + it('should create a new name from current name when cloneNoteName is called', function () { + let notesList = [ {name: 'dsds 1', id: '1'}, {name: 'dsds 2', id: '2'}, {name: 'test name', id: '3'}, {name: 'aa bb cc', id: '4'}, {name: 'Untitled Note 6', id: '4'} - ]; + ] - noteList.setNotes(notesList); + noteList.setNotes(notesList) - ctrl.sourceNoteName = 'test name'; - expect(ctrl.cloneNoteName()).toEqual('test name 1'); - ctrl.sourceNoteName = 'aa bb cc'; - expect(ctrl.cloneNoteName()).toEqual('aa bb cc 1'); - ctrl.sourceNoteName = 'Untitled Note 6'; - expect(ctrl.cloneNoteName()).toEqual('Untitled Note 7'); - ctrl.sourceNoteName = 'My_note'; - expect(ctrl.cloneNoteName()).toEqual('My_note 1'); - ctrl.sourceNoteName = 'dsds 2'; - expect(ctrl.cloneNoteName()).toEqual('dsds 3'); - }); - -}); + ctrl.sourceNoteName = 'test name' + expect(ctrl.cloneNoteName()).toEqual('test name 1') + ctrl.sourceNoteName = 'aa bb cc' + expect(ctrl.cloneNoteName()).toEqual('aa bb cc 1') + ctrl.sourceNoteName = 'Untitled Note 6' + expect(ctrl.cloneNoteName()).toEqual('Untitled Note 7') + ctrl.sourceNoteName = 'My_note' + expect(ctrl.cloneNoteName()).toEqual('My_note 1') + ctrl.sourceNoteName = 'dsds 2' + expect(ctrl.cloneNoteName()).toEqual('dsds 3') + }) +}) http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 6dd19da..48c170f 100644 --- a/zeppelin-web/src/components/noteName-create/visible.directive.js +++ b/zeppelin-web/src/components/noteName-create/visible.directive.js @@ -12,9 +12,9 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').directive('modalvisible', modalvisible); +angular.module('zeppelinWebApp').directive('modalvisible', modalvisible) -function modalvisible() { +function modalvisible () { return { restrict: 'A', scope: { @@ -22,25 +22,24 @@ function modalvisible() { postVisibleCallback: '&postvisiblecallback', targetinput: '@targetinput' }, - link: function(scope, element, attrs) { + 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 path = relatedTarget.data('path'); - var cloneNote = clone ? true : false; - previsibleMethod()(cloneNote, sourceNoteName, path); - }); - element.on('shown.bs.modal', function(e) { + let previsibleMethod = scope.preVisibleCallback + let postVisibleMethod = scope.postVisibleCallback + element.on('show.bs.modal', function (e) { + let relatedTarget = angular.element(e.relatedTarget) + let clone = relatedTarget.data('clone') + let sourceNoteName = relatedTarget.data('source-note-name') + let path = relatedTarget.data('path') + let cloneNote = clone ? true : false + previsibleMethod()(cloneNote, sourceNoteName, path) + }) + element.on('shown.bs.modal', function (e) { if (scope.targetinput) { - angular.element(e.target).find('input#' + scope.targetinput).select(); + angular.element(e.target).find('input#' + scope.targetinput).select() } - postVisibleMethod(); - }); + postVisibleMethod() + }) } - }; + } } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 74c9c59..b42e8d8 100644 --- a/zeppelin-web/src/components/noteName-import/notenameImport.controller.js +++ b/zeppelin-web/src/components/noteName-import/notenameImport.controller.js @@ -12,74 +12,74 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').controller('NoteImportCtrl', NoteImportCtrl); - -function NoteImportCtrl($scope, $timeout, websocketMsgSrv) { - 'ngInject'; - - 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() { - $scope.note = {}; - $scope.note.step1 = true; - $scope.note.step2 = false; - angular.element('#noteImportFile').val(''); - }; - - $scope.uploadFile = function() { - angular.element('#noteImportFile').click(); - }; - - $scope.importFile = function(element) { - $scope.note.errorText = ''; - $scope.note.importFile = element.files[0]; - var file = $scope.note.importFile; - var reader = new FileReader(); +angular.module('zeppelinWebApp').controller('NoteImportCtrl', NoteImportCtrl) + +function NoteImportCtrl ($scope, $timeout, websocketMsgSrv) { + 'ngInject' + + let vm = this + $scope.note = {} + $scope.note.step1 = true + $scope.note.step2 = false + $scope.maxLimit = '' + let 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 () { + $scope.note = {} + $scope.note.step1 = true + $scope.note.step2 = false + angular.element('#noteImportFile').val('') + } + + $scope.uploadFile = function () { + angular.element('#noteImportFile').click() + } + + $scope.importFile = function (element) { + $scope.note.errorText = '' + $scope.note.importFile = element.files[0] + let file = $scope.note.importFile + let reader = new FileReader() if (file.size > limit) { - $scope.note.errorText = 'File size limit Exceeded!'; - $scope.$apply(); - return; + $scope.note.errorText = 'File size limit Exceeded!' + $scope.$apply() + return } - reader.onloadend = function() { - vm.processImportJson(reader.result); - }; + reader.onloadend = function () { + vm.processImportJson(reader.result) + } if (file) { - reader.readAsText(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 = ''; + } + + $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.ajax({ url: $scope.note.importUrl, @@ -89,50 +89,48 @@ function NoteImportCtrl($scope, $timeout, websocketMsgSrv) { xhrFields: { withCredentials: false }, - error: function(xhr, ajaxOptions, thrownError) { - $scope.note.errorText = 'Unable to Fetch URL'; - $scope.$apply(); - }}).done(function(data) { - vm.processImportJson(data); - }); + error: function (xhr, ajaxOptions, thrownError) { + $scope.note.errorText = 'Unable to Fetch URL' + $scope.$apply() + }}).done(function (data) { + vm.processImportJson(data) + }) } else { - $scope.note.errorText = 'Enter URL'; - $scope.$apply(); + $scope.note.errorText = 'Enter URL' + $scope.$apply() } - }; + } - vm.processImportJson = function(result) { + vm.processImportJson = function (result) { if (typeof result !== 'object') { try { - result = JSON.parse(result); + result = JSON.parse(result) } catch (e) { - $scope.note.errorText = 'JSON parse exception'; - $scope.$apply(); - return; + $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; + $scope.note.noteImportName = result.name } else { - result.name = $scope.note.noteImportName; + result.name = $scope.note.noteImportName } - websocketMsgSrv.importNote(result); - //angular.element('#noteImportModal').modal('hide'); + websocketMsgSrv.importNote(result) + // angular.element('#noteImportModal').modal('hide'); } else { - $scope.note.errorText = 'Invalid JSON'; + $scope.note.errorText = 'Invalid JSON' } - $scope.$apply(); - }; + $scope.$apply() + } /* ** $scope.$on functions below */ - $scope.$on('setNoteMenu', function(event, notes) { - vm.resetFlags(); - angular.element('#noteImportModal').modal('hide'); - }); + $scope.$on('setNoteMenu', function (event, notes) { + vm.resetFlags() + angular.element('#noteImportModal').modal('hide') + }) } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/components/notevarshareService/notevarshare.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/notevarshareService/notevarshare.service.js b/zeppelin-web/src/components/notevarshareService/notevarshare.service.js index a4bf7bc..04981bf 100644 --- a/zeppelin-web/src/components/notevarshareService/notevarshare.service.js +++ b/zeppelin-web/src/components/notevarshareService/notevarshare.service.js @@ -12,28 +12,28 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').service('noteVarShareService', noteVarShareService); +angular.module('zeppelinWebApp').service('noteVarShareService', noteVarShareService) -function noteVarShareService() { - 'ngInject'; +function noteVarShareService () { + 'ngInject' - var store = {}; + let store = {} - this.clear = function() { - store = {}; - }; + this.clear = function () { + store = {} + } - this.put = function(key, value) { - store[key] = value; - }; + this.put = function (key, value) { + store[key] = value + } - this.get = function(key) { - return store[key]; - }; + this.get = function (key) { + return store[key] + } - this.del = function(key) { - var v = store[key]; - delete store[key]; - return v; - }; + this.del = function (key) { + let v = store[key] + delete store[key] + return v + } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 index 595ed2f..69ea454 100644 --- 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 @@ -12,14 +12,13 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').directive('popoverHtmlUnsafePopup', popoverHtmlUnsafePopup); +angular.module('zeppelinWebApp').directive('popoverHtmlUnsafePopup', popoverHtmlUnsafePopup) -function 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/19b0f30f/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 ad2f7ea..d4dd546 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,11 +12,10 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').directive('popoverHtmlUnsafe', popoverHtmlUnsafe); +angular.module('zeppelinWebApp').directive('popoverHtmlUnsafe', popoverHtmlUnsafe) -function popoverHtmlUnsafe($tooltip) { - 'ngInject'; +function popoverHtmlUnsafe ($tooltip) { + 'ngInject' - return $tooltip('popoverHtmlUnsafe', 'popover', 'click'); + return $tooltip('popoverHtmlUnsafe', 'popover', 'click') } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/components/rename/rename.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/rename/rename.controller.js b/zeppelin-web/src/components/rename/rename.controller.js index 61fe1d6..305c519 100644 --- a/zeppelin-web/src/components/rename/rename.controller.js +++ b/zeppelin-web/src/components/rename/rename.controller.js @@ -12,36 +12,35 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').controller('RenameCtrl', RenameCtrl); +angular.module('zeppelinWebApp').controller('RenameCtrl', RenameCtrl) -function RenameCtrl($scope) { - 'ngInject'; +function RenameCtrl ($scope) { + 'ngInject' - var self = this; + let self = this - $scope.params = {newName: ''}; - $scope.isValid = true; + $scope.params = {newName: ''} + $scope.isValid = true - $scope.rename = function() { - angular.element('#renameModal').modal('hide'); - self.callback($scope.params.newName); - }; + $scope.rename = function () { + angular.element('#renameModal').modal('hide') + self.callback($scope.params.newName) + } - $scope.$on('openRenameModal', function(event, options) { - self.validator = options.validator || defaultValidator; - self.callback = options.callback || function() {}; + $scope.$on('openRenameModal', function (event, options) { + self.validator = options.validator || defaultValidator + self.callback = options.callback || function () {} - $scope.title = options.title || 'Rename'; - $scope.params.newName = options.oldName || ''; - $scope.validate = function() { - $scope.isValid = self.validator($scope.params.newName); - }; + $scope.title = options.title || 'Rename' + $scope.params.newName = options.oldName || '' + $scope.validate = function () { + $scope.isValid = self.validator($scope.params.newName) + } - angular.element('#renameModal').modal('show'); - }); + angular.element('#renameModal').modal('show') + }) - function defaultValidator(str) { - return !!str.trim(); + function defaultValidator (str) { + return !!str.trim() } } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/components/rename/rename.service.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/rename/rename.service.js b/zeppelin-web/src/components/rename/rename.service.js index c25e145..135f85d 100644 --- a/zeppelin-web/src/components/rename/rename.service.js +++ b/zeppelin-web/src/components/rename/rename.service.js @@ -12,12 +12,12 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').service('renameSrv', renameSrv); +angular.module('zeppelinWebApp').service('renameSrv', renameSrv) -function renameSrv($rootScope) { - 'ngInject'; +function renameSrv ($rootScope) { + 'ngInject' - var self = this; + let self = this /** * <options schema> @@ -26,7 +26,7 @@ function renameSrv($rootScope) { * callback: (newName: string)=>void - callback onButtonClick * validator: (str: string)=>boolean - input validator */ - self.openRenameModal = function(options) { - $rootScope.$broadcast('openRenameModal', options); - }; + self.openRenameModal = function (options) { + $rootScope.$broadcast('openRenameModal', options) + } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 afcfd1b..f0eed76 100644 --- a/zeppelin-web/src/components/resizable/resizable.directive.js +++ b/zeppelin-web/src/components/resizable/resizable.directive.js @@ -12,59 +12,58 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').directive('resizable', resizable); +angular.module('zeppelinWebApp').directive('resizable', resizable) -function resizable() { - var resizableConfig = { +function resizable () { + let resizableConfig = { autoHide: true, handles: 'se', helper: 'resizable-helper', - stop: function() { - angular.element(this).css({'width': '100%', 'height': '100%'}); + 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); + link: function postLink (scope, elem, attrs) { + attrs.$observe('resize', function (resize) { + let resetResize = function (elem, resize) { + let colStep = window.innerWidth / 12 + elem.off('resizestop') + let conf = angular.copy(resizableConfig) if (resize.graphType === 'TABLE' || resize.graphType === 'TEXT') { - conf.grid = [colStep, 10]; - conf.minHeight = 100; + conf.grid = [colStep, 10] + conf.minHeight = 100 } else { - conf.grid = [colStep, 10000]; - conf.minHeight = 0; + conf.grid = [colStep, 10000] + conf.minHeight = 0 } - conf.maxWidth = window.innerWidth; + conf.maxWidth = window.innerWidth - elem.resizable(conf); - elem.on('resizestop', function() { + elem.resizable(conf) + elem.on('resizestop', function () { if (scope.callback) { - var height = elem.height(); + let height = elem.height() if (height < 50) { - height = 300; + 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); + resize = JSON.parse(resize) if (resize.allowresize === 'true') { - resetResize(elem, resize); - angular.element(window).resize(function() { - resetResize(elem, resize); - }); + resetResize(elem, resize) + angular.element(window).resize(function () { + resetResize(elem, resize) + }) } - }); + }) } - }; + } } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 5324fe0..b9cb7c8 100644 --- a/zeppelin-web/src/components/saveAs/saveAs.service.js +++ b/zeppelin-web/src/components/saveAs/saveAs.service.js @@ -12,41 +12,40 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').service('saveAsService', saveAsService); +angular.module('zeppelinWebApp').service('saveAsService', saveAsService) -function saveAsService(browserDetectService) { - 'ngInject'; +function saveAsService (browserDetectService) { + 'ngInject' - this.saveAs = function(content, filename, extension) { - var BOM = '\uFEFF'; + this.saveAs = function (content, filename, extension) { + let 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(); + angular.element('body').append('<iframe id="SaveAsId" style="display: none"></iframe>') + let 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() + let t1 = Date.now() + frameSaveAs.document.execCommand('SaveAs', false, filename + '.' + extension) + let 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" + // 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'); + frameSaveAs.document.execCommand('SaveAs', true, filename + '.txt') } - angular.element('body > iframe#SaveAsId').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(); + content = 'data:image/svg;charset=utf-8,' + BOM + encodeURIComponent(content) + angular.element('body').append('<a id="SaveAsId"></a>') + let 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/19b0f30f/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 460a3d4..a1c8640 100644 --- a/zeppelin-web/src/components/searchService/search.service.js +++ b/zeppelin-web/src/components/searchService/search.service.js @@ -12,23 +12,22 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').service('searchService', searchService); +angular.module('zeppelinWebApp').service('searchService', searchService) -function searchService($resource, baseUrlSrv) { - 'ngInject'; +function searchService ($resource, baseUrlSrv) { + 'ngInject' - this.search = function(term) { - this.searchTerm = term.q; - console.log('Searching for: %o', term.q); - if (!term.q) { //TODO(bzz): empty string check - return; + 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); + let encQuery = window.encodeURIComponent(term.q) return $resource(baseUrlSrv.getRestApiBase() + '/notebook/search?q=' + encQuery, {}, { query: {method: 'GET'} - }); - }; + }) + } - this.searchTerm = ''; + this.searchTerm = '' } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 186de88..08eb16b 100644 --- a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js +++ b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js @@ -12,91 +12,91 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').factory('websocketEvents', websocketEvents); +angular.module('zeppelinWebApp').factory('websocketEvents', websocketEvents) -function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) { - 'ngInject'; +function websocketEvents ($rootScope, $websocket, $location, baseUrlSrv) { + 'ngInject' - var websocketCalls = {}; - var pingIntervalId; + let websocketCalls = {} + let pingIntervalId - websocketCalls.ws = $websocket(baseUrlSrv.getWebsocketUrl()); - websocketCalls.ws.reconnectIfNotNormalClose = true; + websocketCalls.ws = $websocket(baseUrlSrv.getWebsocketUrl()) + websocketCalls.ws.reconnectIfNotNormalClose = true - websocketCalls.ws.onOpen(function() { - console.log('Websocket created'); - $rootScope.$broadcast('setConnectedStatus', true); - pingIntervalId = setInterval(function() { - websocketCalls.sendNewEvent({op: 'PING'}); - }, 10000); - }); + websocketCalls.ws.onOpen(function () { + console.log('Websocket created') + $rootScope.$broadcast('setConnectedStatus', true) + pingIntervalId = setInterval(function () { + websocketCalls.sendNewEvent({op: 'PING'}) + }, 10000) + }) - websocketCalls.sendNewEvent = function(data) { + websocketCalls.sendNewEvent = function (data) { if ($rootScope.ticket !== undefined) { - data.principal = $rootScope.ticket.principal; - data.ticket = $rootScope.ticket.ticket; - data.roles = $rootScope.ticket.roles; + data.principal = $rootScope.ticket.principal + data.ticket = $rootScope.ticket.ticket + data.roles = $rootScope.ticket.roles } else { - data.principal = ''; - data.ticket = ''; - data.roles = ''; + 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)); - }; + console.log('Send >> %o, %o, %o, %o, %o', data.op, data.principal, data.ticket, data.roles, data) + websocketCalls.ws.send(JSON.stringify(data)) + } - websocketCalls.isConnected = function() { - return (websocketCalls.ws.socket.readyState === 1); - }; + websocketCalls.isConnected = function () { + return (websocketCalls.ws.socket.readyState === 1) + } - websocketCalls.ws.onMessage(function(event) { - var payload; + websocketCalls.ws.onMessage(function (event) { + let payload if (event.data) { - payload = angular.fromJson(event.data); + payload = angular.fromJson(event.data) } console.log('Receive Json << %o', event.data) - console.log('Receive << %o, %o', payload.op, payload); - var op = payload.op; - var data = payload.data; + console.log('Receive << %o, %o', payload.op, payload) + let op = payload.op + let data = payload.data if (op === 'NOTE') { - $rootScope.$broadcast('setNoteContent', data.note); + $rootScope.$broadcast('setNoteContent', data.note) } else if (op === 'NEW_NOTE') { - $location.path('/notebook/' + data.note.id); + $location.path('/notebook/' + data.note.id) } else if (op === 'NOTES_INFO') { - $rootScope.$broadcast('setNoteMenu', data.notes); + $rootScope.$broadcast('setNoteMenu', data.notes) } else if (op === 'LIST_NOTE_JOBS') { - $rootScope.$broadcast('setNoteJobs', data.noteJobs); + $rootScope.$broadcast('setNoteJobs', data.noteJobs) } else if (op === 'LIST_UPDATE_NOTE_JOBS') { - $rootScope.$broadcast('setUpdateNoteJobs', data.noteRunningJobs); + $rootScope.$broadcast('setUpdateNoteJobs', data.noteRunningJobs) } else if (op === 'AUTH_INFO') { - var btn = []; + let btn = [] if ($rootScope.ticket.roles === '[]') { btn = [{ label: 'Close', - action: function(dialog) { - dialog.close(); + action: function (dialog) { + dialog.close() } - }]; + }] } else { btn = [{ label: 'Login', - action: function(dialog) { - dialog.close(); + action: function (dialog) { + dialog.close() angular.element('#loginModal').modal({ show: 'true' - }); + }) } }, { label: 'Cancel', - action: function(dialog) { - dialog.close(); + action: function (dialog) { + dialog.close() // using $rootScope.apply to trigger angular digest cycle // changing $location.path inside bootstrap modal wont trigger digest - $rootScope.$apply(function() { - $location.path('/'); - }); + $rootScope.$apply(function () { + $location.path('/') + }) } - }]; + }] } BootstrapDialog.show({ @@ -106,40 +106,39 @@ function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) { title: 'Insufficient privileges', message: data.info.toString(), buttons: btn - }); - + }) } else if (op === 'PARAGRAPH') { - $rootScope.$broadcast('updateParagraph', data); + $rootScope.$broadcast('updateParagraph', data) } else if (op === 'RUN_PARAGRAPH_USING_SPELL') { - $rootScope.$broadcast('runParagraphUsingSpell', data); + $rootScope.$broadcast('runParagraphUsingSpell', data) } else if (op === 'PARAGRAPH_APPEND_OUTPUT') { - $rootScope.$broadcast('appendParagraphOutput', data); + $rootScope.$broadcast('appendParagraphOutput', data) } else if (op === 'PARAGRAPH_UPDATE_OUTPUT') { - $rootScope.$broadcast('updateParagraphOutput', data); + $rootScope.$broadcast('updateParagraphOutput', data) } else if (op === 'PROGRESS') { - $rootScope.$broadcast('updateProgress', data); + $rootScope.$broadcast('updateProgress', data) } else if (op === 'COMPLETION_LIST') { - $rootScope.$broadcast('completionList', data); + $rootScope.$broadcast('completionList', data) } else if (op === 'EDITOR_SETTING') { - $rootScope.$broadcast('editorSetting', data); + $rootScope.$broadcast('editorSetting', data) } else if (op === 'ANGULAR_OBJECT_UPDATE') { - $rootScope.$broadcast('angularObjectUpdate', data); + $rootScope.$broadcast('angularObjectUpdate', data) } else if (op === 'ANGULAR_OBJECT_REMOVE') { - $rootScope.$broadcast('angularObjectRemove', data); + $rootScope.$broadcast('angularObjectRemove', data) } else if (op === 'APP_APPEND_OUTPUT') { - $rootScope.$broadcast('appendAppOutput', data); + $rootScope.$broadcast('appendAppOutput', data) } else if (op === 'APP_UPDATE_OUTPUT') { - $rootScope.$broadcast('updateAppOutput', data); + $rootScope.$broadcast('updateAppOutput', data) } else if (op === 'APP_LOAD') { - $rootScope.$broadcast('appLoad', data); + $rootScope.$broadcast('appLoad', data) } else if (op === 'APP_STATUS_CHANGE') { - $rootScope.$broadcast('appStatusChange', data); + $rootScope.$broadcast('appStatusChange', data) } else if (op === 'LIST_REVISION_HISTORY') { - $rootScope.$broadcast('listRevisionHistory', data); + $rootScope.$broadcast('listRevisionHistory', data) } else if (op === 'NOTE_REVISION') { - $rootScope.$broadcast('noteRevision', data); + $rootScope.$broadcast('noteRevision', data) } else if (op === 'INTERPRETER_BINDINGS') { - $rootScope.$broadcast('interpreterBindings', data); + $rootScope.$broadcast('interpreterBindings', data) } else if (op === 'ERROR_INFO') { BootstrapDialog.show({ closable: false, @@ -150,48 +149,47 @@ function websocketEvents($rootScope, $websocket, $location, baseUrlSrv) { buttons: [{ // close all the dialogs when there are error on running all paragraphs label: 'Close', - action: function() { - BootstrapDialog.closeAll(); + action: function () { + BootstrapDialog.closeAll() } }] - }); + }) } else if (op === 'SESSION_LOGOUT') { - $rootScope.$broadcast('session_logout', data); + $rootScope.$broadcast('session_logout', data) } else if (op === 'CONFIGURATIONS_INFO') { - $rootScope.$broadcast('configurationsInfo', data); + $rootScope.$broadcast('configurationsInfo', data) } else if (op === 'INTERPRETER_SETTINGS') { - $rootScope.$broadcast('interpreterSettings', data); + $rootScope.$broadcast('interpreterSettings', data) } else if (op === 'PARAGRAPH_ADDED') { - $rootScope.$broadcast('addParagraph', data.paragraph, data.index); + $rootScope.$broadcast('addParagraph', data.paragraph, data.index) } else if (op === 'PARAGRAPH_REMOVED') { - $rootScope.$broadcast('removeParagraph', data.id); + $rootScope.$broadcast('removeParagraph', data.id) } else if (op === 'PARAGRAPH_MOVED') { - $rootScope.$broadcast('moveParagraph', data.id, data.index); + $rootScope.$broadcast('moveParagraph', data.id, data.index) } else if (op === 'NOTE_UPDATED') { - $rootScope.$broadcast('updateNote', data.name, data.config, data.info); + $rootScope.$broadcast('updateNote', data.name, data.config, data.info) } else if (op === 'SET_NOTE_REVISION') { - $rootScope.$broadcast('setNoteRevisionResult', data); + $rootScope.$broadcast('setNoteRevisionResult', data) } else if (op === 'PARAS_INFO') { - $rootScope.$broadcast('updateParaInfos', data); + $rootScope.$broadcast('updateParaInfos', data) } else { - console.error(`unknown websocket op: ${op}`); + console.error(`unknown websocket op: ${op}`) } - }); + }) - websocketCalls.ws.onError(function(event) { - console.log('error message: ', event); - $rootScope.$broadcast('setConnectedStatus', false); - }); + websocketCalls.ws.onError(function (event) { + console.log('error message: ', event) + $rootScope.$broadcast('setConnectedStatus', false) + }) - websocketCalls.ws.onClose(function(event) { - console.log('close message: ', event); + websocketCalls.ws.onClose(function (event) { + console.log('close message: ', event) if (pingIntervalId !== undefined) { - clearInterval(pingIntervalId); - pingIntervalId = undefined; + clearInterval(pingIntervalId) + pingIntervalId = undefined } - $rootScope.$broadcast('setConnectedStatus', false); - }); + $rootScope.$broadcast('setConnectedStatus', false) + }) - return websocketCalls; + return websocketCalls } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/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 0ac4d58..3f7ec6b 100644 --- a/zeppelin-web/src/components/websocketEvents/websocketMsg.service.js +++ b/zeppelin-web/src/components/websocketEvents/websocketMsg.service.js @@ -12,100 +12,100 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').service('websocketMsgSrv', websocketMsgSrv); +angular.module('zeppelinWebApp').service('websocketMsgSrv', websocketMsgSrv) -function websocketMsgSrv($rootScope, websocketEvents) { - 'ngInject'; +function websocketMsgSrv ($rootScope, websocketEvents) { + 'ngInject' return { - getHomeNote: function() { - websocketEvents.sendNewEvent({op: 'GET_HOME_NOTE'}); + getHomeNote: function () { + websocketEvents.sendNewEvent({op: 'GET_HOME_NOTE'}) }, - createNotebook: function(noteName, defaultInterpreterId) { + createNotebook: function (noteName, defaultInterpreterId) { websocketEvents.sendNewEvent({ op: 'NEW_NOTE', data: { name: noteName, defaultInterpreterId: defaultInterpreterId } - }); + }) }, - moveNoteToTrash: function(noteId) { - websocketEvents.sendNewEvent({op: 'MOVE_NOTE_TO_TRASH', data: {id: noteId}}); + moveNoteToTrash: function (noteId) { + websocketEvents.sendNewEvent({op: 'MOVE_NOTE_TO_TRASH', data: {id: noteId}}) }, - moveFolderToTrash: function(folderId) { - websocketEvents.sendNewEvent({op: 'MOVE_FOLDER_TO_TRASH', data: {id: folderId}}); + moveFolderToTrash: function (folderId) { + websocketEvents.sendNewEvent({op: 'MOVE_FOLDER_TO_TRASH', data: {id: folderId}}) }, - restoreNote: function(noteId) { - websocketEvents.sendNewEvent({op: 'RESTORE_NOTE', data: {id: noteId}}); + restoreNote: function (noteId) { + websocketEvents.sendNewEvent({op: 'RESTORE_NOTE', data: {id: noteId}}) }, - restoreFolder: function(folderId) { - websocketEvents.sendNewEvent({op: 'RESTORE_FOLDER', data: {id: folderId}}); + restoreFolder: function (folderId) { + websocketEvents.sendNewEvent({op: 'RESTORE_FOLDER', data: {id: folderId}}) }, - restoreAll: function() { - websocketEvents.sendNewEvent({op: 'RESTORE_ALL'}); + restoreAll: function () { + websocketEvents.sendNewEvent({op: 'RESTORE_ALL'}) }, - deleteNote: function(noteId) { - websocketEvents.sendNewEvent({op: 'DEL_NOTE', data: {id: noteId}}); + deleteNote: function (noteId) { + websocketEvents.sendNewEvent({op: 'DEL_NOTE', data: {id: noteId}}) }, - removeFolder: function(folderId) { - websocketEvents.sendNewEvent({op: 'REMOVE_FOLDER', data: {id: folderId}}); + removeFolder: function (folderId) { + websocketEvents.sendNewEvent({op: 'REMOVE_FOLDER', data: {id: folderId}}) }, - emptyTrash: function() { - websocketEvents.sendNewEvent({op: 'EMPTY_TRASH'}); + emptyTrash: function () { + websocketEvents.sendNewEvent({op: 'EMPTY_TRASH'}) }, - cloneNote: function(noteIdToClone, newNoteName) { - websocketEvents.sendNewEvent({op: 'CLONE_NOTE', data: {id: noteIdToClone, name: newNoteName}}); + cloneNote: function (noteIdToClone, newNoteName) { + websocketEvents.sendNewEvent({op: 'CLONE_NOTE', data: {id: noteIdToClone, name: newNoteName}}) }, - getNoteList: function() { - websocketEvents.sendNewEvent({op: 'LIST_NOTES'}); + getNoteList: function () { + websocketEvents.sendNewEvent({op: 'LIST_NOTES'}) }, - reloadAllNotesFromRepo: function() { - websocketEvents.sendNewEvent({op: 'RELOAD_NOTES_FROM_REPO'}); + reloadAllNotesFromRepo: function () { + websocketEvents.sendNewEvent({op: 'RELOAD_NOTES_FROM_REPO'}) }, - getNote: function(noteId) { - websocketEvents.sendNewEvent({op: 'GET_NOTE', data: {id: noteId}}); + getNote: function (noteId) { + websocketEvents.sendNewEvent({op: 'GET_NOTE', data: {id: noteId}}) }, - updateNote: function(noteId, noteName, noteConfig) { - websocketEvents.sendNewEvent({op: 'NOTE_UPDATE', data: {id: noteId, name: noteName, config: noteConfig}}); + updateNote: function (noteId, noteName, noteConfig) { + websocketEvents.sendNewEvent({op: 'NOTE_UPDATE', data: {id: noteId, name: noteName, config: noteConfig}}) }, - updatePersonalizedMode: function(noteId, modeValue) { - websocketEvents.sendNewEvent({op: 'UPDATE_PERSONALIZED_MODE', data: {id: noteId, personalized: modeValue}}); + updatePersonalizedMode: function (noteId, modeValue) { + websocketEvents.sendNewEvent({op: 'UPDATE_PERSONALIZED_MODE', data: {id: noteId, personalized: modeValue}}) }, - renameNote: function(noteId, noteName) { - websocketEvents.sendNewEvent({op: 'NOTE_RENAME', data: {id: noteId, name: noteName}}); + renameNote: function (noteId, noteName) { + websocketEvents.sendNewEvent({op: 'NOTE_RENAME', data: {id: noteId, name: noteName}}) }, - renameFolder: function(folderId, folderName) { - websocketEvents.sendNewEvent({op: 'FOLDER_RENAME', data: {id: folderId, name: folderName}}); + renameFolder: function (folderId, folderName) { + websocketEvents.sendNewEvent({op: 'FOLDER_RENAME', data: {id: folderId, name: folderName}}) }, - moveParagraph: function(paragraphId, newIndex) { - websocketEvents.sendNewEvent({op: 'MOVE_PARAGRAPH', data: {id: paragraphId, index: newIndex}}); + 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}}); + insertParagraph: function (newIndex) { + websocketEvents.sendNewEvent({op: 'INSERT_PARAGRAPH', data: {index: newIndex}}) }, - copyParagraph: function(newIndex, paragraphTitle, paragraphData, + copyParagraph: function (newIndex, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { websocketEvents.sendNewEvent({ op: 'COPY_PARAGRAPH', @@ -116,10 +116,10 @@ function websocketMsgSrv($rootScope, websocketEvents) { config: paragraphConfig, params: paragraphParams } - }); + }) }, - updateAngularObject: function(noteId, paragraphId, name, value, interpreterGroupId) { + updateAngularObject: function (noteId, paragraphId, name, value, interpreterGroupId) { websocketEvents.sendNewEvent({ op: 'ANGULAR_OBJECT_UPDATED', data: { @@ -129,10 +129,10 @@ function websocketMsgSrv($rootScope, websocketEvents) { value: value, interpreterGroupId: interpreterGroupId } - }); + }) }, - clientBindAngularObject: function(noteId, name, value, paragraphId) { + clientBindAngularObject: function (noteId, name, value, paragraphId) { websocketEvents.sendNewEvent({ op: 'ANGULAR_OBJECT_CLIENT_BIND', data: { @@ -141,10 +141,10 @@ function websocketMsgSrv($rootScope, websocketEvents) { value: value, paragraphId: paragraphId } - }); + }) }, - clientUnbindAngularObject: function(noteId, name, paragraphId) { + clientUnbindAngularObject: function (noteId, name, paragraphId) { websocketEvents.sendNewEvent({ op: 'ANGULAR_OBJECT_CLIENT_UNBIND', data: { @@ -152,14 +152,14 @@ function websocketMsgSrv($rootScope, websocketEvents) { name: name, paragraphId: paragraphId } - }); + }) }, - cancelParagraphRun: function(paragraphId) { - websocketEvents.sendNewEvent({op: 'CANCEL_PARAGRAPH', data: {id: paragraphId}}); + cancelParagraphRun: function (paragraphId) { + websocketEvents.sendNewEvent({op: 'CANCEL_PARAGRAPH', data: {id: paragraphId}}) }, - paragraphExecutedBySpell: function(paragraphId, paragraphTitle, + paragraphExecutedBySpell: function (paragraphId, paragraphTitle, paragraphText, paragraphResultsMsg, paragraphStatus, paragraphErrorMessage, paragraphConfig, paragraphParams) { @@ -172,8 +172,8 @@ function websocketMsgSrv($rootScope, websocketEvents) { results: { code: paragraphStatus, msg: paragraphResultsMsg.map(dataWithType => { - let serializedData = dataWithType.data; - return { type: dataWithType.type, data: serializedData, }; + let serializedData = dataWithType.data + return { type: dataWithType.type, data: serializedData, } }) }, status: paragraphStatus, @@ -181,10 +181,10 @@ function websocketMsgSrv($rootScope, websocketEvents) { config: paragraphConfig, params: paragraphParams } - }); + }) }, - runParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { + runParagraph: function (paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { websocketEvents.sendNewEvent({ op: 'RUN_PARAGRAPH', data: { @@ -194,32 +194,32 @@ function websocketMsgSrv($rootScope, websocketEvents) { config: paragraphConfig, params: paragraphParams } - }); + }) }, - runAllParagraphs: function(noteId, paragraphs) { + runAllParagraphs: function (noteId, paragraphs) { websocketEvents.sendNewEvent({ op: 'RUN_ALL_PARAGRAPHS', data: { noteId: noteId, paragraphs: JSON.stringify(paragraphs) } - }); + }) }, - removeParagraph: function(paragraphId) { - websocketEvents.sendNewEvent({op: 'PARAGRAPH_REMOVE', data: {id: paragraphId}}); + removeParagraph: function (paragraphId) { + websocketEvents.sendNewEvent({op: 'PARAGRAPH_REMOVE', data: {id: paragraphId}}) }, - clearParagraphOutput: function(paragraphId) { - websocketEvents.sendNewEvent({op: 'PARAGRAPH_CLEAR_OUTPUT', data: {id: paragraphId}}); + clearParagraphOutput: function (paragraphId) { + websocketEvents.sendNewEvent({op: 'PARAGRAPH_CLEAR_OUTPUT', data: {id: paragraphId}}) }, - clearAllParagraphOutput: function(noteId) { - websocketEvents.sendNewEvent({op: 'PARAGRAPH_CLEAR_ALL_OUTPUT', data: {id: noteId}}); + clearAllParagraphOutput: function (noteId) { + websocketEvents.sendNewEvent({op: 'PARAGRAPH_CLEAR_ALL_OUTPUT', data: {id: noteId}}) }, - completion: function(paragraphId, buf, cursor) { + completion: function (paragraphId, buf, cursor) { websocketEvents.sendNewEvent({ op: 'COMPLETION', data: { @@ -227,10 +227,10 @@ function websocketMsgSrv($rootScope, websocketEvents) { buf: buf, cursor: cursor } - }); + }) }, - commitParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { + commitParagraph: function (paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) { websocketEvents.sendNewEvent({ op: 'COMMIT_PARAGRAPH', data: { @@ -240,102 +240,101 @@ function websocketMsgSrv($rootScope, websocketEvents) { config: paragraphConfig, params: paragraphParams } - }); + }) }, - importNote: function(note) { + importNote: function (note) { websocketEvents.sendNewEvent({ op: 'IMPORT_NOTE', data: { note: note } - }); + }) }, - checkpointNote: function(noteId, commitMessage) { + checkpointNote: function (noteId, commitMessage) { websocketEvents.sendNewEvent({ op: 'CHECKPOINT_NOTE', data: { noteId: noteId, commitMessage: commitMessage } - }); + }) }, - setNoteRevision: function(noteId, revisionId) { + setNoteRevision: function (noteId, revisionId) { websocketEvents.sendNewEvent({ op: 'SET_NOTE_REVISION', data: { noteId: noteId, revisionId: revisionId } - }); + }) }, - listRevisionHistory: function(noteId) { + listRevisionHistory: function (noteId) { websocketEvents.sendNewEvent({ op: 'LIST_REVISION_HISTORY', data: { noteId: noteId } - }); + }) }, - getNoteByRevision: function(noteId, revisionId) { + getNoteByRevision: function (noteId, revisionId) { websocketEvents.sendNewEvent({ op: 'NOTE_REVISION', data: { noteId: noteId, revisionId: revisionId } - }); + }) }, - getEditorSetting: function(paragraphId, replName) { + getEditorSetting: function (paragraphId, replName) { websocketEvents.sendNewEvent({ op: 'EDITOR_SETTING', data: { paragraphId: paragraphId, magic: replName } - }); + }) }, - isConnected: function() { - return websocketEvents.isConnected(); + isConnected: function () { + return websocketEvents.isConnected() }, - getNoteJobsList: function() { - websocketEvents.sendNewEvent({op: 'LIST_NOTE_JOBS'}); + getNoteJobsList: function () { + websocketEvents.sendNewEvent({op: 'LIST_NOTE_JOBS'}) }, - getUpdateNoteJobsList: function(lastUpdateServerUnixTime) { + getUpdateNoteJobsList: function (lastUpdateServerUnixTime) { websocketEvents.sendNewEvent( {op: 'LIST_UPDATE_NOTE_JOBS', data: {lastUpdateUnixTime: lastUpdateServerUnixTime * 1}} - ); + ) }, - unsubscribeJobManager: function() { - websocketEvents.sendNewEvent({op: 'UNSUBSCRIBE_UPDATE_NOTE_JOBS'}); + unsubscribeJobManager: function () { + websocketEvents.sendNewEvent({op: 'UNSUBSCRIBE_UPDATE_NOTE_JOBS'}) }, - getInterpreterBindings: function(noteId) { - websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_BINDINGS', data: {noteId: noteId}}); + getInterpreterBindings: function (noteId) { + websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_BINDINGS', data: {noteId: noteId}}) }, - saveInterpreterBindings: function(noteId, selectedSettingIds) { + saveInterpreterBindings: function (noteId, selectedSettingIds) { websocketEvents.sendNewEvent({op: 'SAVE_INTERPRETER_BINDINGS', - data: {noteId: noteId, selectedSettingIds: selectedSettingIds}}); + data: {noteId: noteId, selectedSettingIds: selectedSettingIds}}) }, - listConfigurations: function() { - websocketEvents.sendNewEvent({op: 'LIST_CONFIGURATIONS'}); + listConfigurations: function () { + websocketEvents.sendNewEvent({op: 'LIST_CONFIGURATIONS'}) }, - getInterpreterSettings: function() { - websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_SETTINGS'}); + getInterpreterSettings: function () { + websocketEvents.sendNewEvent({op: 'GET_INTERPRETER_SETTINGS'}) }, - }; + } } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/19b0f30f/zeppelin-web/src/index.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/index.js b/zeppelin-web/src/index.js index 5afc9ff..314be64 100644 --- a/zeppelin-web/src/index.js +++ b/zeppelin-web/src/index.js @@ -12,65 +12,65 @@ * limitations under the License. */ -import './app/app.js'; -import './app/app.controller.js'; -import './app/home/home.controller.js'; -import './app/handsontable/handsonHelper.js'; -import './app/notebook/notebook.controller.js'; +import './app/app.js' +import './app/app.controller.js' +import './app/home/home.controller.js' +import './app/handsontable/handsonHelper.js' +import './app/notebook/notebook.controller.js' -import './app/tabledata/tabledata.js'; -import './app/tabledata/transformation.js'; -import './app/tabledata/pivot.js'; -import './app/tabledata/passthrough.js'; -import './app/tabledata/columnselector.js'; -import './app/tabledata/advanced-transformation.js'; -import './app/visualization/visualization.js'; -import './app/visualization/builtins/visualization-table.js'; -import './app/visualization/builtins/visualization-nvd3chart.js'; -import './app/visualization/builtins/visualization-barchart.js'; -import './app/visualization/builtins/visualization-piechart.js'; -import './app/visualization/builtins/visualization-areachart.js'; -import './app/visualization/builtins/visualization-linechart.js'; -import './app/visualization/builtins/visualization-scatterchart.js'; +import './app/tabledata/tabledata.js' +import './app/tabledata/transformation.js' +import './app/tabledata/pivot.js' +import './app/tabledata/passthrough.js' +import './app/tabledata/columnselector.js' +import './app/tabledata/advanced-transformation.js' +import './app/visualization/visualization.js' +import './app/visualization/builtins/visualization-table.js' +import './app/visualization/builtins/visualization-nvd3chart.js' +import './app/visualization/builtins/visualization-barchart.js' +import './app/visualization/builtins/visualization-piechart.js' +import './app/visualization/builtins/visualization-areachart.js' +import './app/visualization/builtins/visualization-linechart.js' +import './app/visualization/builtins/visualization-scatterchart.js' -import './app/jobmanager/jobmanager.controller.js'; -import './app/jobmanager/jobs/job.controller.js'; -import './app/jobmanager/jobmanager.filter.js'; -import './app/interpreter/interpreter.controller.js'; -import './app/interpreter/interpreter.filter.js'; -import './app/credential/credential.controller.js'; -import './app/configuration/configuration.controller.js'; -import './app/notebook/paragraph/paragraph.controller.js'; -import './app/notebook/paragraph/result/result.controller.js'; -import './app/search/result-list.controller.js'; -import './app/notebookRepos/notebookRepos.controller.js'; -import './app/helium'; -import './components/arrayOrderingSrv/arrayOrdering.service.js'; -import './components/clipboard/clipboard.controller.js'; -import './components/navbar/navbar.controller.js'; -import './components/ngescape/ngescape.directive.js'; -import './components/interpreter/interpreter.directive.js'; -import './components/expandCollapse/expandCollapse.directive.js'; -import './components/noteName-create/notename.controller.js'; -import './components/noteName-import/notenameImport.controller.js'; -import './components/popover-html-unsafe/popover-html-unsafe.directive.js'; -import './components/popover-html-unsafe/popover-html-unsafe-popup.directive.js'; -import './components/editor/codeEditor.directive.js'; -import './components/ngenter/ngenter.directive.js'; -import './components/dropdowninput/dropdowninput.directive.js'; -import './components/resizable/resizable.directive.js'; -import './components/noteName-create/visible.directive.js'; -import './components/websocketEvents/websocketMsg.service.js'; -import './components/websocketEvents/websocketEvents.factory.js'; -import './components/noteListDataFactory/noteList.datafactory.js'; -import './components/baseUrl/baseUrl.service.js'; -import './components/browser-detect/browserDetect.service.js'; -import './components/saveAs/saveAs.service.js'; -import './components/searchService/search.service.js'; -import './components/login/login.controller.js'; -import './components/elasticInputCtrl/elasticInput.controller.js'; -import './components/noteAction/noteAction.service.js'; -import './components/notevarshareService/notevarshare.service.js'; -import './components/rename/rename.controller.js'; -import './components/rename/rename.service.js'; -import './components/helium/helium.service.js'; +import './app/jobmanager/jobmanager.controller.js' +import './app/jobmanager/jobs/job.controller.js' +import './app/jobmanager/jobmanager.filter.js' +import './app/interpreter/interpreter.controller.js' +import './app/interpreter/interpreter.filter.js' +import './app/credential/credential.controller.js' +import './app/configuration/configuration.controller.js' +import './app/notebook/paragraph/paragraph.controller.js' +import './app/notebook/paragraph/result/result.controller.js' +import './app/search/result-list.controller.js' +import './app/notebookRepos/notebookRepos.controller.js' +import './app/helium' +import './components/arrayOrderingSrv/arrayOrdering.service.js' +import './components/clipboard/clipboard.controller.js' +import './components/navbar/navbar.controller.js' +import './components/ngescape/ngescape.directive.js' +import './components/interpreter/interpreter.directive.js' +import './components/expandCollapse/expandCollapse.directive.js' +import './components/noteName-create/notename.controller.js' +import './components/noteName-import/notenameImport.controller.js' +import './components/popover-html-unsafe/popover-html-unsafe.directive.js' +import './components/popover-html-unsafe/popover-html-unsafe-popup.directive.js' +import './components/editor/codeEditor.directive.js' +import './components/ngenter/ngenter.directive.js' +import './components/dropdowninput/dropdowninput.directive.js' +import './components/resizable/resizable.directive.js' +import './components/noteName-create/visible.directive.js' +import './components/websocketEvents/websocketMsg.service.js' +import './components/websocketEvents/websocketEvents.factory.js' +import './components/noteListDataFactory/noteList.datafactory.js' +import './components/baseUrl/baseUrl.service.js' +import './components/browser-detect/browserDetect.service.js' +import './components/saveAs/saveAs.service.js' +import './components/searchService/search.service.js' +import './components/login/login.controller.js' +import './components/elasticInputCtrl/elasticInput.controller.js' +import './components/noteAction/noteAction.service.js' +import './components/notevarshareService/notevarshare.service.js' +import './components/rename/rename.controller.js' +import './components/rename/rename.service.js' +import './components/helium/helium.service.js'