From 9f9059ee800ed4f7fa73cdc5125109aaa3eb07bc Mon Sep 17 00:00:00 2001 From: Damien Corneau Date: Mon, 27 Apr 2015 17:13:28 +0900 Subject: [PATCH 01/29] Add spark dependency reduced pom to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 93962a16b7e..60cdb0c79e4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ conf/keystore conf/truststore conf/interpreter.json +# other generated files +spark/dependency-reduced-pom.xml + #webapp zeppelin-web/node_modules zeppelin-web/dist From 15b502ca42a145a38cee9d06620313bd70dd7598 Mon Sep 17 00:00:00 2001 From: Damien Corneau Date: Tue, 28 Apr 2015 18:24:53 +0900 Subject: [PATCH 02/29] Change Zeppelin Folder Structure and its GruntFile --- zeppelin-web/Gruntfile.js | 70 +- zeppelin-web/app/{scripts => app}/app.js | 8 +- .../app/{styles => app}/custom-font.css | 0 .../app/{styles => app}/font-awesome.min.css | 0 .../main.js => app/home/home.controller.js} | 0 .../{styles/main.css => app/home/home.css} | 12 +- .../{views/main.html => app/home/home.html} | 0 .../interpreter/interpreter.controller.js} | 0 .../interpreter}/interpreter.css | 0 .../interpreter}/interpreter.html | 0 .../app/{styles => app}/simple-line-icons.css | 0 .../app/{styles => app}/typography.css | 0 .../app/{ => assets}/fonts/FontAwesome.otf | Bin .../{ => assets}/fonts/Simple-Line-Icons.eot | Bin .../{ => assets}/fonts/Simple-Line-Icons.svg | 0 .../{ => assets}/fonts/Simple-Line-Icons.ttf | Bin .../{ => assets}/fonts/Simple-Line-Icons.woff | Bin .../app/{ => assets}/fonts/custom-font.eot | Bin .../app/{ => assets}/fonts/custom-font.svg | 0 .../app/{ => assets}/fonts/custom-font.ttf | Bin .../app/{ => assets}/fonts/custom-font.woff | Bin .../fonts/fontawesome-webfont.eot | Bin .../fonts/fontawesome-webfont.svg | 0 .../fonts/fontawesome-webfont.ttf | Bin .../fonts/fontawesome-webfont.woff | Bin .../app/{ => assets}/images/zepLogo.png | Bin .../app/{ => assets}/images/zepLogoW.png | Bin .../{ => assets}/styles/looknfeel/default.css | 0 .../{ => assets}/styles/looknfeel/report.css | 0 .../{ => assets}/styles/looknfeel/simple.css | 0 .../app/{ => assets}/styles/printMode.css | 0 .../ace/textarea/src/ace-bookmarklet.js | 0 .../directives/dropdowninput.js | 0 .../directives/ngdelete.js | 0 .../directives/ngenter.js | 0 .../directives/popover-html-unsafe.js | 4 +- .../directives/resizable.js | 0 .../modal-shortcut}/modal-shortcut.html | 0 .../navbar/navbar.controller.js} | 0 .../popover-html-unsafe-popup.html | 0 zeppelin-web/app/index.html | 68 +- .../app/scripts/controllers/notebook.js | 494 ----- .../app/scripts/controllers/paragraph.js | 1619 ----------------- zeppelin-web/app/styles/notebook.css | 508 ------ zeppelin-web/app/views/notebooks.html | 170 -- zeppelin-web/app/views/paragraph.html | 449 ----- zeppelin-web/package.json | 5 +- zeppelin-web/pom.xml | 4 +- 48 files changed, 83 insertions(+), 3328 deletions(-) rename zeppelin-web/app/{scripts => app}/app.js (94%) rename zeppelin-web/app/{styles => app}/custom-font.css (100%) rename zeppelin-web/app/{styles => app}/font-awesome.min.css (100%) rename zeppelin-web/app/{scripts/controllers/main.js => app/home/home.controller.js} (100%) rename zeppelin-web/app/{styles/main.css => app/home/home.css} (97%) rename zeppelin-web/app/{views/main.html => app/home/home.html} (100%) rename zeppelin-web/app/{scripts/controllers/interpreter.js => app/interpreter/interpreter.controller.js} (100%) rename zeppelin-web/app/{styles => app/interpreter}/interpreter.css (100%) rename zeppelin-web/app/{views => app/interpreter}/interpreter.html (100%) rename zeppelin-web/app/{styles => app}/simple-line-icons.css (100%) rename zeppelin-web/app/{styles => app}/typography.css (100%) rename zeppelin-web/app/{ => assets}/fonts/FontAwesome.otf (100%) rename zeppelin-web/app/{ => assets}/fonts/Simple-Line-Icons.eot (100%) rename zeppelin-web/app/{ => assets}/fonts/Simple-Line-Icons.svg (100%) rename zeppelin-web/app/{ => assets}/fonts/Simple-Line-Icons.ttf (100%) rename zeppelin-web/app/{ => assets}/fonts/Simple-Line-Icons.woff (100%) rename zeppelin-web/app/{ => assets}/fonts/custom-font.eot (100%) rename zeppelin-web/app/{ => assets}/fonts/custom-font.svg (100%) rename zeppelin-web/app/{ => assets}/fonts/custom-font.ttf (100%) rename zeppelin-web/app/{ => assets}/fonts/custom-font.woff (100%) rename zeppelin-web/app/{ => assets}/fonts/fontawesome-webfont.eot (100%) rename zeppelin-web/app/{ => assets}/fonts/fontawesome-webfont.svg (100%) rename zeppelin-web/app/{ => assets}/fonts/fontawesome-webfont.ttf (100%) rename zeppelin-web/app/{ => assets}/fonts/fontawesome-webfont.woff (100%) rename zeppelin-web/app/{ => assets}/images/zepLogo.png (100%) rename zeppelin-web/app/{ => assets}/images/zepLogoW.png (100%) rename zeppelin-web/app/{ => assets}/styles/looknfeel/default.css (100%) rename zeppelin-web/app/{ => assets}/styles/looknfeel/report.css (100%) rename zeppelin-web/app/{ => assets}/styles/looknfeel/simple.css (100%) rename zeppelin-web/app/{ => assets}/styles/printMode.css (100%) rename zeppelin-web/app/{scripts => components}/ace/textarea/src/ace-bookmarklet.js (100%) rename zeppelin-web/app/{scripts => components}/directives/dropdowninput.js (100%) rename zeppelin-web/app/{scripts => components}/directives/ngdelete.js (100%) rename zeppelin-web/app/{scripts => components}/directives/ngenter.js (100%) rename zeppelin-web/app/{scripts => components}/directives/popover-html-unsafe.js (91%) rename zeppelin-web/app/{scripts => components}/directives/resizable.js (100%) rename zeppelin-web/app/{views => components/modal-shortcut}/modal-shortcut.html (100%) rename zeppelin-web/app/{scripts/controllers/nav.js => components/navbar/navbar.controller.js} (100%) rename zeppelin-web/app/{views => components/popover-html-unsafe}/popover-html-unsafe-popup.html (100%) delete mode 100644 zeppelin-web/app/scripts/controllers/notebook.js delete mode 100644 zeppelin-web/app/scripts/controllers/paragraph.js delete mode 100644 zeppelin-web/app/styles/notebook.css delete mode 100644 zeppelin-web/app/views/notebooks.html delete mode 100644 zeppelin-web/app/views/paragraph.html diff --git a/zeppelin-web/Gruntfile.js b/zeppelin-web/Gruntfile.js index d544ba4c760..944d5a37056 100644 --- a/zeppelin-web/Gruntfile.js +++ b/zeppelin-web/Gruntfile.js @@ -63,7 +63,7 @@ module.exports = function (grunt) { tasks: ['wiredep'] }, js: { - files: ['<%= yeoman.app %>/scripts/{,*/}*.js'], + files: ['<%= yeoman.app %>/{app, components}/**/*.js'], tasks: ['newer:jshint:all'], options: { livereload: '<%= connect.options.livereload %>' @@ -74,7 +74,7 @@ module.exports = function (grunt) { tasks: ['newer:jshint:test', 'karma'] }, styles: { - files: ['<%= yeoman.app %>/styles/{,*/}*.css'], + files: ['<%= yeoman.app %>/{app, components, assets/styles}/**/*.css'], tasks: ['newer:copy:styles', 'autoprefixer'] }, gruntfile: { @@ -85,9 +85,9 @@ module.exports = function (grunt) { livereload: '<%= connect.options.livereload %>' }, files: [ - '<%= yeoman.app %>/{,*/}*.html', + '<%= yeoman.app %>/{app, components}/**/*.html', '.tmp/styles/{,*/}*.css', - '<%= yeoman.app %>/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' + '<%= yeoman.app %>/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}' ] } }, @@ -148,7 +148,7 @@ module.exports = function (grunt) { all: { src: [ 'Gruntfile.js', - '<%= yeoman.app %>/scripts/{,*/}*.js' + '<%= yeoman.app %>/{app, components}/**/*.js' ] }, test: { @@ -199,18 +199,6 @@ module.exports = function (grunt) { } }, - // Renames files for browser caching purposes - filerev: { - dist: { - src: [ - '<%= yeoman.dist %>/scripts/{,*/}*.js', - '<%= yeoman.dist %>/styles/*.css', - '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', - '<%= yeoman.dist %>/styles/fonts/*' - ] - } - }, - // Reads HTML for usemin blocks to enable smart builds that automatically // concat, minify and revision files. Creates configurations in memory so // additional tasks can operate on them @@ -235,7 +223,7 @@ module.exports = function (grunt) { html: ['<%= yeoman.dist %>/{,*/}*.html'], css: ['<%= yeoman.dist %>/styles/*.css'], options: { - assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images'] + assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/assets'] } }, @@ -243,15 +231,15 @@ module.exports = function (grunt) { // By default, your `index.html`'s will take care of // minification. These next options are pre-configured if you do not wish // to use the Usemin blocks. - // cssmin: { - // dist: { - // files: { - // '<%= yeoman.dist %>/styles/main.css': [ - // '.tmp/styles/{,*/}*.css' - // ] - // } - // } - // }, + cssmin: { + dist: { + files: { + '<%= yeoman.dist %>/styles/main.css': [ + '.tmp/styles/{,*/}*.css' + ] + } + } + }, // uglify: { // dist: { // files: { @@ -269,9 +257,9 @@ module.exports = function (grunt) { dist: { files: [{ expand: true, - cwd: '<%= yeoman.app %>/images', + cwd: '<%= yeoman.app %>/assets/images', src: '{,*/}*.svg', - dest: '<%= yeoman.dist %>/images' + dest: '<%= yeoman.dist %>/assets/images' }] } }, @@ -288,7 +276,7 @@ module.exports = function (grunt) { files: [{ expand: true, cwd: '<%= yeoman.dist %>', - src: ['*.html', 'views/{,*/}*.html'], + src: ['*.html', '{app, components}/**/*.html'], dest: '<%= yeoman.dist %>' }] } @@ -306,18 +294,21 @@ module.exports = function (grunt) { '*.{ico,png,txt}', '.htaccess', '*.html', - 'views/{,*/}*.html', - 'images/*', - 'fonts/*', + 'assets/styles/**/*', + 'assets/images/**/*', 'WEB-INF/*', - 'scripts/ace/{,*/}/{,*/}/*' ] }, { expand : true, - dot : true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>', - src: ['styles/looknfeel/*'] + src: ['app/**/*.html', 'components/**/*.html'] + }, { + expand : true, + flatten: true, + cwd: '<%= yeoman.app %>', + dest: '<%= yeoman.dist %>/fonts/', + src: ['assets/fonts/**/*'] }, { expand: true, cwd: '.tmp/images', @@ -337,9 +328,10 @@ module.exports = function (grunt) { }, styles: { expand: true, - cwd: '<%= yeoman.app %>/styles', + flatten: true, + cwd: '<%= yeoman.app %>', dest: '.tmp/styles/', - src: '{,*/}*.css' + src: '{app, components}/**/*.css' } }, @@ -378,7 +370,6 @@ module.exports = function (grunt) { 'concurrent:server', 'autoprefixer', 'connect:livereload', - /*'newer:jshint'*/ 'watch' ]); }); @@ -407,7 +398,6 @@ module.exports = function (grunt) { 'copy:dist', 'cssmin', 'uglify', - /*'filerev',*/ 'usemin', 'htmlmin' ]); diff --git a/zeppelin-web/app/scripts/app.js b/zeppelin-web/app/app/app.js similarity index 94% rename from zeppelin-web/app/scripts/app.js rename to zeppelin-web/app/app/app.js index 3a2c71fa008..56c30eceb57 100644 --- a/zeppelin-web/app/scripts/app.js +++ b/zeppelin-web/app/app/app.js @@ -112,18 +112,18 @@ angular $routeProvider .when('/', { - templateUrl: 'views/main.html' + templateUrl: 'app/home/home.html' }) .when('/notebook/:noteId', { - templateUrl: 'views/notebooks.html', + templateUrl: 'app/notebook/notebooks.html', controller: 'NotebookCtrl' }) .when('/notebook/:noteId/paragraph/:paragraphId?', { - templateUrl: 'views/notebooks.html', + templateUrl: 'app/notebook/notebooks.html', controller: 'NotebookCtrl' }) .when('/interpreter', { - templateUrl: 'views/interpreter.html', + templateUrl: 'app/interpreter/interpreter.html', controller: 'InterpreterCtrl' }) .otherwise({ diff --git a/zeppelin-web/app/styles/custom-font.css b/zeppelin-web/app/app/custom-font.css similarity index 100% rename from zeppelin-web/app/styles/custom-font.css rename to zeppelin-web/app/app/custom-font.css diff --git a/zeppelin-web/app/styles/font-awesome.min.css b/zeppelin-web/app/app/font-awesome.min.css similarity index 100% rename from zeppelin-web/app/styles/font-awesome.min.css rename to zeppelin-web/app/app/font-awesome.min.css diff --git a/zeppelin-web/app/scripts/controllers/main.js b/zeppelin-web/app/app/home/home.controller.js similarity index 100% rename from zeppelin-web/app/scripts/controllers/main.js rename to zeppelin-web/app/app/home/home.controller.js diff --git a/zeppelin-web/app/styles/main.css b/zeppelin-web/app/app/home/home.css similarity index 97% rename from zeppelin-web/app/styles/main.css rename to zeppelin-web/app/app/home/home.css index f9cbed825f3..5058cb8832a 100644 --- a/zeppelin-web/app/styles/main.css +++ b/zeppelin-web/app/app/home/home.css @@ -184,7 +184,7 @@ a.navbar-brand:hover { margin-bottom: 20px; } -.box, +.box, .well { background-color: #ffffff; border-color: #e5e5e5; @@ -228,7 +228,7 @@ h6.box-heading{ .zeppelin { - background-image: url('../images/zepLogo.png'); + background-image: url('/assets/images/zepLogo.png'); background-repeat: no-repeat; background-position: right; height: 380px; @@ -236,7 +236,7 @@ h6.box-heading{ } .zeppelin2 { - background-image: url('../images/zepLogo.png'); + background-image: url('/assets/images/zepLogo.png'); background-repeat: no-repeat; background-position: right; background-position-y: 12px; @@ -277,9 +277,9 @@ kbd { } -/* -temporary fix for bootstrap issue (https://github.com/twbs/bootstrap/issues/5865) -This part should be removed when new version of bootstrap handles this issue. +/* +temporary fix for bootstrap issue (https://github.com/twbs/bootstrap/issues/5865) +This part should be removed when new version of bootstrap handles this issue. */ .btn-group > .tooltip + .btn, .btn-group > .popover + .btn { diff --git a/zeppelin-web/app/views/main.html b/zeppelin-web/app/app/home/home.html similarity index 100% rename from zeppelin-web/app/views/main.html rename to zeppelin-web/app/app/home/home.html diff --git a/zeppelin-web/app/scripts/controllers/interpreter.js b/zeppelin-web/app/app/interpreter/interpreter.controller.js similarity index 100% rename from zeppelin-web/app/scripts/controllers/interpreter.js rename to zeppelin-web/app/app/interpreter/interpreter.controller.js diff --git a/zeppelin-web/app/styles/interpreter.css b/zeppelin-web/app/app/interpreter/interpreter.css similarity index 100% rename from zeppelin-web/app/styles/interpreter.css rename to zeppelin-web/app/app/interpreter/interpreter.css diff --git a/zeppelin-web/app/views/interpreter.html b/zeppelin-web/app/app/interpreter/interpreter.html similarity index 100% rename from zeppelin-web/app/views/interpreter.html rename to zeppelin-web/app/app/interpreter/interpreter.html diff --git a/zeppelin-web/app/styles/simple-line-icons.css b/zeppelin-web/app/app/simple-line-icons.css similarity index 100% rename from zeppelin-web/app/styles/simple-line-icons.css rename to zeppelin-web/app/app/simple-line-icons.css diff --git a/zeppelin-web/app/styles/typography.css b/zeppelin-web/app/app/typography.css similarity index 100% rename from zeppelin-web/app/styles/typography.css rename to zeppelin-web/app/app/typography.css diff --git a/zeppelin-web/app/fonts/FontAwesome.otf b/zeppelin-web/app/assets/fonts/FontAwesome.otf similarity index 100% rename from zeppelin-web/app/fonts/FontAwesome.otf rename to zeppelin-web/app/assets/fonts/FontAwesome.otf diff --git a/zeppelin-web/app/fonts/Simple-Line-Icons.eot b/zeppelin-web/app/assets/fonts/Simple-Line-Icons.eot similarity index 100% rename from zeppelin-web/app/fonts/Simple-Line-Icons.eot rename to zeppelin-web/app/assets/fonts/Simple-Line-Icons.eot diff --git a/zeppelin-web/app/fonts/Simple-Line-Icons.svg b/zeppelin-web/app/assets/fonts/Simple-Line-Icons.svg similarity index 100% rename from zeppelin-web/app/fonts/Simple-Line-Icons.svg rename to zeppelin-web/app/assets/fonts/Simple-Line-Icons.svg diff --git a/zeppelin-web/app/fonts/Simple-Line-Icons.ttf b/zeppelin-web/app/assets/fonts/Simple-Line-Icons.ttf similarity index 100% rename from zeppelin-web/app/fonts/Simple-Line-Icons.ttf rename to zeppelin-web/app/assets/fonts/Simple-Line-Icons.ttf diff --git a/zeppelin-web/app/fonts/Simple-Line-Icons.woff b/zeppelin-web/app/assets/fonts/Simple-Line-Icons.woff similarity index 100% rename from zeppelin-web/app/fonts/Simple-Line-Icons.woff rename to zeppelin-web/app/assets/fonts/Simple-Line-Icons.woff diff --git a/zeppelin-web/app/fonts/custom-font.eot b/zeppelin-web/app/assets/fonts/custom-font.eot similarity index 100% rename from zeppelin-web/app/fonts/custom-font.eot rename to zeppelin-web/app/assets/fonts/custom-font.eot diff --git a/zeppelin-web/app/fonts/custom-font.svg b/zeppelin-web/app/assets/fonts/custom-font.svg similarity index 100% rename from zeppelin-web/app/fonts/custom-font.svg rename to zeppelin-web/app/assets/fonts/custom-font.svg diff --git a/zeppelin-web/app/fonts/custom-font.ttf b/zeppelin-web/app/assets/fonts/custom-font.ttf similarity index 100% rename from zeppelin-web/app/fonts/custom-font.ttf rename to zeppelin-web/app/assets/fonts/custom-font.ttf diff --git a/zeppelin-web/app/fonts/custom-font.woff b/zeppelin-web/app/assets/fonts/custom-font.woff similarity index 100% rename from zeppelin-web/app/fonts/custom-font.woff rename to zeppelin-web/app/assets/fonts/custom-font.woff diff --git a/zeppelin-web/app/fonts/fontawesome-webfont.eot b/zeppelin-web/app/assets/fonts/fontawesome-webfont.eot similarity index 100% rename from zeppelin-web/app/fonts/fontawesome-webfont.eot rename to zeppelin-web/app/assets/fonts/fontawesome-webfont.eot diff --git a/zeppelin-web/app/fonts/fontawesome-webfont.svg b/zeppelin-web/app/assets/fonts/fontawesome-webfont.svg similarity index 100% rename from zeppelin-web/app/fonts/fontawesome-webfont.svg rename to zeppelin-web/app/assets/fonts/fontawesome-webfont.svg diff --git a/zeppelin-web/app/fonts/fontawesome-webfont.ttf b/zeppelin-web/app/assets/fonts/fontawesome-webfont.ttf similarity index 100% rename from zeppelin-web/app/fonts/fontawesome-webfont.ttf rename to zeppelin-web/app/assets/fonts/fontawesome-webfont.ttf diff --git a/zeppelin-web/app/fonts/fontawesome-webfont.woff b/zeppelin-web/app/assets/fonts/fontawesome-webfont.woff similarity index 100% rename from zeppelin-web/app/fonts/fontawesome-webfont.woff rename to zeppelin-web/app/assets/fonts/fontawesome-webfont.woff diff --git a/zeppelin-web/app/images/zepLogo.png b/zeppelin-web/app/assets/images/zepLogo.png similarity index 100% rename from zeppelin-web/app/images/zepLogo.png rename to zeppelin-web/app/assets/images/zepLogo.png diff --git a/zeppelin-web/app/images/zepLogoW.png b/zeppelin-web/app/assets/images/zepLogoW.png similarity index 100% rename from zeppelin-web/app/images/zepLogoW.png rename to zeppelin-web/app/assets/images/zepLogoW.png diff --git a/zeppelin-web/app/styles/looknfeel/default.css b/zeppelin-web/app/assets/styles/looknfeel/default.css similarity index 100% rename from zeppelin-web/app/styles/looknfeel/default.css rename to zeppelin-web/app/assets/styles/looknfeel/default.css diff --git a/zeppelin-web/app/styles/looknfeel/report.css b/zeppelin-web/app/assets/styles/looknfeel/report.css similarity index 100% rename from zeppelin-web/app/styles/looknfeel/report.css rename to zeppelin-web/app/assets/styles/looknfeel/report.css diff --git a/zeppelin-web/app/styles/looknfeel/simple.css b/zeppelin-web/app/assets/styles/looknfeel/simple.css similarity index 100% rename from zeppelin-web/app/styles/looknfeel/simple.css rename to zeppelin-web/app/assets/styles/looknfeel/simple.css diff --git a/zeppelin-web/app/styles/printMode.css b/zeppelin-web/app/assets/styles/printMode.css similarity index 100% rename from zeppelin-web/app/styles/printMode.css rename to zeppelin-web/app/assets/styles/printMode.css diff --git a/zeppelin-web/app/scripts/ace/textarea/src/ace-bookmarklet.js b/zeppelin-web/app/components/ace/textarea/src/ace-bookmarklet.js similarity index 100% rename from zeppelin-web/app/scripts/ace/textarea/src/ace-bookmarklet.js rename to zeppelin-web/app/components/ace/textarea/src/ace-bookmarklet.js diff --git a/zeppelin-web/app/scripts/directives/dropdowninput.js b/zeppelin-web/app/components/directives/dropdowninput.js similarity index 100% rename from zeppelin-web/app/scripts/directives/dropdowninput.js rename to zeppelin-web/app/components/directives/dropdowninput.js diff --git a/zeppelin-web/app/scripts/directives/ngdelete.js b/zeppelin-web/app/components/directives/ngdelete.js similarity index 100% rename from zeppelin-web/app/scripts/directives/ngdelete.js rename to zeppelin-web/app/components/directives/ngdelete.js diff --git a/zeppelin-web/app/scripts/directives/ngenter.js b/zeppelin-web/app/components/directives/ngenter.js similarity index 100% rename from zeppelin-web/app/scripts/directives/ngenter.js rename to zeppelin-web/app/components/directives/ngenter.js diff --git a/zeppelin-web/app/scripts/directives/popover-html-unsafe.js b/zeppelin-web/app/components/directives/popover-html-unsafe.js similarity index 91% rename from zeppelin-web/app/scripts/directives/popover-html-unsafe.js rename to zeppelin-web/app/components/directives/popover-html-unsafe.js index 8a84daaa670..3e405dcd93c 100644 --- a/zeppelin-web/app/scripts/directives/popover-html-unsafe.js +++ b/zeppelin-web/app/components/directives/popover-html-unsafe.js @@ -19,10 +19,10 @@ angular.module('zeppelinWebApp') restrict: 'EA', replace: true, scope: { title: '@', content: '@', placement: '@', animation: '&', isOpen: '&' }, - templateUrl: 'views/popover-html-unsafe-popup.html' + templateUrl: 'components/popover-html-unsafe/popover-html-unsafe-popup.html' }; }) - + .directive('popoverHtmlUnsafe', ['$tooltip', function($tooltip) { return $tooltip('popoverHtmlUnsafe', 'popover', 'click'); }]); diff --git a/zeppelin-web/app/scripts/directives/resizable.js b/zeppelin-web/app/components/directives/resizable.js similarity index 100% rename from zeppelin-web/app/scripts/directives/resizable.js rename to zeppelin-web/app/components/directives/resizable.js diff --git a/zeppelin-web/app/views/modal-shortcut.html b/zeppelin-web/app/components/modal-shortcut/modal-shortcut.html similarity index 100% rename from zeppelin-web/app/views/modal-shortcut.html rename to zeppelin-web/app/components/modal-shortcut/modal-shortcut.html diff --git a/zeppelin-web/app/scripts/controllers/nav.js b/zeppelin-web/app/components/navbar/navbar.controller.js similarity index 100% rename from zeppelin-web/app/scripts/controllers/nav.js rename to zeppelin-web/app/components/navbar/navbar.controller.js diff --git a/zeppelin-web/app/views/popover-html-unsafe-popup.html b/zeppelin-web/app/components/popover-html-unsafe/popover-html-unsafe-popup.html similarity index 100% rename from zeppelin-web/app/views/popover-html-unsafe-popup.html rename to zeppelin-web/app/components/popover-html-unsafe/popover-html-unsafe-popup.html diff --git a/zeppelin-web/app/index.html b/zeppelin-web/app/index.html index 2ad0e972034..691fb48d3d4 100644 --- a/zeppelin-web/app/index.html +++ b/zeppelin-web/app/index.html @@ -3,7 +3,7 @@ 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 +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, @@ -40,20 +40,20 @@ - - - - - - - + + + + + + + - + +

