diff --git a/.bowerrc b/.bowerrc new file mode 100755 index 0000000..69fad35 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "bower_components" +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..211002c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + + +[*] + +# Change these settings to your own preference +indent_style = space +indent_size = 2 +draw_white_space = all + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100755 index 0000000..2125666 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..a22a458 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules +dist +.tmp +.sass-cache +bower_components diff --git a/.jshintrc b/.jshintrc new file mode 100755 index 0000000..f750969 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,23 @@ +{ + "node": true, + "browser": true, + "esnext": true, + "bitwise": true, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "immed": true, + "indent": 2, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "single", + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + "smarttabs": true, + "globals": { + "angular": false + } +} diff --git a/.travis.yml b/.travis.yml new file mode 100755 index 0000000..6fb6850 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +sudo: false +language: node_js +node_js: + - 'iojs' + - '0.12' + - '0.10' +before_script: + - 'npm install -g bower grunt-cli' + - 'bower install' diff --git a/.yo-rc.json b/.yo-rc.json new file mode 100755 index 0000000..cb73de6 --- /dev/null +++ b/.yo-rc.json @@ -0,0 +1,62 @@ +{ + "generator-gulp-angular": { + "version": "0.11.0", + "props": { + "angularVersion": "~1.3.4", + "angularModules": [ + { + "key": "animate", + "module": "ngAnimate" + }, + { + "key": "touch", + "module": "ngTouch" + } + ], + "jQuery": { + "key": "jquery1" + }, + "resource": { + "key": "none", + "module": null + }, + "router": { + "key": "ui-router", + "module": "ui.router" + }, + "ui": { + "key": "bootstrap", + "module": null + }, + "bootstrapComponents": { + "key": "ui-bootstrap", + "module": "ui.bootstrap" + }, + "cssPreprocessor": { + "key": "ruby-sass", + "extension": "scss" + }, + "jsPreprocessor": { + "key": "traceur", + "extension": "js", + "srcExtension": "es6" + }, + "htmlPreprocessor": { + "key": "none", + "extension": "html" + }, + "foundationComponents": { + "name": null, + "version": null, + "key": null, + "module": null + }, + "paths": { + "src": "src", + "dist": "dist", + "e2e": "e2e", + "tmp": ".tmp" + } + } + } +} \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..954e2e0 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,444 @@ +// Generated on 2015-06-15 using generator-angular 0.11.1 +'use strict'; + +// # Globbing +// for performance reasons we're only matching one level down: +// 'test/spec/{,*/}*.js' +// use this if you want to recursively match all subfolders: +// 'test/spec/**/*.js' + +module.exports = function (grunt) { + + // Load grunt tasks automatically + require('load-grunt-tasks')(grunt); + + // Time how long tasks take. Can help when optimizing build times + require('time-grunt')(grunt); + + // Configurable paths for the application + var appConfig = { + app: require('./bower.json').appPath || 'app', + dist: 'dist' + }; + + // Define the configuration for all the tasks + grunt.initConfig({ + + // Project settings + yeoman: appConfig, + + // Watches files for changes and runs tasks based on the changed files + watch: { + bower: { + files: ['bower.json'], + tasks: ['wiredep'] + }, + js: { + files: ['<%= yeoman.app %>/scripts/{,*/}*.js'], + tasks: ['newer:jshint:all'], + options: { + livereload: '<%= connect.options.livereload %>' + } + }, + jsTest: { + files: ['test/spec/{,*/}*.js'], + tasks: ['newer:jshint:test', 'karma'] + }, + styles: { + files: ['<%= yeoman.app %>/styles/{,*/}*.css'], + tasks: ['newer:copy:styles', 'autoprefixer'] + }, + gruntfile: { + files: ['Gruntfile.js'] + }, + livereload: { + options: { + livereload: '<%= connect.options.livereload %>' + }, + files: [ + '<%= yeoman.app %>/{,*/}*.html', + '.tmp/styles/{,*/}*.css', + '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' + ] + } + }, + + // The actual grunt server settings + connect: { + options: { + port: 9000, + // Change this to '0.0.0.0' to access the server from outside. + hostname: 'localhost', + livereload: 35729 + }, + livereload: { + options: { + open: true, + middleware: function (connect) { + return [ + connect.static('.tmp'), + connect().use( + '/bower_components', + connect.static('./bower_components') + ), + connect().use( + '/app/styles', + connect.static('./app/styles') + ), + connect.static(appConfig.app) + ]; + } + } + }, + test: { + options: { + port: 9001, + middleware: function (connect) { + return [ + connect.static('.tmp'), + connect.static('test'), + connect().use( + '/bower_components', + connect.static('./bower_components') + ), + connect.static(appConfig.app) + ]; + } + } + }, + dist: { + options: { + open: true, + base: '<%= yeoman.dist %>' + } + } + }, + + // Make sure code styles are up to par and there are no obvious mistakes + jshint: { + options: { + jshintrc: '.jshintrc', + reporter: require('jshint-stylish') + }, + all: { + src: [ + 'Gruntfile.js', + '<%= yeoman.app %>/scripts/{,*/}*.js' + ] + }, + test: { + options: { + jshintrc: 'test/.jshintrc' + }, + src: ['test/spec/{,*/}*.js'] + } + }, + + // Empties folders to start fresh + clean: { + dist: { + files: [{ + dot: true, + src: [ + '.tmp', + '<%= yeoman.dist %>/{,*/}*', + '!<%= yeoman.dist %>/.git{,*/}*' + ] + }] + }, + server: '.tmp' + }, + + // Add vendor prefixed styles + autoprefixer: { + options: { + browsers: ['last 1 version'] + }, + server: { + options: { + map: true, + }, + files: [{ + expand: true, + cwd: '.tmp/styles/', + src: '{,*/}*.css', + dest: '.tmp/styles/' + }] + }, + dist: { + files: [{ + expand: true, + cwd: '.tmp/styles/', + src: '{,*/}*.css', + dest: '.tmp/styles/' + }] + } + }, + + // Automatically inject Bower components into the app + wiredep: { + app: { + src: ['<%= yeoman.app %>/index.html'], + ignorePath: /\.\.\// + }, + test: { + devDependencies: true, + src: '<%= karma.unit.configFile %>', + ignorePath: /\.\.\//, + fileTypes:{ + js: { + block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi, + detect: { + js: /'(.*\.js)'/gi + }, + replace: { + js: '\'{{filePath}}\',' + } + } + } + } + }, + + // 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 + useminPrepare: { + html: '<%= yeoman.app %>/index.html', + options: { + dest: '<%= yeoman.dist %>', + flow: { + html: { + steps: { + js: ['concat', 'uglifyjs'], + css: ['cssmin'] + }, + post: {} + } + } + } + }, + + // Performs rewrites based on filerev and the useminPrepare configuration + usemin: { + html: ['<%= yeoman.dist %>/{,*/}*.html'], + css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], + options: { + assetsDirs: [ + '<%= yeoman.dist %>', + '<%= yeoman.dist %>/images', + '<%= yeoman.dist %>/styles' + ] + } + }, + + // The following *-min tasks will produce minified files in the dist folder + // 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' + // ] + // } + // } + // }, + // uglify: { + // dist: { + // files: { + // '<%= yeoman.dist %>/scripts/scripts.js': [ + // '<%= yeoman.dist %>/scripts/scripts.js' + // ] + // } + // } + // }, + // concat: { + // dist: {} + // }, + + imagemin: { + dist: { + files: [{ + expand: true, + cwd: '<%= yeoman.app %>/images', + src: '{,*/}*.{png,jpg,jpeg,gif}', + dest: '<%= yeoman.dist %>/images' + }] + } + }, + + svgmin: { + dist: { + files: [{ + expand: true, + cwd: '<%= yeoman.app %>/images', + src: '{,*/}*.svg', + dest: '<%= yeoman.dist %>/images' + }] + } + }, + + htmlmin: { + dist: { + options: { + collapseWhitespace: true, + conservativeCollapse: true, + collapseBooleanAttributes: true, + removeCommentsFromCDATA: true, + removeOptionalTags: true + }, + files: [{ + expand: true, + cwd: '<%= yeoman.dist %>', + src: ['*.html', 'views/{,*/}*.html'], + dest: '<%= yeoman.dist %>' + }] + } + }, + + // ng-annotate tries to make the code safe for minification automatically + // by using the Angular long form for dependency injection. + ngAnnotate: { + dist: { + files: [{ + expand: true, + cwd: '.tmp/concat/scripts', + src: '*.js', + dest: '.tmp/concat/scripts' + }] + } + }, + + // Replace Google CDN references + cdnify: { + dist: { + html: ['<%= yeoman.dist %>/*.html'] + } + }, + + // Copies remaining files to places other tasks can use + copy: { + dist: { + files: [{ + expand: true, + dot: true, + cwd: '<%= yeoman.app %>', + dest: '<%= yeoman.dist %>', + src: [ + '*.{ico,png,txt}', + '.htaccess', + '*.html', + 'views/{,*/}*.html', + 'images/{,*/}*.{webp}', + 'styles/fonts/{,*/}*.*' + ] + }, { + expand: true, + cwd: '.tmp/images', + dest: '<%= yeoman.dist %>/images', + src: ['generated/*'] + }, { + expand: true, + cwd: 'bower_components/bootstrap/dist', + src: 'fonts/*', + dest: '<%= yeoman.dist %>' + }] + }, + styles: { + expand: true, + cwd: '<%= yeoman.app %>/styles', + dest: '.tmp/styles/', + src: '{,*/}*.css' + } + }, + + // Run some tasks in parallel to speed up the build process + concurrent: { + server: [ + 'copy:styles' + ], + test: [ + 'copy:styles' + ], + dist: [ + 'copy:styles', + 'imagemin', + 'svgmin' + ] + }, + + // Test settings + karma: { + unit: { + configFile: 'test/karma.conf.js', + singleRun: true + } + } + }); + + + grunt.registerTask('serve', 'Compile then start a connect web server', function (target) { + if (target === 'dist') { + return grunt.task.run(['build', 'connect:dist:keepalive']); + } + + grunt.task.run([ + 'clean:server', + 'wiredep', + 'concurrent:server', + 'autoprefixer:server', + 'connect:livereload', + 'watch' + ]); + }); + + grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) { + grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); + grunt.task.run(['serve:' + target]); + }); + + grunt.registerTask('test', [ + 'clean:server', + 'wiredep', + 'concurrent:test', + 'autoprefixer', + 'connect:test', + 'karma' + ]); + + grunt.registerTask('build', [ + 'clean:dist', + 'wiredep', + 'useminPrepare', + 'concurrent:dist', + 'autoprefixer', + 'concat', + 'ngAnnotate', + 'copy:dist', + 'cdnify', + 'cssmin', + 'uglify', + 'filerev', + 'usemin', + 'htmlmin' + ]); + + grunt.registerTask('default', [ + 'newer:jshint', + 'test', + 'build' + ]); +}; diff --git a/README.md b/README.md index f9715c0..97236f5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ -# Apache Zeppelin -Zeppelin is a collaborative data analytic and visualization tool for distributed, general-purpose data processing systems such as Apache Spark and Apache Flink. It has two main features, the data analytic phase and the data visualization phase. This project is an improvement or a re-design of the Data Visualization Component. It successfully eliminates all the limitations and drawbacks of the existing charting visualization component. \ No newline at end of file +# Apache Zeppelin +Zeppelin is a collaborative data analytic and visualization tool for distributed, general-purpose data processing systems such as Apache Spark and Apache Flink. It has two main features, the data analytic phase and the data visualization phase. This project is an improvement or a re-design of the Data Visualization Component. It successfully eliminates all the limitations and drawbacks of the existing charting visualization component. + +##Pre-request +1. NodeJS with npm +2. Bower + +You can used + * bower install + * npm install +This will Download all the dependencies including node js and npm + +### Build the application + +`./grunt build` + +Run `grunt build` for building + +### Preview Web application + +`./grunt serve` + +This will launch a WebApplication on port **9000** and update on code changes. + +### Testing + +`./grunt test` + diff --git a/app/.buildignore b/app/.buildignore new file mode 100755 index 0000000..fc98b8e --- /dev/null +++ b/app/.buildignore @@ -0,0 +1 @@ +*.coffee \ No newline at end of file diff --git a/app/.htaccess b/app/.htaccess new file mode 100755 index 0000000..cb84cb9 --- /dev/null +++ b/app/.htaccess @@ -0,0 +1,543 @@ +# Apache Configuration File + +# (!) Using `.htaccess` files slows down Apache, therefore, if you have access +# to the main server config file (usually called `httpd.conf`), you should add +# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html. + +# ############################################################################## +# # CROSS-ORIGIN RESOURCE SHARING (CORS) # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Cross-domain AJAX requests | +# ------------------------------------------------------------------------------ + +# Enable cross-origin AJAX requests. +# http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity +# http://enable-cors.org/ + +# +# Header set Access-Control-Allow-Origin "*" +# + +# ------------------------------------------------------------------------------ +# | CORS-enabled images | +# ------------------------------------------------------------------------------ + +# Send the CORS header for images when browsers request it. +# https://developer.mozilla.org/en/CORS_Enabled_Image +# http://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html +# http://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/ + + + + + SetEnvIf Origin ":" IS_CORS + Header set Access-Control-Allow-Origin "*" env=IS_CORS + + + + +# ------------------------------------------------------------------------------ +# | Web fonts access | +# ------------------------------------------------------------------------------ + +# Allow access from all domains for web fonts + + + + Header set Access-Control-Allow-Origin "*" + + + + +# ############################################################################## +# # ERRORS # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | 404 error prevention for non-existing redirected folders | +# ------------------------------------------------------------------------------ + +# Prevent Apache from returning a 404 error for a rewrite if a directory +# with the same name does not exist. +# http://httpd.apache.org/docs/current/content-negotiation.html#multiviews +# http://www.webmasterworld.com/apache/3808792.htm + +Options -MultiViews + +# ------------------------------------------------------------------------------ +# | Custom error messages / pages | +# ------------------------------------------------------------------------------ + +# You can customize what Apache returns to the client in case of an error (see +# http://httpd.apache.org/docs/current/mod/core.html#errordocument), e.g.: + +ErrorDocument 404 /404.html + + +# ############################################################################## +# # INTERNET EXPLORER # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Better website experience | +# ------------------------------------------------------------------------------ + +# Force IE to render pages in the highest available mode in the various +# cases when it may not: http://hsivonen.iki.fi/doctype/ie-mode.pdf. + + + Header set X-UA-Compatible "IE=edge" + # `mod_headers` can't match based on the content-type, however, we only + # want to send this header for HTML pages and not for the other resources + + Header unset X-UA-Compatible + + + +# ------------------------------------------------------------------------------ +# | Cookie setting from iframes | +# ------------------------------------------------------------------------------ + +# Allow cookies to be set from iframes in IE. + +# +# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" +# + +# ------------------------------------------------------------------------------ +# | Screen flicker | +# ------------------------------------------------------------------------------ + +# Stop screen flicker in IE on CSS rollovers (this only works in +# combination with the `ExpiresByType` directives for images from below). + +# BrowserMatch "MSIE" brokenvary=1 +# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1 +# BrowserMatch "Opera" !brokenvary +# SetEnvIf brokenvary 1 force-no-vary + + +# ############################################################################## +# # MIME TYPES AND ENCODING # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Proper MIME types for all files | +# ------------------------------------------------------------------------------ + + + + # Audio + AddType audio/mp4 m4a f4a f4b + AddType audio/ogg oga ogg + + # JavaScript + # Normalize to standard type (it's sniffed in IE anyways): + # http://tools.ietf.org/html/rfc4329#section-7.2 + AddType application/javascript js jsonp + AddType application/json json + + # Video + AddType video/mp4 mp4 m4v f4v f4p + AddType video/ogg ogv + AddType video/webm webm + AddType video/x-flv flv + + # Web fonts + AddType application/font-woff woff + AddType application/vnd.ms-fontobject eot + + # Browsers usually ignore the font MIME types and sniff the content, + # however, Chrome shows a warning if other MIME types are used for the + # following fonts. + AddType application/x-font-ttf ttc ttf + AddType font/opentype otf + + # Make SVGZ fonts work on iPad: + # https://twitter.com/FontSquirrel/status/14855840545 + AddType image/svg+xml svg svgz + AddEncoding gzip svgz + + # Other + AddType application/octet-stream safariextz + AddType application/x-chrome-extension crx + AddType application/x-opera-extension oex + AddType application/x-shockwave-flash swf + AddType application/x-web-app-manifest+json webapp + AddType application/x-xpinstall xpi + AddType application/xml atom rdf rss xml + AddType image/webp webp + AddType image/x-icon ico + AddType text/cache-manifest appcache manifest + AddType text/vtt vtt + AddType text/x-component htc + AddType text/x-vcard vcf + + + +# ------------------------------------------------------------------------------ +# | UTF-8 encoding | +# ------------------------------------------------------------------------------ + +# Use UTF-8 encoding for anything served as `text/html` or `text/plain`. +AddDefaultCharset utf-8 + +# Force UTF-8 for certain file formats. + + AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml + + + +# ############################################################################## +# # URL REWRITES # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Rewrite engine | +# ------------------------------------------------------------------------------ + +# Turning on the rewrite engine and enabling the `FollowSymLinks` option is +# necessary for the following directives to work. + +# If your web host doesn't allow the `FollowSymlinks` option, you may need to +# comment it out and use `Options +SymLinksIfOwnerMatch` but, be aware of the +# performance impact: http://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks + +# Also, some cloud hosting services require `RewriteBase` to be set: +# http://www.rackspace.com/knowledge_center/frequently-asked-question/why-is-mod-rewrite-not-working-on-my-site + + + Options +FollowSymlinks + # Options +SymLinksIfOwnerMatch + RewriteEngine On + # RewriteBase / + + +# ------------------------------------------------------------------------------ +# | Suppressing / Forcing the "www." at the beginning of URLs | +# ------------------------------------------------------------------------------ + +# The same content should never be available under two different URLs especially +# not with and without "www." at the beginning. This can cause SEO problems +# (duplicate content), therefore, you should choose one of the alternatives and +# redirect the other one. + +# By default option 1 (no "www.") is activated: +# http://no-www.org/faq.php?q=class_b + +# If you'd prefer to use option 2, just comment out all the lines from option 1 +# and uncomment the ones from option 2. + +# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME! + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Option 1: rewrite www.example.com → example.com + + + RewriteCond %{HTTPS} !=on + RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] + RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] + + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Option 2: rewrite example.com → www.example.com + +# Be aware that the following might not be a good idea if you use "real" +# subdomains for certain parts of your website. + +# +# RewriteCond %{HTTPS} !=on +# RewriteCond %{HTTP_HOST} !^www\..+$ [NC] +# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] +# + + +# ############################################################################## +# # SECURITY # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Content Security Policy (CSP) | +# ------------------------------------------------------------------------------ + +# You can mitigate the risk of cross-site scripting and other content-injection +# attacks by setting a Content Security Policy which whitelists trusted sources +# of content for your site. + +# The example header below allows ONLY scripts that are loaded from the current +# site's origin (no inline scripts, no CDN, etc). This almost certainly won't +# work as-is for your site! + +# To get all the details you'll need to craft a reasonable policy for your site, +# read: http://html5rocks.com/en/tutorials/security/content-security-policy (or +# see the specification: http://w3.org/TR/CSP). + +# +# Header set Content-Security-Policy "script-src 'self'; object-src 'self'" +# +# Header unset Content-Security-Policy +# +# + +# ------------------------------------------------------------------------------ +# | File access | +# ------------------------------------------------------------------------------ + +# Block access to directories without a default document. +# Usually you should leave this uncommented because you shouldn't allow anyone +# to surf through every directory on your server (which may includes rather +# private places like the CMS's directories). + + + Options -Indexes + + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Block access to hidden files and directories. +# This includes directories used by version control systems such as Git and SVN. + + + RewriteCond %{SCRIPT_FILENAME} -d [OR] + RewriteCond %{SCRIPT_FILENAME} -f + RewriteRule "(^|/)\." - [F] + + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Block access to backup and source files. +# These files may be left by some text editors and can pose a great security +# danger when anyone has access to them. + + + Order allow,deny + Deny from all + Satisfy All + + +# ------------------------------------------------------------------------------ +# | Secure Sockets Layer (SSL) | +# ------------------------------------------------------------------------------ + +# Rewrite secure requests properly to prevent SSL certificate warnings, e.g.: +# prevent `https://www.example.com` when your certificate only allows +# `https://secure.example.com`. + +# +# RewriteCond %{SERVER_PORT} !^443 +# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L] +# + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Force client-side SSL redirection. + +# If a user types "example.com" in his browser, the above rule will redirect him +# to the secure version of the site. That still leaves a window of opportunity +# (the initial HTTP connection) for an attacker to downgrade or redirect the +# request. The following header ensures that browser will ONLY connect to your +# server via HTTPS, regardless of what the users type in the address bar. +# http://www.html5rocks.com/en/tutorials/security/transport-layer-security/ + +# +# Header set Strict-Transport-Security max-age=16070400; +# + +# ------------------------------------------------------------------------------ +# | Server software information | +# ------------------------------------------------------------------------------ + +# Avoid displaying the exact Apache version number, the description of the +# generic OS-type and the information about Apache's compiled-in modules. + +# ADD THIS DIRECTIVE IN THE `httpd.conf` AS IT WILL NOT WORK IN THE `.htaccess`! + +# ServerTokens Prod + + +# ############################################################################## +# # WEB PERFORMANCE # +# ############################################################################## + +# ------------------------------------------------------------------------------ +# | Compression | +# ------------------------------------------------------------------------------ + + + + # Force compression for mangled headers. + # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping + + + SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding + RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding + + + + # Compress all output labeled with one of the following MIME-types + # (for Apache versions below 2.3.7, you don't need to enable `mod_filter` + # and can remove the `` and `` lines + # as `AddOutputFilterByType` is still in the core directives). + + AddOutputFilterByType DEFLATE application/atom+xml \ + application/javascript \ + application/json \ + application/rss+xml \ + application/vnd.ms-fontobject \ + application/x-font-ttf \ + application/x-web-app-manifest+json \ + application/xhtml+xml \ + application/xml \ + font/opentype \ + image/svg+xml \ + image/x-icon \ + text/css \ + text/html \ + text/plain \ + text/x-component \ + text/xml + + + + +# ------------------------------------------------------------------------------ +# | Content transformations | +# ------------------------------------------------------------------------------ + +# Prevent some of the mobile network providers from modifying the content of +# your site: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5. + +# +# Header set Cache-Control "no-transform" +# + +# ------------------------------------------------------------------------------ +# | ETag removal | +# ------------------------------------------------------------------------------ + +# Since we're sending far-future expires headers (see below), ETags can +# be removed: http://developer.yahoo.com/performance/rules.html#etags. + +# `FileETag None` is not enough for every server. + + Header unset ETag + + +FileETag None + +# ------------------------------------------------------------------------------ +# | Expires headers (for better cache control) | +# ------------------------------------------------------------------------------ + +# The following expires headers are set pretty far in the future. If you don't +# control versioning with filename-based cache busting, consider lowering the +# cache time for resources like CSS and JS to something like 1 week. + + + + ExpiresActive on + ExpiresDefault "access plus 1 month" + + # CSS + ExpiresByType text/css "access plus 1 year" + + # Data interchange + ExpiresByType application/json "access plus 0 seconds" + ExpiresByType application/xml "access plus 0 seconds" + ExpiresByType text/xml "access plus 0 seconds" + + # Favicon (cannot be renamed!) + ExpiresByType image/x-icon "access plus 1 week" + + # HTML components (HTCs) + ExpiresByType text/x-component "access plus 1 month" + + # HTML + ExpiresByType text/html "access plus 0 seconds" + + # JavaScript + ExpiresByType application/javascript "access plus 1 year" + + # Manifest files + ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" + ExpiresByType text/cache-manifest "access plus 0 seconds" + + # Media + ExpiresByType audio/ogg "access plus 1 month" + ExpiresByType image/gif "access plus 1 month" + ExpiresByType image/jpeg "access plus 1 month" + ExpiresByType image/png "access plus 1 month" + ExpiresByType video/mp4 "access plus 1 month" + ExpiresByType video/ogg "access plus 1 month" + ExpiresByType video/webm "access plus 1 month" + + # Web feeds + ExpiresByType application/atom+xml "access plus 1 hour" + ExpiresByType application/rss+xml "access plus 1 hour" + + # Web fonts + ExpiresByType application/font-woff "access plus 1 month" + ExpiresByType application/vnd.ms-fontobject "access plus 1 month" + ExpiresByType application/x-font-ttf "access plus 1 month" + ExpiresByType font/opentype "access plus 1 month" + ExpiresByType image/svg+xml "access plus 1 month" + + + +# ------------------------------------------------------------------------------ +# | Filename-based cache busting | +# ------------------------------------------------------------------------------ + +# If you're not using a build process to manage your filename version revving, +# you might want to consider enabling the following directives to route all +# requests such as `/css/style.12345.css` to `/css/style.css`. + +# To understand why this is important and a better idea than `*.css?v231`, read: +# http://stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring + +# +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteCond %{REQUEST_FILENAME} !-d +# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L] +# + +# ------------------------------------------------------------------------------ +# | File concatenation | +# ------------------------------------------------------------------------------ + +# Allow concatenation from within specific CSS and JS files, e.g.: +# Inside of `script.combined.js` you could have +# +# +# and they would be included into this single file. + +# +# +# Options +Includes +# AddOutputFilterByType INCLUDES application/javascript application/json +# SetOutputFilter INCLUDES +# +# +# Options +Includes +# AddOutputFilterByType INCLUDES text/css +# SetOutputFilter INCLUDES +# +# + +# ------------------------------------------------------------------------------ +# | Persistent connections | +# ------------------------------------------------------------------------------ + +# Allow multiple requests to be sent over the same TCP connection: +# http://httpd.apache.org/docs/current/en/mod/core.html#keepalive. + +# Enable if you serve a lot of static content but, be aware of the +# possible disadvantages! + +# +# Header set Connection Keep-Alive +# diff --git a/app/404.html b/app/404.html new file mode 100755 index 0000000..f5c3819 --- /dev/null +++ b/app/404.html @@ -0,0 +1,157 @@ + + + + + Page Not Found :( + + + +
+