You are using an outdated browser. Please upgrade your browser to improve your experience.

+ -
+
+ + + @@ -139,17 +141,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/zeppelin-web/app/scripts/controllers/notebook.js b/zeppelin-web/app/scripts/controllers/notebook.js deleted file mode 100644 index 9a9fcd7ce99..00000000000 --- a/zeppelin-web/app/scripts/controllers/notebook.js +++ /dev/null @@ -1,494 +0,0 @@ -/* global confirm:false, alert:false */ -/* jshint loopfunc: true */ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -/** - * @ngdoc function - * @name zeppelinWebApp.controller:NotebookCtrl - * @description - * # NotebookCtrl - * Controller of notes, manage the note (update) - * - */ -angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $route, $routeParams, $location, $rootScope, $http) { - $scope.note = null; - $scope.showEditor = false; - $scope.editorToggled = false; - $scope.tableToggled = false; - $scope.viewOnly = false; - $scope.looknfeelOption = [ 'default', 'simple', 'report']; - $scope.cronOption = [ - {name: 'None', value : undefined}, - {name: '1m', value: '0 0/1 * * * ?'}, - {name: '5m', value: '0 0/5 * * * ?'}, - {name: '1h', value: '0 0 0/1 * * ?'}, - {name: '3h', value: '0 0 0/3 * * ?'}, - {name: '6h', value: '0 0 0/6 * * ?'}, - {name: '12h', value: '0 0 0/12 * * ?'}, - {name: '1d', value: '0 0 0 * * ?'} - ]; - - $scope.interpreterSettings = []; - $scope.interpreterBindings = []; - - var angularObjectRegistry = {}; - - $scope.getCronOptionNameFromValue = function(value) { - if (!value) { - return ''; - } - - for (var o in $scope.cronOption) { - if ($scope.cronOption[o].value===value) { - return $scope.cronOption[o].name; - } - } - return value; - }; - - /** Init the new controller */ - var initNotebook = function() { - $rootScope.$emit('sendNewEvent', {op: 'GET_NOTE', data: {id: $routeParams.noteId}}); - }; - - initNotebook(); - - /** Remove the note and go back tot he main page */ - /** TODO(anthony): In the nearly future, go back to the main page and telle to the dude that the note have been remove */ - $scope.removeNote = function(noteId) { - var result = confirm('Do you want to delete this notebook?'); - if (result) { - $rootScope.$emit('sendNewEvent', {op: 'DEL_NOTE', data: {id: noteId}}); - $location.path('/#'); - } - }; - - $scope.runNote = function() { - var result = confirm('Run all paragraphs?'); - if (result) { - $scope.$broadcast('runParagraph'); - } - }; - - $scope.toggleAllEditor = function() { - if ($scope.editorToggled) { - $scope.$broadcast('closeEditor'); - } else { - $scope.$broadcast('openEditor'); - } - $scope.editorToggled = !$scope.editorToggled; - }; - - $scope.showAllEditor = function() { - $scope.$broadcast('openEditor'); - }; - - $scope.hideAllEditor = function() { - $scope.$broadcast('closeEditor'); - }; - - $scope.toggleAllTable = function() { - if ($scope.tableToggled) { - $scope.$broadcast('closeTable'); - } else { - $scope.$broadcast('openTable'); - } - $scope.tableToggled = !$scope.tableToggled; - }; - - $scope.showAllTable = function() { - $scope.$broadcast('openTable'); - }; - - $scope.hideAllTable = function() { - $scope.$broadcast('closeTable'); - }; - - $scope.isNoteRunning = function() { - var running = false; - if(!$scope.note){ return false; } - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if ( $scope.note.paragraphs[i].status === 'PENDING' || $scope.note.paragraphs[i].status === 'RUNNING') { - running = true; - break; - } - } - return running; - }; - - $scope.setLookAndFeel = function(looknfeel) { - $scope.note.config.looknfeel = looknfeel; - $scope.setConfig(); - }; - - /** Set cron expression for this note **/ - $scope.setCronScheduler = function(cronExpr) { - $scope.note.config.cron = cronExpr; - $scope.setConfig(); - }; - - /** Update note config **/ - $scope.setConfig = function(config) { - if(config) { - $scope.note.config = config; - } - $rootScope.$emit('sendNewEvent', {op: 'NOTE_UPDATE', data: {id: $scope.note.id, name: $scope.note.name, config : $scope.note.config}}); - }; - - /** Update the note name */ - $scope.sendNewName = function() { - $scope.showEditor = false; - if ($scope.note.name) { - $rootScope.$emit('sendNewEvent', {op: 'NOTE_UPDATE', data: {id: $scope.note.id, name: $scope.note.name, config : $scope.note.config}}); - } - }; - - /** update the current note */ - $scope.$on('setNoteContent', function(event, note) { - $scope.paragraphUrl = $routeParams.paragraphId; - $scope.asIframe = $routeParams.asIframe; - if ($scope.paragraphUrl) { - note = cleanParagraphExcept($scope.paragraphUrl, note); - $rootScope.$emit('setIframe', $scope.asIframe); - } - - if ($scope.note === null) { - $scope.note = note; - } else { - updateNote(note); - } - initializeLookAndFeel(); - //open interpreter binding setting when there're none selected - getInterpreterBindings(getInterpreterBindingsCallBack); - }); - - - var initializeLookAndFeel = function() { - if (!$scope.note.config.looknfeel) { - $scope.note.config.looknfeel = 'default'; - } else { - $scope.viewOnly = $scope.note.config.looknfeel === 'report' ? true : false; - } - $rootScope.$emit('setLookAndFeel', $scope.note.config.looknfeel); - }; - - - - - - var cleanParagraphExcept = function(paragraphId, note) { - var noteCopy = {}; - noteCopy.id = note.id; - noteCopy.name = note.name; - noteCopy.config = note.config; - noteCopy.info = note.info; - noteCopy.paragraphs = []; - for (var i=0; i=$scope.note.paragraphs.length) { - return; - } - $rootScope.$emit('sendNewEvent', { op: 'MOVE_PARAGRAPH', data : {id: paragraphId, index: newIndex}}); - }); - - // create new paragraph on current position - $scope.$on('insertParagraph', function(event, paragraphId) { - var newIndex = -1; - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if ($scope.note.paragraphs[i].id === paragraphId) { - newIndex = i+1; - break; - } - } - - if (newIndex === $scope.note.paragraphs.length) { - alert('Cannot insert after the last paragraph.'); - return; - } - if (newIndex < 0 || newIndex > $scope.note.paragraphs.length) { - return; - } - $rootScope.$emit('sendNewEvent', { op: 'INSERT_PARAGRAPH', data : {index: newIndex}}); - }); - - $scope.$on('moveParagraphDown', function(event, paragraphId) { - var newIndex = -1; - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if ($scope.note.paragraphs[i].id === paragraphId) { - newIndex = i+1; - break; - } - } - - if (newIndex<0 || newIndex>=$scope.note.paragraphs.length) { - return; - } - $rootScope.$emit('sendNewEvent', { op: 'MOVE_PARAGRAPH', data : {id: paragraphId, index: newIndex}}); - }); - - $scope.$on('moveFocusToPreviousParagraph', function(event, currentParagraphId){ - var focus = false; - for (var i=$scope.note.paragraphs.length-1; i>=0; i--) { - if (focus === false ) { - if ($scope.note.paragraphs[i].id === currentParagraphId) { - focus = true; - continue; - } - } else { - var p = $scope.note.paragraphs[i]; - if (!p.config.hide && !p.config.editorHide && !p.config.tableHide) { - $scope.$broadcast('focusParagraph', $scope.note.paragraphs[i].id); - break; - } - } - } - }); - - $scope.$on('moveFocusToNextParagraph', function(event, currentParagraphId){ - var focus = false; - for (var i=0; i<$scope.note.paragraphs.length; i++) { - if (focus === false ) { - if ($scope.note.paragraphs[i].id === currentParagraphId) { - focus = true; - continue; - } - } else { - var p = $scope.note.paragraphs[i]; - if (!p.config.hide && !p.config.editorHide && !p.config.tableHide) { - $scope.$broadcast('focusParagraph', $scope.note.paragraphs[i].id); - break; - } - } - } - }); - - var updateNote = function(note) { - /** update Note name */ - if (note.name !== $scope.note.name) { - console.log('change note name: %o to %o', $scope.note.name, note.name); - $scope.note.name = note.name; - } - - $scope.note.config = note.config; - $scope.note.info = note.info; - - var newParagraphIds = note.paragraphs.map(function(x) {return x.id;}); - var oldParagraphIds = $scope.note.paragraphs.map(function(x) {return x.id;}); - - var numNewParagraphs = newParagraphIds.length; - var numOldParagraphs = oldParagraphIds.length; - - /** add a new paragraph */ - if (numNewParagraphs > numOldParagraphs) { - for (var index in newParagraphIds) { - if (oldParagraphIds[index] !== newParagraphIds[index]) { - $scope.note.paragraphs.splice(index, 0, note.paragraphs[index]); - break; - } - } - } - - /** update or move paragraph */ - if (numNewParagraphs === numOldParagraphs) { - for (var idx in newParagraphIds) { - var newEntry = note.paragraphs[idx]; - if (oldParagraphIds[idx] === newParagraphIds[idx]) { - $scope.$broadcast('updateParagraph', {paragraph: newEntry}); - } else { - // move paragraph - var oldIdx = oldParagraphIds.indexOf(newParagraphIds[idx]); - $scope.note.paragraphs.splice(oldIdx, 1); - $scope.note.paragraphs.splice(idx, 0, newEntry); - // rebuild id list since paragraph has moved. - oldParagraphIds = $scope.note.paragraphs.map(function(x) {return x.id;}); - } - } - } - - /** remove paragraph */ - if (numNewParagraphs < numOldParagraphs) { - for (var oldidx in oldParagraphIds) { - if(oldParagraphIds[oldidx] !== newParagraphIds[oldidx]) { - $scope.note.paragraphs.splice(oldidx, 1); - break; - } - } - } - }; - - var getInterpreterBindings = function(callback) { - $http.get(getRestApiBase()+ '/notebook/interpreter/bind/' +$scope.note.id). - success(function(data, status, headers, config) { - $scope.interpreterBindings = data.body; - $scope.interpreterBindingsOrig = jQuery.extend(true, [], $scope.interpreterBindings); // to check dirty - if (callback) { - callback(); - } - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - var getInterpreterBindingsCallBack = function() { - var selected = false; - for (var i in $scope.interpreterBindings) { - var setting = $scope.interpreterBindings[i]; - if (setting.selected) { - selected = true; - break; - } - } - - if (!selected) { - // make default selection - var selectedIntp = {}; - for (var i in $scope.interpreterBindings) { - var setting = $scope.interpreterBindings[i]; - if (!selectedIntp[setting.group]) { - setting.selected = true; - selectedIntp[setting.group] = true; - } - } - $scope.showSetting = true; - } - }; - - $scope.interpreterSelectionListeners = { - accept : function(sourceItemHandleScope, destSortableScope) {return true;}, - itemMoved: function (event) {}, - orderChanged: function(event) {} - }; - - $scope.openSetting = function() { - $scope.showSetting = true; - getInterpreterBindings(); - }; - - $scope.closeSetting = function() { - if (isSettingDirty()) { - var result = confirm('Changes will be discarded'); - if (!result) { - return; - } - } - $scope.showSetting = false; - }; - - $scope.saveSetting = function() { - var selectedSettingIds = []; - for (var no in $scope.interpreterBindings) { - var setting = $scope.interpreterBindings[no]; - if (setting.selected) { - selectedSettingIds.push(setting.id); - } - } - - $http.put(getRestApiBase() + '/notebook/interpreter/bind/' + $scope.note.id, - selectedSettingIds). - success(function(data, status, headers, config) { - console.log('Interpreter binding %o saved', selectedSettingIds); - $scope.showSetting = false; - }). - error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; - - $scope.toggleSetting = function() { - if ($scope.showSetting) { - $scope.closeSetting(); - } else { - $scope.openSetting(); - } - }; - - var isSettingDirty = function() { - if (angular.equals($scope.interpreterBindings, $scope.interpreterBindingsOrig)) { - return false; - } else { - return true; - } - }; - - $scope.$on('angularObjectUpdate', function(event, data) { - if (data.noteId === $scope.note.id) { - var scope = $rootScope.compiledScope; - var varName = data.angularObject.name; - - if (angular.equals(data.angularObject.object, scope[varName])) { - // return when update has no change - return; - } - - if (!angularObjectRegistry[varName]) { - angularObjectRegistry[varName] = { - interpreterGroupId : data.interpreterGroupId, - } - } - - angularObjectRegistry[varName].skipEmit = true; - - if (!angularObjectRegistry[varName].clearWatcher) { - angularObjectRegistry[varName].clearWatcher = scope.$watch(varName, function(newValue, oldValue) { - if (angularObjectRegistry[varName].skipEmit) { - angularObjectRegistry[varName].skipEmit = false; - return; - } - - $rootScope.$emit('sendNewEvent', { - op: 'ANGULAR_OBJECT_UPDATED', - data: { - noteId: $routeParams.noteId, - name:varName, - value:newValue, - interpreterGroupId:angularObjectRegistry[varName].interpreterGroupId - } - }); - }); - } - scope[varName] = data.angularObject.object; - } - - }); - - var isFunction = function(functionToCheck) { - var getType = {}; - return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; - } - -}); diff --git a/zeppelin-web/app/scripts/controllers/paragraph.js b/zeppelin-web/app/scripts/controllers/paragraph.js deleted file mode 100644 index e332e6066a9..00000000000 --- a/zeppelin-web/app/scripts/controllers/paragraph.js +++ /dev/null @@ -1,1619 +0,0 @@ -/* global $:false, jQuery:false, ace:false, confirm:false, d3:false, nv:false*/ -/*jshint loopfunc: true, unused:false */ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -/** - * @ngdoc function - * @name zeppelinWebApp.controller:ParagraphCtrl - * @description - * # ParagraphCtrl - * Controller of the paragraph, manage everything related to the paragraph - * - * @author anthonycorbacho - */ -angular.module('zeppelinWebApp') - .controller('ParagraphCtrl', function($scope, $rootScope, $route, $window, $element, $routeParams, $location, $timeout, $compile) { - - $scope.paragraph = null; - $scope.editor = null; - var editorMode = {scala: 'ace/mode/scala', sql: 'ace/mode/sql', markdown: 'ace/mode/markdown'}; - - // Controller init - $scope.init = function(newParagraph) { - $scope.paragraph = newParagraph; - $scope.chart = {}; - $scope.colWidthOption = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]; - $scope.showTitleEditor = false; - $scope.paragraphFocused = false; - - if (!$scope.paragraph.config) { - $scope.paragraph.config = {}; - } - - initializeDefault(); - - if (!$scope.lastData) { - $scope.lastData = {}; - } - - if ($scope.getResultType() === 'TABLE') { - $scope.lastData.settings = angular.copy($scope.paragraph.settings); - $scope.lastData.config = angular.copy($scope.paragraph.config); - $scope.loadTableData($scope.paragraph.result); - $scope.setGraphMode($scope.getGraphMode(), false, false); - } else if ($scope.getResultType() === 'HTML') { - $scope.renderHtml(); - } else if ($scope.getResultType() === 'ANGULAR') { - $scope.renderAngular(); - } - }; - - $scope.renderHtml = function() { - var retryRenderer = function() { - if ($('#p'+$scope.paragraph.id+'_html').length) { - try { - $('#p'+$scope.paragraph.id+'_html').html($scope.paragraph.result.msg); - - $('#p'+$scope.paragraph.id+'_html').find('pre code').each(function(i, e) { hljs.highlightBlock(e) }); - } catch(err) { - console.log('HTML rendering error %o', err); - } - } else { - $timeout(retryRenderer,10); - } - }; - $timeout(retryRenderer); - - }; - - $scope.renderAngular = function() { - var retryRenderer = function() { - if (angular.element('#p'+$scope.paragraph.id+'_angular').length) { - try { - angular.element('#p'+$scope.paragraph.id+'_angular').html($scope.paragraph.result.msg); - - $compile(angular.element('#p'+$scope.paragraph.id+'_angular').contents())($rootScope.compiledScope); - } catch(err) { - console.log('ANGULAR rendering error %o', err); - } - } else { - $timeout(retryRenderer,10); - } - }; - $timeout(retryRenderer); - - }; - - - var initializeDefault = function() { - var config = $scope.paragraph.config; - - if (!config.colWidth) { - config.colWidth = 12; - } - - if (!config.graph) { - config.graph = {}; - } - - if (!config.graph.mode) { - config.graph.mode = 'table'; - } - - if (!config.graph.height) { - config.graph.height = 300; - } - - if (!config.graph.optionOpen) { - config.graph.optionOpen = false; - } - - if (!config.graph.keys) { - config.graph.keys = []; - } - - if (!config.graph.values) { - config.graph.values = []; - } - - if (!config.graph.groups) { - config.graph.groups = []; - } - - if (!config.graph.scatter) { - config.graph.scatter = {}; - } - }; - - $scope.getIframeDimensions = function () { - if ($scope.asIframe) { - var paragraphid = '#' + $routeParams.paragraphId + '_container'; - var height = $(paragraphid).height(); - return height; - } - return 0; - }; - - $scope.$watch($scope.getIframeDimensions, function (newValue, oldValue) { - if ($scope.asIframe && newValue) { - var message = {}; - message.height = newValue; - message.url = $location.$$absUrl; - $window.parent.postMessage(angular.toJson(message), '*'); - } - }); - - // TODO: this may have impact on performance when there are many paragraphs in a note. - $scope.$on('updateParagraph', function(event, data) { - if (data.paragraph.id === $scope.paragraph.id && - ( - data.paragraph.dateCreated !== $scope.paragraph.dateCreated || - data.paragraph.dateFinished !== $scope.paragraph.dateFinished || - data.paragraph.dateStarted !== $scope.paragraph.dateStarted || - data.paragraph.status !== $scope.paragraph.status || - data.paragraph.jobName !== $scope.paragraph.jobName || - data.paragraph.title !== $scope.paragraph.title || - data.paragraph.errorMessage !== $scope.paragraph.errorMessage || - !angular.equals(data.paragraph.settings, $scope.lastData.settings) || - !angular.equals(data.paragraph.config, $scope.lastData.config) - ) - ) { - // store original data for comparison - $scope.lastData.settings = angular.copy(data.paragraph.settings); - $scope.lastData.config = angular.copy(data.paragraph.config); - - var oldType = $scope.getResultType(); - var newType = $scope.getResultType(data.paragraph); - var oldGraphMode = $scope.getGraphMode(); - var newGraphMode = $scope.getGraphMode(data.paragraph); - var resultRefreshed = (data.paragraph.dateFinished !== $scope.paragraph.dateFinished); - - //console.log("updateParagraph oldData %o, newData %o. type %o -> %o, mode %o -> %o", $scope.paragraph, data, oldType, newType, oldGraphMode, newGraphMode); - - if ($scope.paragraph.text !== data.paragraph.text) { - if ($scope.dirtyText) { // check if editor has local update - if ($scope.dirtyText === data.paragraph.text ) { // when local update is the same from remote, clear local update - $scope.paragraph.text = data.paragraph.text; - $scope.dirtyText = undefined; - } else { // if there're local update, keep it. - $scope.paragraph.text = $scope.dirtyText; - } - } else { - $scope.paragraph.text = data.paragraph.text; - } - } - - /** push the rest */ - $scope.paragraph.aborted = data.paragraph.aborted; - $scope.paragraph.dateCreated = data.paragraph.dateCreated; - $scope.paragraph.dateFinished = data.paragraph.dateFinished; - $scope.paragraph.dateStarted = data.paragraph.dateStarted; - $scope.paragraph.errorMessage = data.paragraph.errorMessage; - $scope.paragraph.jobName = data.paragraph.jobName; - $scope.paragraph.title = data.paragraph.title; - $scope.paragraph.status = data.paragraph.status; - $scope.paragraph.result = data.paragraph.result; - $scope.paragraph.settings = data.paragraph.settings; - - if (!$scope.asIframe) { - $scope.paragraph.config = data.paragraph.config; - initializeDefault(); - } else { - data.paragraph.config.editorHide = true; - data.paragraph.config.tableHide = false; - $scope.paragraph.config = data.paragraph.config; - } - - if (newType === 'TABLE') { - $scope.loadTableData($scope.paragraph.result); - if (oldType !== 'TABLE' || resultRefreshed) { - clearUnknownColsFromGraphOption(); - selectDefaultColsForGraphOption(); - } - /** User changed the chart type? */ - if (oldGraphMode !== newGraphMode) { - $scope.setGraphMode(newGraphMode, false, false); - } else { - $scope.setGraphMode(newGraphMode, false, true); - } - } else if (newType === 'HTML') { - $scope.renderHtml(); - } else if (newType === 'ANGULAR') { - $scope.renderAngular(); - } - } - }); - - $scope.isRunning = function() { - if ($scope.paragraph.status === 'RUNNING' || $scope.paragraph.status === 'PENDING') { - return true; - } else { - return false; - } - }; - - $scope.cancelParagraph = function() { - console.log('Cancel %o', $scope.paragraph.id); - var data = {op: 'CANCEL_PARAGRAPH', data: {id: $scope.paragraph.id }}; - $rootScope.$emit('sendNewEvent', data); - }; - - - $scope.runParagraph = function(data) { - var parapgraphData = {op: 'RUN_PARAGRAPH', - data: { - id: $scope.paragraph.id, - title: $scope.paragraph.title, - paragraph: data, - config: $scope.paragraph.config, - params: $scope.paragraph.settings.params - } - }; - $rootScope.$emit('sendNewEvent', parapgraphData); - }; - - $scope.moveUp = function() { - $scope.$emit('moveParagraphUp', $scope.paragraph.id); - }; - - $scope.moveDown = function() { - $scope.$emit('moveParagraphDown', $scope.paragraph.id); - }; - - $scope.insertNew = function() { - $scope.$emit('insertParagraph', $scope.paragraph.id); - }; - - $scope.removeParagraph = function() { - var result = confirm('Do you want to delete this paragraph?'); - if (result) { - console.log('Remove paragraph'); - var paragraphData = {op: 'PARAGRAPH_REMOVE', data: {id: $scope.paragraph.id}}; - $rootScope.$emit('sendNewEvent', paragraphData); - } - }; - - $scope.toggleEditor = function() { - if ($scope.paragraph.config.editorHide) { - $scope.openEditor(); - } else { - $scope.closeEditor(); - } - }; - - $scope.closeEditor = function() { - console.log('close the note'); - - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - newConfig.editorHide = true; - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.openEditor = function() { - console.log('open the note'); - - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - newConfig.editorHide = false; - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.closeTable = function() { - console.log('close the output'); - - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - newConfig.tableHide = true; - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.openTable = function() { - console.log('open the output'); - - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - newConfig.tableHide = false; - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.showTitle = function() { - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - newConfig.title = true; - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.hideTitle = function() { - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - newConfig.title = false; - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.setTitle = function() { - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.columnWidthClass = function(n) { - if ($scope.asIframe) { - return 'col-md-12'; - } else { - return 'col-md-' + n; - } - }; - - $scope.changeColWidth = function() { - - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.toggleGraphOption = function() { - var newConfig = angular.copy($scope.paragraph.config); - if (newConfig.graph.optionOpen) { - newConfig.graph.optionOpen = false; - } else { - newConfig.graph.optionOpen = true; - } - var newParams = angular.copy($scope.paragraph.settings.params); - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - $scope.toggleOutput = function() { - var newConfig = angular.copy($scope.paragraph.config); - newConfig.tableHide = !newConfig.tableHide; - var newParams = angular.copy($scope.paragraph.settings.params); - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - - $scope.loadForm = function(formulaire, params) { - var value = formulaire.defaultValue; - if (params[formulaire.name]) { - value = params[formulaire.name]; - } - - if (value === '') { - value = formulaire.options[0].value; - } - - $scope.paragraph.settings.params[formulaire.name] = value; - }; - - $scope.aceChanged = function() { - $scope.dirtyText = $scope.editor.getSession().getValue(); - }; - - $scope.aceLoaded = function(_editor) { - var langTools = ace.require('ace/ext/language_tools'); - var Range = ace.require('ace/range').Range; - - $scope.editor = _editor; - if (_editor.container.id !== '{{paragraph.id}}_editor') { - $scope.editor.renderer.setShowGutter(false); - $scope.editor.setHighlightActiveLine(false); - $scope.editor.setTheme('ace/theme/github'); - $scope.editor.focus(); - var hight = $scope.editor.getSession().getScreenLength() * $scope.editor.renderer.lineHeight + $scope.editor.renderer.scrollBar.getWidth(); - setEditorHeight(_editor.container.id, hight); - - $scope.editor.getSession().setUseWrapMode(true); - if (navigator.appVersion.indexOf('Mac') !== -1 ) { - $scope.editor.setKeyboardHandler('ace/keyboard/emacs'); - } else if (navigator.appVersion.indexOf('Win') !== -1 || - navigator.appVersion.indexOf('X11') !== -1 || - navigator.appVersion.indexOf('Linux') !== -1) { - // not applying emacs key binding while the binding override Ctrl-v. default behavior of paste text on windows. - } - - $scope.editor.setOptions({ - enableBasicAutocompletion: true, - enableSnippets: false, - enableLiveAutocompletion:false - }); - var remoteCompleter = { - getCompletions : function(editor, session, pos, prefix, callback) { - if (!$scope.editor.isFocused() ){ return;} - - var buf = session.getTextRange(new Range(0, 0, pos.row, pos.column)); - $rootScope.$emit('sendNewEvent', { - op : 'COMPLETION', - data : { - id : $scope.paragraph.id, - buf : buf, - cursor : buf.length - } - }); - - $scope.$on('completionList', function(event, data) { - if (data.completions) { - var completions = []; - for (var c in data.completions) { - var v = data.completions[c]; - completions.push({ - name:v, - value:v, - score:300 - }); - } - callback(null, completions); - } - }); - } - }; - langTools.addCompleter(remoteCompleter); - - - $scope.handleFocus = function(value) { - $scope.paragraphFocused = value; - // Protect against error in case digest is already running - $timeout(function() { - // Apply changes since they come from 3rd party library - $scope.$digest(); - }); - }; - - $scope.editor.on('focus', function() { - $scope.handleFocus(true); - }); - - $scope.editor.on('blur', function() { - $scope.handleFocus(false); - }); - - - $scope.editor.getSession().on('change', function(e, editSession) { - hight = editSession.getScreenLength() * $scope.editor.renderer.lineHeight + $scope.editor.renderer.scrollBar.getWidth(); - setEditorHeight(_editor.container.id, hight); - $scope.editor.resize(); - }); - - var code = $scope.editor.getSession().getValue(); - if ( String(code).startsWith('%sql')) { - $scope.editor.getSession().setMode(editorMode.sql); - } else if ( String(code).startsWith('%md')) { - $scope.editor.getSession().setMode(editorMode.markdown); - } else { - $scope.editor.getSession().setMode(editorMode.scala); - } - - $scope.editor.commands.addCommand({ - name: 'run', - bindKey: {win: 'Shift-Enter', mac: 'Shift-Enter'}, - exec: function(editor) { - var editorValue = editor.getValue(); - if (editorValue) { - $scope.runParagraph(editorValue); - } - }, - readOnly: false - }); - - // autocomplete on '.' - /* - $scope.editor.commands.on("afterExec", function(e, t) { - if (e.command.name == "insertstring" && e.args == "." ) { - var all = e.editor.completers; - //e.editor.completers = [remoteCompleter]; - e.editor.execCommand("startAutocomplete"); - //e.editor.completers = all; - } - }); - */ - - // autocomplete on 'ctrl+.' - $scope.editor.commands.bindKey('ctrl-.', 'startAutocomplete'); - $scope.editor.commands.bindKey('ctrl-space', null); - - // handle cursor moves - $scope.editor.keyBinding.origOnCommandKey = $scope.editor.keyBinding.onCommandKey; - $scope.editor.keyBinding.onCommandKey = function(e, hashId, keyCode) { - if ($scope.editor.completer && $scope.editor.completer.activated) { // if autocompleter is active - } else { - var numRows; - var currentRow; - if (keyCode === 38 || (keyCode === 80 && e.ctrlKey)) { // UP - numRows = $scope.editor.getSession().getLength(); - currentRow = $scope.editor.getCursorPosition().row; - if (currentRow === 0) { - // move focus to previous paragraph - $scope.$emit('moveFocusToPreviousParagraph', $scope.paragraph.id); - } - } else if (keyCode === 40 || (keyCode === 78 && e.ctrlKey)) { // DOWN - numRows = $scope.editor.getSession().getLength(); - currentRow = $scope.editor.getCursorPosition().row; - if (currentRow === numRows-1) { - // move focus to next paragraph - $scope.$emit('moveFocusToNextParagraph', $scope.paragraph.id); - } - } - } - this.origOnCommandKey(e, hashId, keyCode); - }; - } - }; - - var setEditorHeight = function(id, height) { - $('#' + id).height(height.toString() + 'px'); - }; - - $scope.getEditorValue = function() { - return $scope.editor.getValue(); - }; - - $scope.getProgress = function() { - return ($scope.currentProgress) ? $scope.currentProgress : 0; - }; - - $scope.getExecutionTime = function() { - var pdata = $scope.paragraph; - var timeMs = Date.parse(pdata.dateFinished) - Date.parse(pdata.dateStarted); - if (isNaN(timeMs) || timeMs < 0) { - return ' '; - } - return 'Took ' + (timeMs/1000) + ' seconds'; - }; - - $scope.$on('updateProgress', function(event, data) { - if (data.id === $scope.paragraph.id) { - $scope.currentProgress = data.progress; - } - }); - - $scope.$on('focusParagraph', function(event, paragraphId) { - if ($scope.paragraph.id === paragraphId) { - $scope.editor.focus(); - $('body').scrollTo('#'+paragraphId+'_editor', 300, {offset:-60}); - } - }); - - $scope.$on('runParagraph', function(event) { - $scope.runParagraph($scope.editor.getValue()); - }); - - $scope.$on('openEditor', function(event) { - $scope.openEditor(); - }); - - $scope.$on('closeEditor', function(event) { - $scope.closeEditor(); - }); - - $scope.$on('openTable', function(event) { - $scope.openTable(); - }); - - $scope.$on('closeTable', function(event) { - $scope.closeTable(); - }); - - - $scope.getResultType = function(paragraph) { - var pdata = (paragraph) ? paragraph : $scope.paragraph; - if (pdata.result && pdata.result.type) { - return pdata.result.type; - } else { - return 'TEXT'; - } - }; - - $scope.getBase64ImageSrc = function(base64Data) { - return 'data:image/png;base64,'+base64Data; - }; - - $scope.getGraphMode = function(paragraph) { - var pdata = (paragraph) ? paragraph : $scope.paragraph; - if (pdata.config.graph && pdata.config.graph.mode) { - return pdata.config.graph.mode; - } else { - return 'table'; - } - }; - - $scope.loadTableData = function(result) { - if (!result) { - return; - } - if (result.type === 'TABLE') { - var columnNames = []; - var rows = []; - var array = []; - var textRows = result.msg.split('\n'); - result.comment = ''; - var comment = false; - - for (var i = 0; i < textRows.length; i++) { - var textRow = textRows[i]; - if (comment) { - result.comment += textRow; - continue; - } - - if (textRow === '') { - if (rows.length>0) { - comment = true; - } - continue; - } - var textCols = textRow.split('\t'); - var cols = []; - var cols2 = []; - for (var j = 0; j < textCols.length; j++) { - var col = textCols[j]; - if (i === 0) { - columnNames.push({name:col, index:j, aggr:'sum'}); - } else { - cols.push(col); - cols2.push({key: (columnNames[i]) ? columnNames[i].name: undefined, value: col}); - } - } - if (i !== 0) { - rows.push(cols); - array.push(cols2); - } - } - result.msgTable = array; - result.columnNames = columnNames; - result.rows = rows; - } - }; - - $scope.setGraphMode = function(type, emit, refresh) { - if (emit) { - setNewMode(type); - } else { - clearUnknownColsFromGraphOption(); - // set graph height - var height = $scope.paragraph.config.graph.height; - $('#p'+$scope.paragraph.id+'_graph').height(height); - - if (!type || type === 'table') { - setTable($scope.paragraph.result, refresh); - } - else { - setD3Chart(type, $scope.paragraph.result, refresh); - } - } - }; - - var setNewMode = function(newMode) { - var newConfig = angular.copy($scope.paragraph.config); - var newParams = angular.copy($scope.paragraph.settings.params); - - // graph options - newConfig.graph.mode = newMode; - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - var commitParagraph = function(title, text, config, params) { - var parapgraphData = { - op: 'COMMIT_PARAGRAPH', - data: { - id: $scope.paragraph.id, - title : title, - paragraph: text, - params: params, - config: config - }}; - $rootScope.$emit('sendNewEvent', parapgraphData); - }; - - var setTable = function(type, data, refresh) { - var getTableContentFormat = function(d) { - if (isNaN(d)) { - if (d.length>'%html'.length && '%html ' === d.substring(0, '%html '.length)) { - return 'html'; - } else { - return ''; - } - } else { - return ''; - } - }; - - var formatTableContent = function(d) { - if (isNaN(d)) { - var f = getTableContentFormat(d); - if (f !== '') { - return d.substring(f.length+2); - } else { - return d; - } - } else { - var dStr = d.toString(); - var splitted = dStr.split('.'); - var formatted = splitted[0].replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,'); - if (splitted.length>1) { - formatted+= '.'+splitted[1]; - } - return formatted; - } - }; - - - var renderTable = function() { - var html = ''; - html += ''; - html += ' '; - html += ' '; - for (var c in $scope.paragraph.result.columnNames) { - html += ''; - } - html += ' '; - html += ' '; - - for (var r in $scope.paragraph.result.msgTable) { - var row = $scope.paragraph.result.msgTable[r]; - html += ' '; - for (var index in row) { - var v = row[index].value; - if (getTableContentFormat(v) !== 'html') { - v = v.replace(/[\u00A0-\u9999<>\&]/gim, function(i) { - return '&#'+i.charCodeAt(0)+';'; - }); - } - html += ' '; - } - html += ' '; - } - - html += '
'+$scope.paragraph.result.columnNames[c].name+'
'+formatTableContent(v)+'
'; - - $('#p' + $scope.paragraph.id + '_table').html(html); - $('#p' + $scope.paragraph.id + '_table').perfectScrollbar(); - - // set table height - var height = $scope.paragraph.config.graph.height; - $('#p'+$scope.paragraph.id+'_table').height(height); - }; - - var retryRenderer = function() { - if ($('#p'+$scope.paragraph.id+'_table').length) { - try { - renderTable(); - } catch(err) { - console.log('Chart drawing error %o', err); - } - } else { - $timeout(retryRenderer,10); - } - }; - $timeout(retryRenderer); - - }; - - var setD3Chart = function(type, data, refresh) { - if (!$scope.chart[type]) { - var chart = nv.models[type](); - $scope.chart[type] = chart; - } - - var d3g = []; - - if (type === 'scatterChart') { - var scatterData = setScatterChart(data, refresh); - - var xLabels = scatterData.xLabels; - var yLabels = scatterData.yLabels; - d3g = scatterData.d3g; - - $scope.chart[type].xAxis.tickFormat(function(d) { - if (xLabels[d] && (isNaN(parseFloat(xLabels[d])) || !isFinite(xLabels[d]))) { - return xLabels[d]; - } else { - return d; - } - }); - - $scope.chart[type].yAxis.tickFormat(function(d) { - if (yLabels[d] && (isNaN(parseFloat(yLabels[d])) || !isFinite(yLabels[d]))) { - return yLabels[d]; - } else { - return d; - } - }); - - // configure how the tooltip looks. - $scope.chart[type].tooltipContent(function(key, x, y, data) { - var tooltipContent = '

' + key + '

'; - if ($scope.paragraph.config.graph.scatter.size && - $scope.isValidSizeOption($scope.paragraph.config.graph.scatter, $scope.paragraph.result.rows)) { - tooltipContent += '

' + data.point.size + '

'; - } - - return tooltipContent; - }); - - $scope.chart[type].showDistX(true) - .showDistY(true) - //handle the problem of tooltip not showing when muliple points have same value. - .scatter.useVoronoi(false); - } else { - var p = pivot(data); - if (type === 'pieChart') { - var d = pivotDataToD3ChartFormat(p, true).d3g; - - $scope.chart[type].x(function(d) { return d.label;}) - .y(function(d) { return d.value;}); - - if ( d.length > 0 ) { - for ( var i=0; i numberOfDataThreshold) { - animationDuration = 0; - } - } catch(ignoreErr) { - } - - var chartEl = d3.select('#p'+$scope.paragraph.id+'_'+type+' svg') - .attr('height', $scope.paragraph.config.graph.height) - .style('height', height + 'px') - .datum(d3g) - .transition() - .duration(animationDuration) - .call($scope.chart[type]); - nv.utils.windowResize($scope.chart[type].update); - }; - - var retryRenderer = function() { - if ($('#p'+$scope.paragraph.id+'_'+type+' svg').length !== 0) { - try { - renderChart(); - } catch(err) { - console.log('Chart drawing error %o', err); - } - } else { - $timeout(retryRenderer,10); - } - }; - $timeout(retryRenderer); - }; - - $scope.isGraphMode = function(graphName) { - if ($scope.getResultType() === 'TABLE' && $scope.getGraphMode()===graphName) { - return true; - } else { - return false; - } - }; - - - $scope.onGraphOptionChange = function() { - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - $scope.removeGraphOptionKeys = function(idx) { - $scope.paragraph.config.graph.keys.splice(idx, 1); - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - $scope.removeGraphOptionValues = function(idx) { - $scope.paragraph.config.graph.values.splice(idx, 1); - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - $scope.removeGraphOptionGroups = function(idx) { - $scope.paragraph.config.graph.groups.splice(idx, 1); - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - $scope.setGraphOptionValueAggr = function(idx, aggr) { - $scope.paragraph.config.graph.values[idx].aggr = aggr; - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - $scope.removeScatterOptionXaxis = function(idx) { - $scope.paragraph.config.graph.scatter.xAxis = null; - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - $scope.removeScatterOptionYaxis = function(idx) { - $scope.paragraph.config.graph.scatter.yAxis = null; - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - $scope.removeScatterOptionGroup = function(idx) { - $scope.paragraph.config.graph.scatter.group = null; - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - $scope.removeScatterOptionSize = function(idx) { - $scope.paragraph.config.graph.scatter.size = null; - clearUnknownColsFromGraphOption(); - $scope.setGraphMode($scope.paragraph.config.graph.mode, true, false); - }; - - /* Clear unknown columns from graph option */ - var clearUnknownColsFromGraphOption = function() { - var unique = function(list) { - for (var i = 0; i 0) { - $scope.paragraph.config.graph.keys.push($scope.paragraph.result.columnNames[0]); - } - - if ($scope.paragraph.config.graph.values.length === 0 && $scope.paragraph.result.columnNames.length > 1) { - $scope.paragraph.config.graph.values.push($scope.paragraph.result.columnNames[1]); - } - - if (!$scope.paragraph.config.graph.scatter.xAxis && !$scope.paragraph.config.graph.scatter.yAxis) { - if ($scope.paragraph.result.columnNames.length > 1) { - $scope.paragraph.config.graph.scatter.xAxis = $scope.paragraph.result.columnNames[0]; - $scope.paragraph.config.graph.scatter.yAxis = $scope.paragraph.result.columnNames[1]; - } else if ($scope.paragraph.result.columnNames.length === 1) { - $scope.paragraph.config.graph.scatter.xAxis = $scope.paragraph.result.columnNames[0]; - } - } - }; - - var pivot = function(data) { - var keys = $scope.paragraph.config.graph.keys; - var groups = $scope.paragraph.config.graph.groups; - var values = $scope.paragraph.config.graph.values; - - var aggrFunc = { - sum : function(a,b) { - var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0; - var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0; - return varA+varB; - }, - count : function(a,b) { - var varA = (a !== undefined) ? parseInt(a) : 0; - var varB = (b !== undefined) ? 1 : 0; - return varA+varB; - }, - min : function(a,b) { - var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0; - var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0; - return Math.min(varA,varB); - }, - max : function(a,b) { - var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0; - var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0; - return Math.max(varA,varB); - }, - avg : function(a,b,c) { - var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0; - var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0; - return varA+varB; - } - }; - - var aggrFuncDiv = { - sum : false, - count : false, - min : false, - max : false, - avg : true - }; - - var schema = {}; - var rows = {}; - - for (var i=0; i < data.rows.length; i++) { - var row = data.rows[i]; - var newRow = {}; - var s = schema; - var p = rows; - - for (var k=0; k < keys.length; k++) { - var key = keys[k]; - - // add key to schema - if (!s[key.name]) { - s[key.name] = { - order : k, - index : key.index, - type : 'key', - children : {} - }; - } - s = s[key.name].children; - - // add key to row - var keyKey = row[key.index]; - if (!p[keyKey]) { - p[keyKey] = {}; - } - p = p[keyKey]; - } - - for (var g=0; g < groups.length; g++) { - var group = groups[g]; - var groupKey = row[group.index]; - - // add group to schema - if (!s[groupKey]) { - s[groupKey] = { - order : g, - index : group.index, - type : 'group', - children : {} - }; - } - s = s[groupKey].children; - - // add key to row - if (!p[groupKey]) { - p[groupKey] = {}; - } - p = p[groupKey]; - } - - for (var v=0; v < values.length; v++) { - var value = values[v]; - var valueKey = value.name+'('+value.aggr+')'; - - // add value to schema - if (!s[valueKey]) { - s[valueKey] = { - type : 'value', - order : v, - index : value.index - }; - } - - // add value to row - if (!p[valueKey]) { - p[valueKey] = { - value : (value.aggr !== 'count') ? row[value.index] : 1, - count: 1 - }; - } else { - p[valueKey] = { - value : aggrFunc[value.aggr](p[valueKey].value, row[value.index], p[valueKey].count+1), - count : (aggrFuncDiv[value.aggr]) ? p[valueKey].count+1 : p[valueKey].count - }; - } - } - } - - //console.log("schema=%o, rows=%o", schema, rows); - - return { - schema : schema, - rows : rows - }; - }; - - var pivotDataToD3ChartFormat = function(data, allowTextXAxis, fillMissingValues, chartType) { - // construct d3 data - var d3g = []; - - var schema = data.schema; - var rows = data.rows; - var values = $scope.paragraph.config.graph.values; - - var concat = function(o, n) { - if (!o) { - return n; - } else { - return o+'.'+n; - } - }; - - var getSchemaUnderKey = function(key, s) { - for (var c in key.children) { - s[c] = {}; - getSchemaUnderKey(key.children[c], s[c]); - } - }; - - var traverse = function(sKey, s, rKey, r, func, rowName, rowValue, colName) { - //console.log("TRAVERSE sKey=%o, s=%o, rKey=%o, r=%o, rowName=%o, rowValue=%o, colName=%o", sKey, s, rKey, r, rowName, rowValue, colName); - - if (s.type==='key') { - rowName = concat(rowName, sKey); - rowValue = concat(rowValue, rKey); - } else if (s.type==='group') { - colName = concat(colName, rKey); - } else if (s.type==='value' && sKey===rKey || valueOnly) { - colName = concat(colName, rKey); - func(rowName, rowValue, colName, r); - } - - for (var c in s.children) { - if (fillMissingValues && s.children[c].type === 'group' && r[c] === undefined) { - var cs = {}; - getSchemaUnderKey(s.children[c], cs); - traverse(c, s.children[c], c, cs, func, rowName, rowValue, colName); - continue; - } - - for (var j in r) { - if (s.children[c].type === 'key' || c === j) { - traverse(c, s.children[c], j, r[j], func, rowName, rowValue, colName); - } - } - } - }; - - var keys = $scope.paragraph.config.graph.keys; - var groups = $scope.paragraph.config.graph.groups; - var values = $scope.paragraph.config.graph.values; - var valueOnly = (keys.length === 0 && groups.length === 0 && values.length > 0); - var noKey = (keys.length === 0); - var isMultiBarChart = (chartType === 'multiBarChart'); - - var sKey = Object.keys(schema)[0]; - - var rowNameIndex = {}; - var rowIdx = 0; - var colNameIndex = {}; - var colIdx = 0; - var rowIndexValue = {}; - - for (var k in rows) { - traverse(sKey, schema[sKey], k, rows[k], function(rowName, rowValue, colName, value) { - //console.log("RowName=%o, row=%o, col=%o, value=%o", rowName, rowValue, colName, value); - if (rowNameIndex[rowValue] === undefined) { - rowIndexValue[rowIdx] = rowValue; - rowNameIndex[rowValue] = rowIdx++; - } - - if (colNameIndex[colName] === undefined) { - colNameIndex[colName] = colIdx++; - } - var i = colNameIndex[colName]; - if (noKey && isMultiBarChart) { - i = 0; - } - - if (!d3g[i]) { - d3g[i] = { - values : [], - key : (noKey && isMultiBarChart) ? 'values' : colName - }; - } - - var xVar = isNaN(rowValue) ? ((allowTextXAxis) ? rowValue : rowNameIndex[rowValue]) : parseFloat(rowValue); - var yVar = 0; - if (xVar === undefined) { xVar = colName; } - if (value !== undefined) { - yVar = isNaN(value.value) ? 0 : parseFloat(value.value) / parseFloat(value.count); - } - d3g[i].values.push({ - x : xVar, - y : yVar - }); - }); - } - - // clear aggregation name, if possible - var namesWithoutAggr = {}; - // TODO - This part could use som refactoring - Weird if/else with similar actions and variable names - for (var colName in colNameIndex) { - var withoutAggr = colName.substring(0, colName.lastIndexOf('(')); - if (!namesWithoutAggr[withoutAggr]) { - namesWithoutAggr[withoutAggr] = 1; - } else { - namesWithoutAggr[withoutAggr]++; - } - } - - if (valueOnly) { - for (var valueIndex = 0; valueIndex < d3g[0].values.length; valueIndex++) { - var colName = d3g[0].values[valueIndex].x; - if (!colName) { - continue; - } - - var withoutAggr = colName.substring(0, colName.lastIndexOf('(')); - if (namesWithoutAggr[withoutAggr] <= 1 ) { - d3g[0].values[valueIndex].x = withoutAggr; - } - } - } else { - for (var d3gIndex = 0; d3gIndex < d3g.length; d3gIndex++) { - var colName = d3g[d3gIndex].key; - var withoutAggr = colName.substring(0, colName.lastIndexOf('(')); - if (namesWithoutAggr[withoutAggr] <= 1 ) { - d3g[d3gIndex].key = withoutAggr; - } - } - - // use group name instead of group.value as a column name, if there're only one group and one value selected. - if (groups.length === 1 && values.length === 1) { - for (d3gIndex = 0; d3gIndex < d3g.length; d3gIndex++) { - var colName = d3g[d3gIndex].key; - colName = colName.substring(0, colName.lastIndexOf(".")); - d3g[d3gIndex].key = colName; - } - } - - } - - return { - xLabels : rowIndexValue, - d3g : d3g - }; - }; - - - var setDiscreteScatterData = function(data) { - var xAxis = $scope.paragraph.config.graph.scatter.xAxis; - var yAxis = $scope.paragraph.config.graph.scatter.yAxis; - var group = $scope.paragraph.config.graph.scatter.group; - - var xValue; - var yValue; - var grp; - - var rows = {}; - - for (var i = 0; i < data.rows.length; i++) { - var row = data.rows[i]; - if (xAxis) { - xValue = row[xAxis.index]; - } - if (yAxis) { - yValue = row[yAxis.index]; - } - if (group) { - grp = row[group.index]; - } - - var key = xValue + ',' + yValue + ',' + grp; - - if(!rows[key]) { - rows[key] = { - x : xValue, - y : yValue, - group : grp, - size : 1 - }; - } else { - rows[key].size++; - } - } - - // change object into array - var newRows = []; - for(var r in rows){ - var newRow = []; - if (xAxis) { newRow[xAxis.index] = rows[r].x; } - if (yAxis) { newRow[yAxis.index] = rows[r].y; } - if (group) { newRow[group.index] = rows[r].group; } - newRow[data.rows[0].length] = rows[r].size; - newRows.push(newRow); - } - return newRows; - }; - - var setScatterChart = function(data, refresh) { - var xAxis = $scope.paragraph.config.graph.scatter.xAxis; - var yAxis = $scope.paragraph.config.graph.scatter.yAxis; - var group = $scope.paragraph.config.graph.scatter.group; - var size = $scope.paragraph.config.graph.scatter.size; - - var xValues = []; - var yValues = []; - var rows = {}; - var d3g = []; - - var rowNameIndex = {}; - var colNameIndex = {}; - var grpNameIndex = {}; - var rowIndexValue = {}; - var colIndexValue = {}; - var grpIndexValue = {}; - var rowIdx = 0; - var colIdx = 0; - var grpIdx = 0; - var grpName = ''; - - var xValue; - var yValue; - var row; - - if (!xAxis && !yAxis) { - return { - d3g : [] - }; - } - - for (var i = 0; i < data.rows.length; i++) { - row = data.rows[i]; - if (xAxis) { - xValue = row[xAxis.index]; - xValues[i] = xValue; - } - if (yAxis) { - yValue = row[yAxis.index]; - yValues[i] = yValue; - } - } - - var isAllDiscrete = ((xAxis && yAxis && isDiscrete(xValues) && isDiscrete(yValues)) || - (!xAxis && isDiscrete(yValues)) || - (!yAxis && isDiscrete(xValues))); - - if (isAllDiscrete) { - rows = setDiscreteScatterData(data); - } else { - rows = data.rows; - } - - if (!group && isAllDiscrete) { - grpName = 'count'; - } else if (!group && !size) { - if (xAxis && yAxis) { - grpName = '(' + xAxis.name + ', ' + yAxis.name + ')'; - } else if (xAxis && !yAxis) { - grpName = xAxis.name; - } else if (!xAxis && yAxis) { - grpName = yAxis.name; - } - } else if (!group && size) { - grpName = size.name; - } - - for (i = 0; i < rows.length; i++) { - row = rows[i]; - if (xAxis) { - xValue = row[xAxis.index]; - } - if (yAxis) { - yValue = row[yAxis.index]; - } - if (group) { - grpName = row[group.index]; - } - var sz = (isAllDiscrete) ? row[row.length-1] : ((size) ? row[size.index] : 1); - - if (grpNameIndex[grpName] === undefined) { - grpIndexValue[grpIdx] = grpName; - grpNameIndex[grpName] = grpIdx++; - } - - if (xAxis && rowNameIndex[xValue] === undefined) { - rowIndexValue[rowIdx] = xValue; - rowNameIndex[xValue] = rowIdx++; - } - - if (yAxis && colNameIndex[yValue] === undefined) { - colIndexValue[colIdx] = yValue; - colNameIndex[yValue] = colIdx++; - } - - if (!d3g[grpNameIndex[grpName]]) { - d3g[grpNameIndex[grpName]] = { - key : grpName, - values : [] - }; - } - - d3g[grpNameIndex[grpName]].values.push({ - x : xAxis ? (isNaN(xValue) ? rowNameIndex[xValue] : parseFloat(xValue)) : 0, - y : yAxis ? (isNaN(yValue) ? colNameIndex[yValue] : parseFloat(yValue)) : 0, - size : isNaN(parseFloat(sz))? 1 : parseFloat(sz) - }); - } - - return { - xLabels : rowIndexValue, - yLabels : colIndexValue, - d3g : d3g - }; - }; - - var isDiscrete = function(field) { - var getUnique = function(f) { - var uniqObj = {}; - var uniqArr = []; - var j = 0; - for (var i = 0; i < f.length; i++) { - var item = f[i]; - if(uniqObj[item] !== 1) { - uniqObj[item] = 1; - uniqArr[j++] = item; - } - } - return uniqArr; - }; - - for (var i = 0; i < field.length; i++) { - if(isNaN(parseFloat(field[i])) && - (typeof field[i] === 'string' || field[i] instanceof String)) { - return true; - } - } - - var threshold = 0.05; - var unique = getUnique(field); - if (unique.length/field.length < threshold) { - return true; - } else { - return false; - } - }; - - $scope.isValidSizeOption = function (options, rows) { - var xValues = []; - var yValues = []; - - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - var size = row[options.size.index]; - - //check if the field is numeric - if (isNaN(parseFloat(size)) || !isFinite(size)) { - return false; - } - - if (options.xAxis) { - var x = row[options.xAxis.index]; - xValues[i] = x; - } - if (options.yAxis) { - var y = row[options.yAxis.index]; - yValues[i] = y; - } - } - - //check if all existing fields are discrete - var isAllDiscrete = ((options.xAxis && options.yAxis && isDiscrete(xValues) && isDiscrete(yValues)) || - (!options.xAxis && isDiscrete(yValues)) || - (!options.yAxis && isDiscrete(xValues))); - - if (isAllDiscrete) { - return false; - } - - return true; - }; - - $scope.setGraphHeight = function() { - var height = $('#p'+$scope.paragraph.id+'_graph').height(); - - var newParams = angular.copy($scope.paragraph.settings.params); - var newConfig = angular.copy($scope.paragraph.config); - - newConfig.graph.height = height; - - commitParagraph($scope.paragraph.title, $scope.paragraph.text, newConfig, newParams); - }; - - /** Utility function */ - if (typeof String.prototype.startsWith !== 'function') { - String.prototype.startsWith = function(str) { - return this.slice(0, str.length) === str; - }; - } - - $scope.goToSingleParagraph = function () { - var noteId = $route.current.pathParams.noteId; - var redirectToUrl = location.protocol + '//' + location.host + '/#/notebook/' + noteId + '/paragraph/' + $scope.paragraph.id+'?asIframe'; - $window.open(redirectToUrl); - }; -}); diff --git a/zeppelin-web/app/styles/notebook.css b/zeppelin-web/app/styles/notebook.css deleted file mode 100644 index b5eb511a21d..00000000000 --- a/zeppelin-web/app/styles/notebook.css +++ /dev/null @@ -1,508 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.paragraph-col { - margin: 0 0 0 0px; - padding: 0 0 0 0px; -} - -.paragraph { - padding: 2px 8px 4px 8px; - min-height: 32px; -} - -.paragraph .tableDisplay .hljs { - background: none; -} - -.paragraph .ace_print-margin { - background: none !important; -} - -.paragraphAsIframe{ - padding: 0px 0px 0px 0px; - margin-top: -79px; - margin-left: -10px; - margin-right: -10px; -} - -.paragraphAsIframe .control { - background-color: rgba(255,255,255,0.9); - border-top: 1px solid #EFEFEF; - display: none; - float: right; - color: #999; - margin-top: -9px; - margin-right:0px; - position:absolute; - clear:both; - right:25px; - /*z-index:10;*/ -} - -.paragraphAsIframe table { - margin-bottom: 0px; -} - -.paragraphAsIframe .editor { - width: 100%; - border-left: 4px solid #EEEEEE; - background: rgba(255, 255, 255, 0.9); -} - -.paragraphAsIframe .text { - white-space: pre; - display: block; - unicode-bidi: embed; - display: block !important; - margin: 0 0 10px!important; - font-size: 12px!important; - line-height: 1.42857143!important; - word-break: break-all!important; - word-wrap: break-word!important; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; -} - -.ace_marker-layer .ace_selection { - z-index: 0 !important; -} - -.ace_marker-layer .ace_selected-word { - z-index: 0 !important; -} - -.labelBtn { - padding: .2em .6em .3em; - font-size: 75%; - font-weight: bold; - line-height: 1; - color: #fff; - text-align: center; - white-space: nowrap; - border-radius: .25em; -} - -.note-jump { - margin-top: 20px; -} - -.noteBtnfa { - margin-left: 3px; -} - -.control span { - margin-left: 4px; -} - -.control { - padding: 4px; -} - -.paragraph-space { - margin-bottom: 5px; - padding: 10px !important; -} - -.paragraph .control { - background-color: rgba(255,255,255,0.85); - /*display: none;*/ - float: right; - color: #999; - margin-top: 1px; - margin-right: 5px; - position:absolute; - clear:both; - right:15px; - top: 16px; - text-align:right; - font-size:12px; -} - -.paragraph .control li{ - font-size:12px; - margin-bottom:4px; - color: #333333; -} - -.paragraph table { - margin-bottom: 0px; -} - -.paragraph .title { - margin: 3px 0px 0px 0px; - height: 20px; - font-size: 12px; -} - -.paragraph .title div { - width: 80%; - font-weight: bold; - font-family: 'Roboto', sans-serif; - font-size: 17px !important; - text-transform: capitalize; -} - -.paragraph .title input { - width: 80%; - line-height: 1.42857143; - color: #555; - background-color: #fff; - background-image: none; - border: 1px solid #ccc; - border-radius: 0px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - text-transform: capitalize; - font-family: 'Roboto', sans-serif; - font-size: 14px!important; -} - -.paragraph .editor { - width: 100%; - border-left: 4px solid #DDDDDD; - background: rgba(255, 255, 255, 0.0); - margin: 7px 0 2px 0px; -} - -.paragraph .text { - white-space: pre; - display: block; - unicode-bidi: embed; - display: block !important; - margin: 0 0 0px !important; - line-height: 1.42857143 !important; - word-break: break-all !important; - word-wrap: break-word !important; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; - font-size: 12px !important; - margin-bottom: 5px !important; -} - -.paragraph p { - margin : 0 0 0 0px; -} - -.paragraph div svg { - width : 100%; -} - -.ace-tm { - background-color: #FFFFFF; - color: black; -} -.ace_editor { - position: relative; - overflow: hidden; - font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; - font-size: 12px; - line-height: normal; - direction: ltr; -} - -.ace_hidden-cursors {opacity:0} - -/** Remove z-index to ace */ -.ace_text-input, .ace_gutter, .ace_layer, -.emacs-mode, .ace_text-layer, .ace_cursor-layer, -.ace_cursor, .ace_scrollbar { - z-index:auto !important; -} - -/** Force opacity:0 to textarea in writing texts **/ -.ace_text-input.ace_composition { - opacity: 0 !important; -} - -#main .emacs-mode .ace_cursor { - background-color:#C0C0C0!important; - border: none !important; -} - -.paragraph .status { - font-size: 10px; - color: #AAAAAA; - text-align: right; - visibility: hidden; -} - -.paragraph .runControl { - font-size: 1px; - color: #AAAAAA; - height:4px; - margin: 1px 0px 0px 0px; -} - -.paragraph .runControl .progress { - position: relative; - width:100%; - height:4px; - z-index:100; - border-radius: 0px; -} - -.paragraph .runControl .progress .progress-bar { - z-index:100; -} - -.paragraph .executionTime { - color: #999; - font-size: 10px; - font-family: 'Roboto', sans-serif; -} - - -.disable { - opacity:0.4!important; - pointer-events: none; -} - -.noteAction { - margin-left: -10px; - margin-right: -10px; - margin-top: -10px; - font-family: 'Roboto', sans-serif; -} - -.noteAction li{ - font-size:12px; - margin-bottom:4px; - color: #333333; -} - -.new_h3 { - margin-top: 1px; - padding-top: 7px; -} - -.form-control2 { - width: 100%; - margin-left: 15px; - font-size: 29px; - line-height: 1.42857143; - color: #555; - background-color: #fff; - background-image: none; - border: 1px solid #ccc; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; -} - -.form-control-static2 { - padding-top: 7px; - font-size: 29px; - margin-left: 15px; - padding-bottom: 7px; - margin-bottom: 0; - display: inline-block; -} - -/* panel default */ -.panel-default { - /* border: none; */ - border-color: #DDDDDD; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); -} - -.panel-group .panel-default { - /*border: solid #e5e5e5; - border-width: 1px 1px 2px;*/ -} - -.panel-default > .panel-heading { - color: #34495e; - background-color: #ffffff; - border-color: #e5e5e5; -} - -.panel-default > .panel-heading + .panel-collapse .panel-body { - border-top-color: #e5e5e5; -} - -.panel-default > .panel-heading > .dropdown .caret { - border-color: #ecf0f1 transparent; -} - -.panel-default > .panel-footer + .panel-collapse .panel-body { - border-bottom-color: #e5e5e5; -} - -.panel-body-heading { - position: relative; - display: block; - padding-left: 10px; - padding-top: 15px; - padding-bottom: 15px; -} - -.paragraph-margin { - margin-right: 2px; - margin-left: 2px; -} - -.tableDisplay img { - display: block; - max-width: 100%; - height: auto; -} - -.tableDisplay .btn-group span { - margin: 10px 0px 0px 10px; - font-size:12px; -} -.tableDisplay .btn-group span a { - cursor:pointer; -} - -.tableDisplay .option { - padding: 5px 5px 5px 5px; - font-size:12px; - height:auto; - overflow : auto; - /*min-height: 200px;*/ - border-top: 1px solid #ecf0f1; - -} - -.tableDisplay .option .columns { - height: 100%; -} - -.tableDisplay .option .columns ul { - - background-color: white; - /*min-width: 100px;*/ - width:auto; - padding: 3px 3px 3px 3px; - height : 150px; - border: 1px solid #CCC; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); - -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; - -} - -.tableDisplay .option .columns ul li { - margin: 3px 3px 3px 3px; -} - -.tableDisplay .option .columns ul li span { - cursor: pointer; - margin-left: 3px; - margin-top: 3px; -} - -.tableDisplay .option .columns ul li div ul { /* aggregation menu */ - width:auto; - height:auto; -} - -.tableDisplay .option .columns ul li div ul li a { - padding: 0px; - margin: 0px; - cursor: pointer; -} - -.tableDisplay .option .columns a:focus, -.tableDisplay .option .columns a:hover { - text-decoration: none; - outline: 0; - outline-offset: 0px; -} - -.graphContainer { - position:relative; - margin-bottom: 5px; - overflow: visible; -} - -.noOverflow { - overflow: hidden !important; -} - -.graphContainer .table { - overflow: hidden; - margin-bottom: 5px !important; -} - -.allFields { - margin-bottom: 10px; -} -.noDot { - list-style-type: none; - padding-left:5px; -} - -.liVertical { - display:block; - float:left; - padding: 5px; -} -.row { - margin-right: 0px !important -} - -.lightBold { - font-weight: 500; -} - -.resizable-helper { - border: 3px solid #DDDDDD; -} - -/* note setting panel */ -.setting { - background-color: white; - padding: 10px 15px 15px 15px; - margin-left: -10px; - margin-right: -10px; - font-family: 'Roboto', sans-serif; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); - border-bottom: 1px solid #E5E5E5; -} - -.setting .interpreterSettings { - list-style-type: none; - background-color: #EFEFEF; - padding: 10px 10px 10px 10px; - box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.15); - border: 1px solid #E5E5E5; -} - -.setting .interpreterSettings div div { - margin: 2px 0px 2px 0px; -} - -.setting .interpreterSettings div div { - cursor: pointer; -} - -.setting .modal-header { - border: 0px; -} - -.setting .modal-body { - border: 0px; -} - -.setting .modal-footer { - border: 0px; -} diff --git a/zeppelin-web/app/views/notebooks.html b/zeppelin-web/app/views/notebooks.html deleted file mode 100644 index f3294a1a2d9..00000000000 --- a/zeppelin-web/app/views/notebooks.html +++ /dev/null @@ -1,170 +0,0 @@ - - -
-
-

- -

{{note.name || 'Note ' + note.id}}

- - - - - - - - - - - -
- - -
-
- -
- - - - - - - - - - - -
-

-
- - -
-
-

Settings

-
-
-
-
Interpreter binding
-

- Bind interpreter for this note. - Click to Bind/Unbind interpreter. - Drag and drop to reorder interpreters.
- The first interpreter on the list becomes default. To create/remove interpreters, go to Interpreter menu. -

- -
-
-
{{item.name}} , %{{intp.name}}
-
-
-
-
-
- - -
-
- -
- - -
-
-
-
-
-
diff --git a/zeppelin-web/app/views/paragraph.html b/zeppelin-web/app/views/paragraph.html deleted file mode 100644 index ef4daaaee1b..00000000000 --- a/zeppelin-web/app/views/paragraph.html +++ /dev/null @@ -1,449 +0,0 @@ - - -
- -
- -
-
-
- -
-
-
-
-
- -
-
-
-
- -
-
-
-
-
- {{getProgress()}}% -
-
-
- -
-
- -
- - - - -
-
-
- - -
-
- - - - - - -
- - - settings - - - settings - - - -
- All fields: -
-
    -
  • -
    - {{col.name | limitTo: 30}}{{col.name.length > 30 ? '...' : ''}} -
    -
  • -
-
- -
-
- - Keys -
    -
  • - -
  • -
-
-
-
- - Groups -
    -
  • - -
  • -
-
-
-
- - Values -
    -
  • -
    - - -
    -
  • -
-
-
-
- -
-
- - xAxis -
    -
  • - -
  • -
-
-
-
- - yAxis -
    -
  • - -
  • -
-
-
-
- - group -
    -
  • - -
  • -
-
-
-
- - size - -
    -
  • - -
  • -
-
-
-
- -
- - -
- -
-
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- -
-
- -
-
- -
-
- -
-
- - - - -
-
- -
-
-
-
-
- - - {{paragraph.status}} - - - - {{getProgress()}}% - - - - - - - - - - - - - - -
-
diff --git a/zeppelin-web/package.json b/zeppelin-web/package.json index 670ab7f7739..e984e889ecc 100644 --- a/zeppelin-web/package.json +++ b/zeppelin-web/package.json @@ -1,7 +1,10 @@ { "name": "zeppelin-web", "version": "0.0.0", - "dependencies": {}, + "dependencies": { + "grunt-angular-templates": "^0.5.7", + "grunt-dom-munger": "^3.4.0" + }, "devDependencies": { "bower": "", "grunt": "^0.4.1", diff --git a/zeppelin-web/pom.xml b/zeppelin-web/pom.xml index f4549ad1674..4273ed91304 100644 --- a/zeppelin-web/pom.xml +++ b/zeppelin-web/pom.xml @@ -50,7 +50,7 @@ **/.settings/* **/.classpath **/.project - **/target/** + **/target/** node/** node_modules/** bower_components/** @@ -93,7 +93,7 @@ npm - + bower install From 0ee04a2a33a11e767fe0df50c98d093cc9a036c3 Mon Sep 17 00:00:00 2001 From: Damien Corneau Date: Wed, 29 Apr 2015 12:06:43 +0900 Subject: [PATCH 03/29] Fix Grunt watch --- zeppelin-web/Gruntfile.js | 22 +++++++++++------- zeppelin-web/app/app/home/home.html | 1 + .../components/navbar/navbar.controller.js | 2 ++ .../app/{assets => }/fonts/FontAwesome.otf | Bin .../{assets => }/fonts/Simple-Line-Icons.eot | Bin .../{assets => }/fonts/Simple-Line-Icons.svg | 0 .../{assets => }/fonts/Simple-Line-Icons.ttf | Bin .../{assets => }/fonts/Simple-Line-Icons.woff | Bin .../app/{assets => }/fonts/custom-font.eot | Bin .../app/{assets => }/fonts/custom-font.svg | 0 .../app/{assets => }/fonts/custom-font.ttf | Bin .../app/{assets => }/fonts/custom-font.woff | Bin .../fonts/fontawesome-webfont.eot | Bin .../fonts/fontawesome-webfont.svg | 0 .../fonts/fontawesome-webfont.ttf | Bin .../fonts/fontawesome-webfont.woff | Bin zeppelin-web/app/index.html | 14 ++++++----- 17 files changed, 24 insertions(+), 15 deletions(-) rename zeppelin-web/app/{assets => }/fonts/FontAwesome.otf (100%) rename zeppelin-web/app/{assets => }/fonts/Simple-Line-Icons.eot (100%) rename zeppelin-web/app/{assets => }/fonts/Simple-Line-Icons.svg (100%) rename zeppelin-web/app/{assets => }/fonts/Simple-Line-Icons.ttf (100%) rename zeppelin-web/app/{assets => }/fonts/Simple-Line-Icons.woff (100%) rename zeppelin-web/app/{assets => }/fonts/custom-font.eot (100%) rename zeppelin-web/app/{assets => }/fonts/custom-font.svg (100%) rename zeppelin-web/app/{assets => }/fonts/custom-font.ttf (100%) rename zeppelin-web/app/{assets => }/fonts/custom-font.woff (100%) rename zeppelin-web/app/{assets => }/fonts/fontawesome-webfont.eot (100%) rename zeppelin-web/app/{assets => }/fonts/fontawesome-webfont.svg (100%) rename zeppelin-web/app/{assets => }/fonts/fontawesome-webfont.ttf (100%) rename zeppelin-web/app/{assets => }/fonts/fontawesome-webfont.woff (100%) diff --git a/zeppelin-web/Gruntfile.js b/zeppelin-web/Gruntfile.js index 944d5a37056..4fd92c32c1a 100644 --- a/zeppelin-web/Gruntfile.js +++ b/zeppelin-web/Gruntfile.js @@ -63,7 +63,10 @@ module.exports = function (grunt) { tasks: ['wiredep'] }, js: { - files: ['<%= yeoman.app %>/{app, components}/**/*.js'], + files: [ + '<%= yeoman.app %>/app/**/*.js', + '<%= yeoman.app %>/components/**/*.js' + ], tasks: ['newer:jshint:all'], options: { livereload: '<%= connect.options.livereload %>' @@ -74,7 +77,11 @@ module.exports = function (grunt) { tasks: ['newer:jshint:test', 'karma'] }, styles: { - files: ['<%= yeoman.app %>/{app, components, assets/styles}/**/*.css'], + files: [ + '<%= yeoman.app %>/app/**/*.css', + '<%= yeoman.app %>/components/**/*.css', + '<%= yeoman.app %>/assets/styles/**/*.css' + ], tasks: ['newer:copy:styles', 'autoprefixer'] }, gruntfile: { @@ -85,7 +92,9 @@ module.exports = function (grunt) { livereload: '<%= connect.options.livereload %>' }, files: [ - '<%= yeoman.app %>/{app, components}/**/*.html', + '<%= yeoman.app %>/app/**/*.html', + '<%= yeoman.app %>/*.html', + '<%= yeoman.app %>/components/**/*.html', '.tmp/styles/{,*/}*.css', '<%= yeoman.app %>/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}' ] @@ -297,18 +306,13 @@ module.exports = function (grunt) { 'assets/styles/**/*', 'assets/images/**/*', 'WEB-INF/*', + 'fonts/*' ] }, { expand : true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>', src: ['app/**/*.html', 'components/**/*.html'] - }, { - expand : true, - flatten: true, - cwd: '<%= yeoman.app %>', - dest: '<%= yeoman.dist %>/fonts/', - src: ['assets/fonts/**/*'] }, { expand: true, cwd: '.tmp/images', diff --git a/zeppelin-web/app/app/home/home.html b/zeppelin-web/app/app/home/home.html index c6e875503f6..bb557f7baa1 100644 --- a/zeppelin-web/app/app/home/home.html +++ b/zeppelin-web/app/app/home/home.html @@ -11,6 +11,7 @@ See the License for the specific language governing permissions and limitations under the License. --> +
diff --git a/zeppelin-web/app/components/navbar/navbar.controller.js b/zeppelin-web/app/components/navbar/navbar.controller.js index 39258452dc5..eac0c4bb22e 100644 --- a/zeppelin-web/app/components/navbar/navbar.controller.js +++ b/zeppelin-web/app/components/navbar/navbar.controller.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + 'use strict'; /** @@ -23,6 +24,7 @@ * * @author anthonycorbacho */ + angular.module('zeppelinWebApp').controller('NavCtrl', function($scope, $rootScope, $routeParams) { /** Current list of notes (ids) */ $scope.notes = []; diff --git a/zeppelin-web/app/assets/fonts/FontAwesome.otf b/zeppelin-web/app/fonts/FontAwesome.otf similarity index 100% rename from zeppelin-web/app/assets/fonts/FontAwesome.otf rename to zeppelin-web/app/fonts/FontAwesome.otf diff --git a/zeppelin-web/app/assets/fonts/Simple-Line-Icons.eot b/zeppelin-web/app/fonts/Simple-Line-Icons.eot similarity index 100% rename from zeppelin-web/app/assets/fonts/Simple-Line-Icons.eot rename to zeppelin-web/app/fonts/Simple-Line-Icons.eot diff --git a/zeppelin-web/app/assets/fonts/Simple-Line-Icons.svg b/zeppelin-web/app/fonts/Simple-Line-Icons.svg similarity index 100% rename from zeppelin-web/app/assets/fonts/Simple-Line-Icons.svg rename to zeppelin-web/app/fonts/Simple-Line-Icons.svg diff --git a/zeppelin-web/app/assets/fonts/Simple-Line-Icons.ttf b/zeppelin-web/app/fonts/Simple-Line-Icons.ttf similarity index 100% rename from zeppelin-web/app/assets/fonts/Simple-Line-Icons.ttf rename to zeppelin-web/app/fonts/Simple-Line-Icons.ttf diff --git a/zeppelin-web/app/assets/fonts/Simple-Line-Icons.woff b/zeppelin-web/app/fonts/Simple-Line-Icons.woff similarity index 100% rename from zeppelin-web/app/assets/fonts/Simple-Line-Icons.woff rename to zeppelin-web/app/fonts/Simple-Line-Icons.woff diff --git a/zeppelin-web/app/assets/fonts/custom-font.eot b/zeppelin-web/app/fonts/custom-font.eot similarity index 100% rename from zeppelin-web/app/assets/fonts/custom-font.eot rename to zeppelin-web/app/fonts/custom-font.eot diff --git a/zeppelin-web/app/assets/fonts/custom-font.svg b/zeppelin-web/app/fonts/custom-font.svg similarity index 100% rename from zeppelin-web/app/assets/fonts/custom-font.svg rename to zeppelin-web/app/fonts/custom-font.svg diff --git a/zeppelin-web/app/assets/fonts/custom-font.ttf b/zeppelin-web/app/fonts/custom-font.ttf similarity index 100% rename from zeppelin-web/app/assets/fonts/custom-font.ttf rename to zeppelin-web/app/fonts/custom-font.ttf diff --git a/zeppelin-web/app/assets/fonts/custom-font.woff b/zeppelin-web/app/fonts/custom-font.woff similarity index 100% rename from zeppelin-web/app/assets/fonts/custom-font.woff rename to zeppelin-web/app/fonts/custom-font.woff diff --git a/zeppelin-web/app/assets/fonts/fontawesome-webfont.eot b/zeppelin-web/app/fonts/fontawesome-webfont.eot similarity index 100% rename from zeppelin-web/app/assets/fonts/fontawesome-webfont.eot rename to zeppelin-web/app/fonts/fontawesome-webfont.eot diff --git a/zeppelin-web/app/assets/fonts/fontawesome-webfont.svg b/zeppelin-web/app/fonts/fontawesome-webfont.svg similarity index 100% rename from zeppelin-web/app/assets/fonts/fontawesome-webfont.svg rename to zeppelin-web/app/fonts/fontawesome-webfont.svg diff --git a/zeppelin-web/app/assets/fonts/fontawesome-webfont.ttf b/zeppelin-web/app/fonts/fontawesome-webfont.ttf similarity index 100% rename from zeppelin-web/app/assets/fonts/fontawesome-webfont.ttf rename to zeppelin-web/app/fonts/fontawesome-webfont.ttf diff --git a/zeppelin-web/app/assets/fonts/fontawesome-webfont.woff b/zeppelin-web/app/fonts/fontawesome-webfont.woff similarity index 100% rename from zeppelin-web/app/assets/fonts/fontawesome-webfont.woff rename to zeppelin-web/app/fonts/fontawesome-webfont.woff diff --git a/zeppelin-web/app/index.html b/zeppelin-web/app/index.html index 691fb48d3d4..91edaa5d007 100644 --- a/zeppelin-web/app/index.html +++ b/zeppelin-web/app/index.html @@ -62,15 +62,17 @@ - I'm zeppelin Zeppelin + + I'm zeppelinZeppelin +