Not found :(

+

Sorry, but the page you were trying to view does not exist.

+

It looks like this was the result of either:

+ + + +
+ + diff --git a/app/data/bike.csv b/app/data/bike.csv new file mode 100644 index 0000000..33b253f --- /dev/null +++ b/app/data/bike.csv @@ -0,0 +1,6 @@ +No,Year,Make,Model,Length +0,2015,Daelim,VR13,101 +1,2008,Honda,CBS,120 +2,2015,Harley-Davidson,Breakout,190 +3,2013,BMW,R1200RT-P,150 +4,2010,BMW,R1150R,220 \ No newline at end of file diff --git a/app/data/car.csv b/app/data/car.csv new file mode 100644 index 0000000..13b879d --- /dev/null +++ b/app/data/car.csv @@ -0,0 +1,5 @@ +No,Year,Make,Model,Length +0,1996,Ford,E350,234 +1,2000,Mercury,Cougar,248 +2,2010,Toyota,Yaris,200 +3,2011,Nissian,March,168 \ No newline at end of file diff --git a/app/favicon.ico b/app/favicon.ico new file mode 100644 index 0000000..6527905 Binary files /dev/null and b/app/favicon.ico differ diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..c6b391b --- /dev/null +++ b/app/index.html @@ -0,0 +1,100 @@ + + + + + + + + + + + + + Apache Zeppelin GSOC15 + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+ + +
+
+ +
+ +
+
+

Source code in github, + by udantha.

+
+
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/robots.txt b/app/robots.txt new file mode 100755 index 0000000..9417495 --- /dev/null +++ b/app/robots.txt @@ -0,0 +1,3 @@ +# robotstxt.org + +User-agent: * diff --git a/app/scripts/app.js b/app/scripts/app.js new file mode 100644 index 0000000..2c1d9ea --- /dev/null +++ b/app/scripts/app.js @@ -0,0 +1,38 @@ +'use strict'; + +/** + * @ngdoc overview + * @name apacheZeppelinGsocApp + * @description + * # apacheZeppelinGsocApp + * @author madhuka udantha + * + * Main module of the application. + */ +angular + .module('apacheZeppelinGsocApp', [ + 'ngResource', + 'ngRoute', + 'googlechart', + 'highcharts-ng', + 'nvd3' + ]) + .config(function ($routeProvider) { + $routeProvider + .when('/home', { + templateUrl: 'views/about.html' + }) + .when('/milestone01', { + templateUrl: 'views/milestone01.html', + controller:'ChartCtrl' + }) + .when('/contact', { + templateUrl: 'views/contact.html' + }) + .when('/', { + templateUrl: 'views/about.html' + }) + .otherwise({ + redirectTo: '/' + }); + }); diff --git a/app/scripts/chart-factory/chart-factory.js b/app/scripts/chart-factory/chart-factory.js new file mode 100644 index 0000000..4a5448f --- /dev/null +++ b/app/scripts/chart-factory/chart-factory.js @@ -0,0 +1,28 @@ +'use strict'; + +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.Chart Factory + * @description + * # Gobal Chart Factory + * Controller of the top navigation, mainly use for the dropdown menu + * + */ + +angular.module('apacheZeppelinGsocApp').factory('ChartFactory', function() { + + //Genric Chart model + var ChartFactory = function(chartLibName, chartModel) { + this.libname = chartLibName; + this.model = chartModel; + this.viewModel = {}; + this.type = {}; + this.data = {}; + }; + + ChartFactory.setChartType = function(chartType) { + ChartFactory.type = chartType; + }; + + return ChartFactory; +}); \ No newline at end of file diff --git a/app/scripts/chart-factory/google-chart-factory.js b/app/scripts/chart-factory/google-chart-factory.js new file mode 100644 index 0000000..d3347a6 --- /dev/null +++ b/app/scripts/chart-factory/google-chart-factory.js @@ -0,0 +1,86 @@ +'use strict'; +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.GoogleChartFactory + * @description + * # Extending Gobal Chart Factory for Google Chart Model + * + */ +angular.module('apacheZeppelinGsocApp').factory('GoogleChartFactory', function( + ChartFactory) { + var ChartList = { + 'Bar': 'BarChart', + 'Line': 'LineChart' + }; + //googleChart model (sample chart data model) + //TO-DO Sample Data will remove after model set. + var GoogelChartChartModel = { + type: 'BarChart', + cssStyle: 'height:400px; width:500px;', + data: { + 'cols': [{ + id: 'pizza', + label: 'Pizza', + type: 'string' + }, { + id: 'populartiy', + label: 'Populartiy', + type: 'number' + }], + 'rows': [{ + c: [{ + v: 'Pepperoni' + }, { + v: 14 + }] + }] + }, + options: { + 'isStacked': 'true', + 'fill': 20, + 'height': 300, + 'displayExactValues': true, + 'vAxis': { + 'gridlines': { + 'count': 6 + } + }, + 'hAxis': { + 'title': 'hAxis title' + } + }, + formatters: {} + }; + + function googleChartModel(d) { + return { + c: [{ + v: d.Make + }, { + v: +d.Length + }] + }; + } + + function getGoogleChart(error, rows) { + GoogelChartChartModel.data.rows = rows; + } + var googlexChart = { + model: googleChartModel, + get: getGoogleChart + }; + + function setChartTypeView(chartType) { + GoogleChartFactory.viewModel.type = ChartList[chartType]; + } + //google chart + var GoogleChartFactory = new ChartFactory('googleChart', googlexChart); + GoogleChartFactory.viewModel = GoogelChartChartModel; + GoogleChartFactory.setChartType = function(chartType) { + GoogleChartFactory.type = chartType; + setChartTypeView(chartType); + }; + // define a new internal private method for this chart object + function setChartAxis() {} + return GoogleChartFactory; +}); \ No newline at end of file diff --git a/app/scripts/chart-factory/high-chart-factory.js b/app/scripts/chart-factory/high-chart-factory.js new file mode 100644 index 0000000..8d59daf --- /dev/null +++ b/app/scripts/chart-factory/high-chart-factory.js @@ -0,0 +1,82 @@ +'use strict'; +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.HighChartFactory + * @description + * # Extending Gobal Chart Factory for High Chart Model + * + */ +angular.module('apacheZeppelinGsocApp').factory('HighChartFactory', function( + ChartFactory) { + var ChartList = { + 'Bar': 'bar', + 'Line': 'line' + }; + //highChart model + var HighChartChartModel = { + options: { + chart: { + type: 'bar' + } + }, + xAxis: { + categories: [] + }, + series: [{ + data: [] + }], + size: { + width: 500, + height: 300 + }, + loading: false + }; + //high chart + // define a new internal private method for this chart object + function highChartModel(d) { + return +d.Length; + } + + function getHighChart(error, rows) { + console.log('loading for view'); + console.log(rows); + HighChartChartModel.series[0].data = rows; + } + + function setChartTypeView(chartType) { + HighChartFactory.viewModel.options.chart.type = ChartList[chartType]; + } + + function setChartAxis() {} + var highxChart = { + model: highChartModel, + get: getHighChart + }; + //setting up the highchart and chart view model for this chart + var HighChartFactory = new ChartFactory('highxChart', highxChart); + HighChartChartModel.series[0].data = null; + HighChartFactory.viewModel = HighChartChartModel; + HighChartFactory.setChartType = function(chartType) { + HighChartFactory.type = chartType; + setChartTypeView(chartType); + }; + HighChartFactory.setChartAxis = function(data) { + loadYAxisLabel(data); + }; + var highAxisLabels = {}; + + function getHighYaxis(error, rows) { + console.log(rows); + highAxisLabels = rows; + HighChartFactory.viewModel.xAxis.categories = highAxisLabels; + } + + function highYaxisModel(d) { + return d.Make; + } + + function loadYAxisLabel(fileName) { + highAxisLabels = d3.csv(fileName).row(highYaxisModel).get(getHighYaxis); + } + return HighChartFactory; +}); \ No newline at end of file diff --git a/app/scripts/chart-factory/nvd3-chart-factory.js b/app/scripts/chart-factory/nvd3-chart-factory.js new file mode 100644 index 0000000..0454e92 --- /dev/null +++ b/app/scripts/chart-factory/nvd3-chart-factory.js @@ -0,0 +1,104 @@ +'use strict'; +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.NVD3ChartFactory + * @description + * # Extending Gobal Chart Factory for NVD3 Chart Model + * + */ +angular.module('apacheZeppelinGsocApp').factory('NVD3ChartFactory', function( + ChartFactory) { + var ChartList = { + 'Bar': 'discreteBarChart', + 'Line': 'lineChart' + }; + //NVD3 Chart model + var NVD3ChartChartModel = { + options: { + chart: { + type: 'discreteBarChart', + height: 300, + width: 500, + showLegend: true, + margin: { + top: 20, + right: 20, + bottom: 20, + left: 20 + }, + x: function(d) { + return d.valuex; + }, + y: function(d) { + return d.value; + }, + showValues: true, + transitionDuration: 500, + xAxis: { + axisLabel: 'X Axis' + }, + yAxis: { + axisLabel: 'Y Axis', + axisLabelDistance: 10 + } + } + }, + data: [] + }; + + function getNVD3(error, rows) { + var data = { + 'values': rows + }; + NVD3ChartChartModel.data[0] = data; + console.log(NVD3ChartChartModel.data); + } + + function nvd3Model(d) { + return { + label: d.Make, + value: +d.Length, + valuex: +d.No + }; + } + + function setChartTypeView(chartType) { + NVD3ChartFactory.viewModel.options.chart.type = ChartList[chartType]; + } + var NVD3Chart = { + model: nvd3Model, + get: getNVD3 + }; + //nvd3 chart + var NVD3ChartFactory = new ChartFactory('NVD3Chart', NVD3Chart); + NVD3ChartFactory.viewModel = NVD3ChartChartModel; + NVD3ChartFactory.setChartType = function(chartType) { + NVD3ChartFactory.type = chartType; + setChartTypeView(chartType); + }; + NVD3ChartFactory.setChartAxis = function(data) { + loadYAxisLabel(data); + }; + // define a new internal private method for this chart object + var nvd3AxisLabels = {}; + + function getNVD3Yaxis(error, rows) { + console.log(rows); + nvd3AxisLabels = rows; + NVD3ChartFactory.viewModel.options.chart.xAxis = { + 'axisLabel': 'Make', + 'tickFormat': function(d) { + return nvd3AxisLabels[d]; + } + }; + } + + function nvd3YaxisModel(d) { + return d.Make; + } + + function loadYAxisLabel(fileName) { + nvd3AxisLabels = d3.csv(fileName).row(nvd3YaxisModel).get(getNVD3Yaxis); + } + return NVD3ChartFactory; +}); \ No newline at end of file diff --git a/app/scripts/config/chart-config.js b/app/scripts/config/chart-config.js new file mode 100644 index 0000000..22c5b5a --- /dev/null +++ b/app/scripts/config/chart-config.js @@ -0,0 +1,24 @@ +'use strict'; +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.configure + * @description + * # configures will contains the configuration details for charting library + * + * @author madhuka udantha + */ +angular.module('apacheZeppelinGsocApp') + .constant('chartConfig', { + 'libraryName': [{ + 'library': 'highChart', + 'template': 'views/charts/highchart.html' + }, { + 'library': 'NVD3Chart', + 'template': 'views/charts/nvd3chart.html' + }, { + 'library': 'googleChart', + 'template': 'views/charts/googlechart.html' + }], + 'dataFiles': ['car', 'bike'], + 'chartTypes': ['Line', 'Bar'] + }); \ No newline at end of file diff --git a/app/scripts/controllers/chart-controllers.js b/app/scripts/controllers/chart-controllers.js new file mode 100644 index 0000000..1a7d0a8 --- /dev/null +++ b/app/scripts/controllers/chart-controllers.js @@ -0,0 +1,111 @@ +'use strict'; +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.controller:ChartCtrl + * @description + * # ChartCtrl + * Controller of chart library, type. + * + * @author madhuka udantha + */ +angular.module('apacheZeppelinGsocApp').controller('ChartCtrl', function($scope, + ChartFactory, GoogleChartFactory, HighChartFactory, NVD3ChartFactory, + ChartService, ChartMetaService, chartConfig) { + var vm = this; + //loading from chart config file. + var libraryName = chartConfig.libraryName; + var files = chartConfig.dataFiles; + var chartTypes = chartConfig.chartTypes; + + function renderChart(chart, datax) { + datax.row(chart.model).get(chart.get); + } + var data = {}; + + function loadData(fileName) { + setButtonActive('dataButton', fileName); + data = getData(fileName); + ChartMetaService.setChartDataSetName(fileName); + drawChart(data); + } + + function loadChartLibrary(libraryIndex) { + setButtonActive('chartLibraryButton', libraryName[libraryIndex].library); + ChartMetaService.setChartLib(libraryName[libraryIndex].library); + ChartMetaService.setChartTemplateURL(libraryName[libraryIndex].template); + if (ChartMetaService.getChartType() === null) { + //setting default chart type + ChartMetaService.setChartType('Bar'); + } + drawChart(data); + } + + function getChartTemplateURL() { + return ChartMetaService.getChartTemplateURL(); + } + + function loadChartType(chartType) { + ChartMetaService.setChartType(chartType); + setButtonActive('chartTypeButton', chartType); + drawChart(data); + //To-Do CHart model will be completing for rendering the chart + } + //chart is generated from service, service is using HighChartfactory.HighCHart Factory is extended version of ChartFactory. + function drawChart(data) { + //Checking chart requirement is completed + var myNewChart = {}; + var myChartType = ChartMetaService.getChartType(); + console.log(myChartType); + switch (ChartMetaService.getChartLib()) { + case 'NVD3Chart': + //set data for NVD3 + myNewChart = ChartService.getNVD3Chart(myChartType); + vm.data = myNewChart.viewModel.data; + vm.options = myNewChart.viewModel.options; + break; + case 'highChart': + myNewChart = ChartService.getHighChart(myChartType); + vm.chartConfig = myNewChart.viewModel; + break; + case 'googleChart': + myNewChart = ChartService.getGoogleChart(myChartType); + vm.chart = myNewChart.viewModel; + break; + } + if (myNewChart.model) { + renderChart(myNewChart.model, data); + } + //NVD3 axis update + } + + function getData(fileName) { + return d3.csv('data/' + fileName + '.csv'); + } + //default button picker + var active = { + 'dataButton': false, + 'chartLibraryButton': false, + 'chartTypeButton': false + }; + + function setButtonActive(set, type) { + active[set] = type; + } + + function isButtonActive(set, type) { + return active[set] === type; + } + + function isButtonSelected(set) { + return active[set]; + } + vm.loadData = loadData; + vm.isButtonActive = isButtonActive; + vm.isButtonSelected = isButtonSelected; + vm.loadChartLibrary = loadChartLibrary; + vm.loadChartType = loadChartType; + vm.files = files; + vm.libraryName = libraryName; + vm.chartTypes = chartTypes; + vm.getChartTemplateURL = getChartTemplateURL; +}); \ No newline at end of file diff --git a/app/scripts/controllers/nav-controller.js b/app/scripts/controllers/nav-controller.js new file mode 100644 index 0000000..bcb9415 --- /dev/null +++ b/app/scripts/controllers/nav-controller.js @@ -0,0 +1,25 @@ +'use strict'; + +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.controller:navCtrl + * @description + * # navCtrl + * Controller of the top navigation, mainly use for the dropdown menu + * + * @author madhuka udantha + */ + +angular.module('apacheZeppelinGsocApp').controller('NavCtrl', function($scope, $rootScope, $location) { + + /*vm stands for ViewModel*/ + var vm = this; + + function isActive(viewLocation) { + return viewLocation === $location.path(); + } + + vm.isActive = isActive; + + +}); \ No newline at end of file diff --git a/app/scripts/services/chart-meta-service.js b/app/scripts/services/chart-meta-service.js new file mode 100644 index 0000000..e839e09 --- /dev/null +++ b/app/scripts/services/chart-meta-service.js @@ -0,0 +1,57 @@ +'use strict'; +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.ChartMetaService + * @description + * # ChartMetaService will be using Handle Basic Chart Meta Details. + * + */ +angular.module('apacheZeppelinGsocApp').service('ChartMetaService', function() { + /*Chart Meta Data Service*/ + var MetaModel = { + ChartLib: null, + ChartTemplateURL: null, + ChartType: null, + ChartDataSetName: null, + ChartDataSetPath: null, + ChartData: null + }; + //getters + this.getChartLib = function() { + return MetaModel.ChartLib; + }; + this.getChartType = function() { + return MetaModel.ChartType; + }; + this.getChartTemplateURL = function() { + return MetaModel.ChartTemplateURL; + }; + this.getChartDataSetName = function() { + return MetaModel.ChartDataSetName; + }; + this.getChartDataSetPath = function() { + return MetaModel.ChartDataSetPath; + }; + this.getChartData = function() { + return MetaModel.ChartData; + }; + //setters + this.setChartLib = function(ChartLib) { + MetaModel.ChartLib = ChartLib; + }; + this.setChartType = function(ChartType) { + MetaModel.ChartType = ChartType; + }; + this.setChartTemplateURL = function(ChartTemplateURL) { + MetaModel.ChartTemplateURL = ChartTemplateURL; + }; + this.setChartDataSetName = function(ChartDataSetName) { + MetaModel.ChartDataSetName = ChartDataSetName; + MetaModel.ChartDataSetPath = 'data/' + ChartDataSetName + '.csv'; + MetaModel.ChartData = d3.csv(MetaModel.ChartDataSetPath); + }; + //looking for UI model logic + this.isMetaCompleted = function() { + return MetaModel.ChartType !== null; + }; +}); \ No newline at end of file diff --git a/app/scripts/services/chart-service.js b/app/scripts/services/chart-service.js new file mode 100644 index 0000000..163c757 --- /dev/null +++ b/app/scripts/services/chart-service.js @@ -0,0 +1,35 @@ +'use strict'; + +/** + * @ngdoc function + * @name apacheZeppelinGsocApp.ChartService + * @description + * # ChartService will be using ChartFactories. + * + */ + + +angular.module('apacheZeppelinGsocApp').service('ChartService', function(HighChartFactory, GoogleChartFactory, NVD3ChartFactory,ChartMetaService) { + + /*using chart facotry*/ + this.getHighChart = function(chartType) { + var myChart = HighChartFactory; + myChart.setChartType(chartType); + myChart.setChartAxis(ChartMetaService.getChartDataSetPath()); + return myChart; + }; + + this.getGoogleChart = function(chartType) { + var myChart = GoogleChartFactory; + myChart.setChartType(chartType); + return myChart; + }; + + this.getNVD3Chart = function(chartType) { + var myChart = NVD3ChartFactory; + myChart.setChartType(chartType); + myChart.setChartAxis(ChartMetaService.getChartDataSetPath()); + return myChart; + }; + +}); \ No newline at end of file diff --git a/app/styles/chart.css b/app/styles/chart.css new file mode 100644 index 0000000..d01957f --- /dev/null +++ b/app/styles/chart.css @@ -0,0 +1,5 @@ +/*nvd3 chart svg size fixing */ +svg { + width: 550px !important; + height: 350px !important; +} \ No newline at end of file diff --git a/css/cover.css b/app/styles/cover.css similarity index 92% rename from css/cover.css rename to app/styles/cover.css index 06c8357..443ea9e 100644 --- a/css/cover.css +++ b/app/styles/cover.css @@ -14,10 +14,10 @@ a:hover { .btn-default, .btn-default:hover, .btn-default:focus { - color: #fff; text-shadow: none; /* Prevent inheritence from `body` */ - background-color: #333; - border: 1px solid #333; + color: #333333; + background-color: #ffffff; + border-color: #cccccc; } @@ -36,6 +36,7 @@ body { text-shadow: 0 1px 3px rgba(0,0,0,.5); } + /* Extra markup and styles for table-esque vertical and horizontal centering */ .site-wrapper { display: table; @@ -58,6 +59,14 @@ body { .inner { padding: 30px; } +.box { + padding-top: 10px; + height: 400px; + width: 550px; + vertical-align: center; + margin:0 auto; + text-align: center; +} /* @@ -119,8 +128,7 @@ body { } .inx { - padding: 0 20px; - text-align: left; + } @@ -166,4 +174,4 @@ body { .cover-container { width: 1200px; } -} +} \ No newline at end of file diff --git a/app/styles/main.css b/app/styles/main.css new file mode 100755 index 0000000..e69de29 diff --git a/partials/about.html b/app/views/about.html similarity index 99% rename from partials/about.html rename to app/views/about.html index 77b3053..7a16361 100644 --- a/partials/about.html +++ b/app/views/about.html @@ -1,7 +1,7 @@ -
-

Apache Zeppelin Gsoc 2015

-

Zeppelin is a collaborative data analytics and visualization tool for distributed, general-purpose data processing systems such as Apache Spark and Apache Flink. It has two main features, the data analytic phase and the data visualization phase. This project is an improvement or a re-design of the Data Visualization Component.

-

- Read more -

+
+

Apache Zeppelin Gsoc 2015

+

Zeppelin is a collaborative data analytics and visualization tool for distributed, general-purpose data processing systems such as Apache Spark and Apache Flink. It has two main features, the data analytic phase and the data visualization phase. This project is an improvement or a re-design of the Data Visualization Component.

+

+ Read more +

\ No newline at end of file diff --git a/app/views/charts/googlechart.html b/app/views/charts/googlechart.html new file mode 100644 index 0000000..143dd55 --- /dev/null +++ b/app/views/charts/googlechart.html @@ -0,0 +1,4 @@ +
+ +
+
\ No newline at end of file diff --git a/app/views/charts/highchart.html b/app/views/charts/highchart.html new file mode 100644 index 0000000..f9a3342 --- /dev/null +++ b/app/views/charts/highchart.html @@ -0,0 +1,4 @@ +
+ + +
\ No newline at end of file diff --git a/app/views/charts/nvd3chart.html b/app/views/charts/nvd3chart.html new file mode 100644 index 0000000..6760d18 --- /dev/null +++ b/app/views/charts/nvd3chart.html @@ -0,0 +1,4 @@ +
+ + +
\ No newline at end of file diff --git a/partials/contact.html b/app/views/contact.html similarity index 97% rename from partials/contact.html rename to app/views/contact.html index ef54f80..5624850 100644 --- a/partials/contact.html +++ b/app/views/contact.html @@ -1,9 +1,9 @@ -
-

Contact

-

madhukaudantha@gmail.com

-

users@zeppelin.incubator.apache.org

-

dev@zeppelin.incubator.apache.org

-

- Community -

+
+

Contact

+

madhukaudantha@gmail.com

+

users@zeppelin.incubator.apache.org

+

dev@zeppelin.incubator.apache.org

+

+ Community +

\ No newline at end of file diff --git a/app/views/milestone01.html b/app/views/milestone01.html new file mode 100644 index 0000000..7aaafb5 --- /dev/null +++ b/app/views/milestone01.html @@ -0,0 +1,37 @@ +
+

MileStone - 01

+
+ +
+ +
+ {{file}} +
+
+
+
+ + +
+ +
+
+ + +
+ +
+
+
+
\ No newline at end of file diff --git a/bower b/bower new file mode 100644 index 0000000..ed00320 --- /dev/null +++ b/bower @@ -0,0 +1,17 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +"node/node" "./node_modules/bower/bin/bower" "$@" diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..d00b505 --- /dev/null +++ b/bower.json @@ -0,0 +1,22 @@ +{ + "name": "apacheZeppelinGsoc", + "version": "0.0.0", + "dependencies": { + "angular": "^1.4.1", + "bootstrap": "~3.2.0", + "angular-resource": "^1.3.0", + "angular-route": "^1.3.0", + "angular-bootstrap": "~0.13.0", + "angular-google-chart": "~0.0.11", + "d3": "~3.3.13", + "nvd3": "~1.1.15-beta", + "highcharts-release": "~4.1.6", + "highcharts-ng": "~0.0.8", + "angular-nvd3": "~0.1.1" + }, + "devDependencies": { + "angular-mocks": "^1.3.0" + }, + "appPath": "app", + "moduleName": "apacheZeppelinGsocApp" +} diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index 7e5049a..0000000 Binary files a/favicon.ico and /dev/null differ diff --git a/grunt b/grunt new file mode 100644 index 0000000..759cae7 --- /dev/null +++ b/grunt @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +"node/node" "./node_modules/.bin/grunt" "$@" + diff --git a/index.html b/index.html deleted file mode 100644 index 1fcf3cb..0000000 --- a/index.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - Apache Zeppelin GSOC15 - - - - - - - - - - -
- -
- -
- -
-
-

Apache Zeppelin - GSoC 2015

- -
-
- -
- -
-
-

Source code in github, by udantha.

-
-
- -
- -
- -
- - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/js/app.js b/js/app.js deleted file mode 100644 index 2e827e3..0000000 --- a/js/app.js +++ /dev/null @@ -1,22 +0,0 @@ -var zeppelinGsocApp = angular.module('zeppelinGsocApp', [ - 'ngRoute', - 'chartControllers' -]); - -zeppelinGsocApp.config(['$routeProvider', - function($routeProvider) { - $routeProvider. - when('/contact', { - templateUrl: 'partials/contact.html' - }). - when('/milestone01', { - templateUrl: 'partials/milestone01.html', - controller: 'chartCtrl' - }). - when('/home', { - templateUrl: 'partials/about.html' - }). - otherwise({ - redirectTo: '/home' - }); - }]); \ No newline at end of file diff --git a/js/controllers.js b/js/controllers.js deleted file mode 100644 index 848756a..0000000 --- a/js/controllers.js +++ /dev/null @@ -1,12 +0,0 @@ -var chartControllers = angular.module('chartControllers', []); - -chartControllers.controller('contactCtrl', ['$scope', '$http', - function ($scope, $http) { - $scope.pageName = "contact"; - - }]); - -chartControllers.controller('chartCtrl', ['$scope', '$routeParams', - function($scope, $routeParams) { - $scope.pageName = "chartControllers"; - }]); \ No newline at end of file diff --git a/package.json b/package.json old mode 100644 new mode 100755 index 8d9757b..0df9d2a --- a/package.json +++ b/package.json @@ -1,21 +1,40 @@ -{ - "version": "0.0.1", - "name": "apache-zeppelin-gsoc", - "description": "Improving Apache Zeppelin Visualization", - "repository": "https://github.com/Madhuka/apache-zeppelin-gsoc", - "license": "MIT", - "author": "Madhuka Udantha ", - "devDependencies": { - "http-server": "^0.6.1" - }, - "dependencies": { - "angular": "1.3.8", - "angular-route": "1.3.8", - "jquery": "~2.1.4", - "bootstrap": "~3.3.0" - }, - "scripts": { - "prestart": "npm install", - "start": "http-server -a 0.0.0.0 -p 8080" - } +{ + "name": "gotest", + "version": "0.0.0", + "dependencies": {}, + "repository": {}, + "devDependencies": { + "grunt": "^0.4.5", + "grunt-autoprefixer": "^3.0.0", + "grunt-concurrent": "^1.0.0", + "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-concat": "^0.5.0", + "grunt-contrib-connect": "^0.9.0", + "grunt-contrib-copy": "^0.7.0", + "grunt-contrib-cssmin": "^0.12.0", + "grunt-contrib-htmlmin": "^0.4.0", + "grunt-contrib-imagemin": "^0.9.2", + "grunt-contrib-jshint": "^0.11.0", + "grunt-contrib-uglify": "^0.7.0", + "grunt-contrib-watch": "^0.6.1", + "grunt-filerev": "^2.1.2", + "grunt-google-cdn": "^0.4.3", + "grunt-karma": "*", + "grunt-newer": "^1.1.0", + "grunt-ng-annotate": "^0.9.2", + "grunt-svgmin": "^2.0.0", + "grunt-usemin": "^3.0.0", + "grunt-wiredep": "^2.0.0", + "jshint-stylish": "^1.0.0", + "karma-jasmine": "*", + "karma-phantomjs-launcher": "*", + "load-grunt-tasks": "^3.1.0", + "time-grunt": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "grunt test" + } } \ No newline at end of file diff --git a/partials/milestone01.html b/partials/milestone01.html deleted file mode 100644 index a3be8e0..0000000 --- a/partials/milestone01.html +++ /dev/null @@ -1,7 +0,0 @@ -
-

MileStone - 01

-

-

- Read more -

-
\ No newline at end of file diff --git a/test/.jshintrc b/test/.jshintrc new file mode 100755 index 0000000..e2a25d2 --- /dev/null +++ b/test/.jshintrc @@ -0,0 +1,28 @@ +{ + "node": true, + "browser": true, + "esnext": true, + "bitwise": true, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "immed": true, + "indent": 2, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "single", + "regexp": true, + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + "smarttabs": true, + "jasmine": true, + "globals": { + "angular": false, + "browser": false, + "inject": false + } +} + diff --git a/test/karma.conf.js b/test/karma.conf.js new file mode 100755 index 0000000..379e921 --- /dev/null +++ b/test/karma.conf.js @@ -0,0 +1,88 @@ +// Karma configuration +// http://karma-runner.github.io/0.12/config/configuration-file.html +// Generated on 2015-06-15 using +// generator-karma 1.0.0 + +module.exports = function(config) { + 'use strict'; + + config.set({ + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + // base path, that will be used to resolve files and exclude + basePath: '../', + + // testing framework to use (jasmine/mocha/qunit/...) + // as well as any additional frameworks (requirejs/chai/sinon/...) + frameworks: [ + "jasmine" + ], + + // list of files / patterns to load in the browser + files: [ + // bower:js + 'bower_components/jquery/dist/jquery.js', + 'bower_components/angular/angular.js', + 'bower_components/bootstrap/dist/js/bootstrap.js', + 'bower_components/angular-resource/angular-resource.js', + 'bower_components/angular-route/angular-route.js', + 'bower_components/angular-bootstrap/ui-bootstrap-tpls.js', + 'bower_components/angular-google-chart/ng-google-chart.js', + 'bower_components/d3/d3.js', + 'bower_components/nvd3/nv.d3.js', + 'bower_components/highcharts-release/highcharts.js', + 'bower_components/highcharts-release/highcharts-more.js', + 'bower_components/highcharts-release/modules/exporting.js', + 'bower_components/highcharts-ng/dist/highcharts-ng.js', + 'bower_components/angular-nvd3/dist/angular-nvd3.min.js', + 'bower_components/angular-mocks/angular-mocks.js', + // endbower + "app/scripts/**/*.js", + "test/mock/**/*.js", + "test/spec/**/*.js" + ], + + // list of files / patterns to exclude + exclude: [ + ], + + // web server port + port: 8080, + + // Start these browsers, currently available: + // - Chrome + // - ChromeCanary + // - Firefox + // - Opera + // - Safari (only Mac) + // - PhantomJS + // - IE (only Windows) + browsers: [ + "PhantomJS" + ], + + // Which plugins to enable + plugins: [ + "karma-phantomjs-launcher", + "karma-jasmine" + ], + + // Continuous Integration mode + // if true, it capture browsers, run tests and exit + singleRun: false, + + colors: true, + + // level of logging + // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG + logLevel: config.LOG_INFO, + + // Uncomment the following lines if you are using grunt's server to run the tests + // proxies: { + // '/': 'http://localhost:9000/' + // }, + // URL root prevent conflicts with the site root + // urlRoot: '_karma_' + }); +}; diff --git a/test/spec/controllers/chart-controllers.js b/test/spec/controllers/chart-controllers.js new file mode 100644 index 0000000..188a7a7 --- /dev/null +++ b/test/spec/controllers/chart-controllers.js @@ -0,0 +1,54 @@ +'use strict'; +/** + * @name apacheZeppelinGsocApp.test:ChartCtrl + * @description + * # ChartCtrl Test + * + * @author madhuka udantha + */ + +describe('Controller: ChartCtrl', function() { + + // load the controller's module + beforeEach(module('apacheZeppelinGsocApp')); + + var ChartCtrl, scope; + + // Initialize the controller and a mock scope + beforeEach(inject(function($controller, $rootScope) { + scope = $rootScope.$new(); + ChartCtrl = $controller('ChartCtrl', { + $scope: scope + }); + })); + + it('Chart Controller should to be defined', function() { + expect(ChartCtrl).toBeDefined(); + }); + + it('ChartCtrl should not have a property called vm', function() { + expect(ChartCtrl.vm).toBeUndefined(); + }); + + it('Chart Controller Option should to be defined', function() { + expect(ChartCtrl.loadData).toBeDefined(); + expect(ChartCtrl.loadChartLibrary).toBeDefined(); + }); + + it('Chart Controller Button functions should to be defined', function() { + expect(ChartCtrl.isButtonActive).toBeDefined(); + expect(ChartCtrl.isButtonSelected).toBeDefined(); + }); + + it('Button Group function testing', function() { + expect(ChartCtrl.isButtonActive instanceof Function).toBe(true); + expect(ChartCtrl.isButtonSelected instanceof Function).toBe(true); + expect(ChartCtrl.isButtonActive('dataButton','car')).toBe(false); + }); + + it('Get ChartTemplate URL testing', function() { + expect(ChartCtrl.getChartTemplateURL).toBeDefined(); + expect(ChartCtrl.getChartTemplateURL instanceof Function).toBe(true); + }); +}); + diff --git a/test/spec/controllers/nav-controller.js b/test/spec/controllers/nav-controller.js new file mode 100644 index 0000000..48fafe3 --- /dev/null +++ b/test/spec/controllers/nav-controller.js @@ -0,0 +1,33 @@ +'use strict'; + +describe('Controller: NavCtrl', function() { + + // load the controller's module + beforeEach(module('apacheZeppelinGsocApp')); + + var NavCtrl, scope; + + // Initialize the controller and a mock scope + beforeEach(inject(function($controller, $rootScope) { + scope = $rootScope.$new(); + NavCtrl = $controller('NavCtrl', { + $scope: scope + }); + })); + + it('NavCtrl and isActive should to be defined', function() { + expect(NavCtrl).toBeDefined(); + expect(NavCtrl.isActive).toBeDefined(); + }); + + it('NavCtrl should not have a property called vm', function() { + expect(NavCtrl.vm).toBeUndefined(); + }); + + it('isActive should reutrn boolean on state.', function() { + expect(NavCtrl.isActive instanceof Function).toBe(true); + expect(NavCtrl.isActive('home')).toBe(false); + expect(NavCtrl.isActive('')).toBe(true); + }); + +});