http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/.htaccess ---------------------------------------------------------------------- diff --git a/web/demos/app/.htaccess b/web/demos/app/.htaccess deleted file mode 100644 index cb84cb9..0000000 --- a/web/demos/app/.htaccess +++ /dev/null @@ -1,543 +0,0 @@ -# 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/ - -# <IfModule mod_headers.c> -# Header set Access-Control-Allow-Origin "*" -# </IfModule> - -# ------------------------------------------------------------------------------ -# | 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/ - -<IfModule mod_setenvif.c> - <IfModule mod_headers.c> - <FilesMatch "\.(gif|ico|jpe?g|png|svg|svgz|webp)$"> - SetEnvIf Origin ":" IS_CORS - Header set Access-Control-Allow-Origin "*" env=IS_CORS - </FilesMatch> - </IfModule> -</IfModule> - -# ------------------------------------------------------------------------------ -# | Web fonts access | -# ------------------------------------------------------------------------------ - -# Allow access from all domains for web fonts - -<IfModule mod_headers.c> - <FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$"> - Header set Access-Control-Allow-Origin "*" - </FilesMatch> -</IfModule> - - -# ############################################################################## -# # 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. - -<IfModule mod_headers.c> - 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 - <FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$"> - Header unset X-UA-Compatible - </FilesMatch> -</IfModule> - -# ------------------------------------------------------------------------------ -# | Cookie setting from iframes | -# ------------------------------------------------------------------------------ - -# Allow cookies to be set from iframes in IE. - -# <IfModule mod_headers.c> -# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" -# </IfModule> - -# ------------------------------------------------------------------------------ -# | 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 | -# ------------------------------------------------------------------------------ - -<IfModule mod_mime.c> - - # 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 - -</IfModule> - -# ------------------------------------------------------------------------------ -# | 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. -<IfModule mod_mime.c> - AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml -</IfModule> - - -# ############################################################################## -# # 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 - -<IfModule mod_rewrite.c> - Options +FollowSymlinks - # Options +SymLinksIfOwnerMatch - RewriteEngine On - # RewriteBase / -</IfModule> - -# ------------------------------------------------------------------------------ -# | 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 - -<IfModule mod_rewrite.c> - RewriteCond %{HTTPS} !=on - RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] - RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] -</IfModule> - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 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. - -# <IfModule mod_rewrite.c> -# RewriteCond %{HTTPS} !=on -# RewriteCond %{HTTP_HOST} !^www\..+$ [NC] -# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] -# </IfModule> - - -# ############################################################################## -# # 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). - -# <IfModule mod_headers.c> -# Header set Content-Security-Policy "script-src 'self'; object-src 'self'" -# <FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$"> -# Header unset Content-Security-Policy -# </FilesMatch> -# </IfModule> - -# ------------------------------------------------------------------------------ -# | 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). - -<IfModule mod_autoindex.c> - Options -Indexes -</IfModule> - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Block access to hidden files and directories. -# This includes directories used by version control systems such as Git and SVN. - -<IfModule mod_rewrite.c> - RewriteCond %{SCRIPT_FILENAME} -d [OR] - RewriteCond %{SCRIPT_FILENAME} -f - RewriteRule "(^|/)\." - [F] -</IfModule> - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 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. - -<FilesMatch "(^#.*#|\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|sw[op])|~)$"> - Order allow,deny - Deny from all - Satisfy All -</FilesMatch> - -# ------------------------------------------------------------------------------ -# | 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`. - -# <IfModule mod_rewrite.c> -# RewriteCond %{SERVER_PORT} !^443 -# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L] -# </IfModule> - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 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/ - -# <IfModule mod_headers.c> -# Header set Strict-Transport-Security max-age=16070400; -# </IfModule> - -# ------------------------------------------------------------------------------ -# | 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 | -# ------------------------------------------------------------------------------ - -<IfModule mod_deflate.c> - - # Force compression for mangled headers. - # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping - <IfModule mod_setenvif.c> - <IfModule mod_headers.c> - 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 - </IfModule> - </IfModule> - - # 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 `<IfModule mod_filter.c>` and `</IfModule>` lines - # as `AddOutputFilterByType` is still in the core directives). - <IfModule mod_filter.c> - 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 - </IfModule> - -</IfModule> - -# ------------------------------------------------------------------------------ -# | 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. - -# <IfModule mod_headers.c> -# Header set Cache-Control "no-transform" -# </IfModule> - -# ------------------------------------------------------------------------------ -# | 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. -<IfModule mod_headers.c> - Header unset ETag -</IfModule> - -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. - -<IfModule mod_expires.c> - - 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" - -</IfModule> - -# ------------------------------------------------------------------------------ -# | 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 - -# <IfModule mod_rewrite.c> -# RewriteCond %{REQUEST_FILENAME} !-f -# RewriteCond %{REQUEST_FILENAME} !-d -# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L] -# </IfModule> - -# ------------------------------------------------------------------------------ -# | File concatenation | -# ------------------------------------------------------------------------------ - -# Allow concatenation from within specific CSS and JS files, e.g.: -# Inside of `script.combined.js` you could have -# <!--#include file="libs/jquery.js" --> -# <!--#include file="plugins/jquery.idletimer.js" --> -# and they would be included into this single file. - -# <IfModule mod_include.c> -# <FilesMatch "\.combined\.js$"> -# Options +Includes -# AddOutputFilterByType INCLUDES application/javascript application/json -# SetOutputFilter INCLUDES -# </FilesMatch> -# <FilesMatch "\.combined\.css$"> -# Options +Includes -# AddOutputFilterByType INCLUDES text/css -# SetOutputFilter INCLUDES -# </FilesMatch> -# </IfModule> - -# ------------------------------------------------------------------------------ -# | 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! - -# <IfModule mod_headers.c> -# Header set Connection Keep-Alive -# </IfModule>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/404.html ---------------------------------------------------------------------- diff --git a/web/demos/app/404.html b/web/demos/app/404.html deleted file mode 100644 index d52f7d3..0000000 --- a/web/demos/app/404.html +++ /dev/null @@ -1,177 +0,0 @@ -<!-- - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <title>Page Not Found :(</title> - <style> - ::-moz-selection { - background: #b3d4fc; - text-shadow: none; - } - - ::selection { - background: #b3d4fc; - text-shadow: none; - } - - html { - padding: 30px 10px; - font-size: 20px; - line-height: 1.4; - color: #737373; - background: #f0f0f0; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - } - - html, - input { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - } - - body { - max-width: 500px; - _width: 500px; - padding: 30px 20px 50px; - border: 1px solid #b3b3b3; - border-radius: 4px; - margin: 0 auto; - box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff; - background: #fcfcfc; - } - - h1 { - margin: 0 10px; - font-size: 50px; - text-align: center; - } - - h1 span { - color: #bbb; - } - - h3 { - margin: 1.5em 0 0.5em; - } - - p { - margin: 1em 0; - } - - ul { - padding: 0 0 0 40px; - margin: 1em 0; - } - - .container { - max-width: 380px; - _width: 380px; - margin: 0 auto; - } - - /* google search */ - - #goog-fixurl ul { - list-style: none; - padding: 0; - margin: 0; - } - - #goog-fixurl form { - margin: 0; - } - - #goog-wm-qt, - #goog-wm-sb { - border: 1px solid #bbb; - font-size: 16px; - line-height: normal; - vertical-align: top; - color: #444; - border-radius: 2px; - } - - #goog-wm-qt { - width: 220px; - height: 20px; - padding: 5px; - margin: 5px 10px 0 0; - box-shadow: inset 0 1px 1px #ccc; - } - - #goog-wm-sb { - display: inline-block; - height: 32px; - padding: 0 10px; - margin: 5px 0 0; - white-space: nowrap; - cursor: pointer; - background-color: #f5f5f5; - background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1); - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - *overflow: visible; - *display: inline; - *zoom: 1; - } - - #goog-wm-sb:hover, - #goog-wm-sb:focus { - border-color: #aaa; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - background-color: #f8f8f8; - } - - #goog-wm-qt:hover, - #goog-wm-qt:focus { - border-color: #105cb6; - outline: 0; - color: #222; - } - - input::-moz-focus-inner { - padding: 0; - border: 0; - } - </style> - </head> - <body> - <div class="container"> - <h1>Not found <span>:(</span></h1> - <p>Sorry, but the page you were trying to view does not exist.</p> - <p>It looks like this was the result of either:</p> - <ul> - <li>a mistyped address</li> - <li>an out-of-date link</li> - </ul> - <script> - var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host; - </script> - <script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script> - </div> - </body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/favicon.ico ---------------------------------------------------------------------- diff --git a/web/demos/app/favicon.ico b/web/demos/app/favicon.ico deleted file mode 100644 index 6527905..0000000 Binary files a/web/demos/app/favicon.ico and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/images/glyphicons-halflings.png ---------------------------------------------------------------------- diff --git a/web/demos/app/images/glyphicons-halflings.png b/web/demos/app/images/glyphicons-halflings.png deleted file mode 100644 index a996999..0000000 Binary files a/web/demos/app/images/glyphicons-halflings.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/images/main_banner.png ---------------------------------------------------------------------- diff --git a/web/demos/app/images/main_banner.png b/web/demos/app/images/main_banner.png deleted file mode 100644 index f3f4810..0000000 Binary files a/web/demos/app/images/main_banner.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/index.html ---------------------------------------------------------------------- diff --git a/web/demos/app/index.html b/web/demos/app/index.html deleted file mode 100644 index c0f2fa2..0000000 --- a/web/demos/app/index.html +++ /dev/null @@ -1,138 +0,0 @@ -<!-- - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<!doctype html> -<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> -<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> -<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> -<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title></title> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width"> - <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> - - <!-- build:css styles/vendor.css --> - <link rel="stylesheet" href="bower_components/bootstrap-sass/bootstrap-2.3.2.css"> - <link rel="stylesheet" href="bower_components/bootstrap-sass/bootstrap-responsive-2.3.2.css"> - <link rel="stylesheet" href="bower_components/ng-grid/ng-grid.css"> - <link rel="stylesheet" href="styles/jquery.pnotify.default.css"> - <!-- endbuild --> - - <!-- build:css(.tmp) styles/main.css --> - <link rel="stylesheet" href="styles/main.css"> - <!-- endbuild --> -</head> -<body ng-app="app"> -<!--[if lt IE 9]> -<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> -<![endif]--> - -<div class="navbar navbar-inverse navbar-fixed-top"> - <div class="navbar-inner"> - <div class="container-fluid"> - <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a class="brand" href="/"></a> - <div class="nav-collapse collapse"> - <ul class="nav"> - <li><a href="#twitterUrls">Twitter URLs</a></li> - <li><a href="#twitterHashtags">Twitter Hashtags</a></li> - <li><a href="#mobile">Mobile</a></li> - <li><a href="#machine">Machine</a></li> - <li><a href="#dimensions">Ads</a></li> - <li><a href="#fraud">Fraud</a></li> - </ul> - </div><!--/.nav-collapse --> - </div> - </div> -</div> - -<div class="ng-view"></div> - -<script src="settings.js"></script> - -<!-- build:js scripts/plugins.js --> -<script src="bower_components/jquery/jquery.js"></script> -<script src="bower_components/angular/angular.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-affix.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-alert.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-dropdown.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-tooltip.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-modal.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-transition.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-button.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-popover.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-typeahead.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-carousel.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-scrollspy.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-collapse.js"></script> -<script src="bower_components/bootstrap-sass/js/bootstrap-tab.js"></script> -<!-- endbuild --> - -<!-- build:js scripts/modules.js --> -<script src="bower_components/underscore/underscore.js"></script> -<script src="bower_components/angular-route/angular-route.js"></script> -<script src="bower_components/angular-resource/angular-resource.js"></script> -<script src="bower_components/angular-cookies/angular-cookies.js"></script> -<script src="bower_components/angular-sanitize/angular-sanitize.js"></script> -<script src="bower_components/restangular/src/restangular.js"></script> -<script src="bower_components/underscore/underscore.js"></script> -<script src="bower_components/ng-grid/ng-grid-2.0.11.debug.js"></script> -<script src="bower_components/d3/d3.js"></script> -<script src="bower_components/uri.js/src/URI.js"></script> -<script src="scripts/vendor/jsbn.js"></script> -<script src="scripts/vendor/gauge.js"></script> -<script src="scripts/vendor/jquery.pnotify.js"></script> -<script src="scripts/vendor/angular-google-maps.js"></script> -<script src="scripts/vendor/visibly.js"></script> -<!-- endbuild --> - -<!-- build:js({.tmp,app}) scripts/scripts.js --> -<script src="scripts/app.js"></script> -<script src="scripts/services/rest.js"></script> -<script src="scripts/services/socket.js"></script> -<script src="scripts/directives/lineChart.js"></script> -<script src="scripts/directives/gauge.js"></script> -<script src="scripts/directives/barChart.js"></script> -<script src="scripts/directives/stat.js"></script> -<script src="scripts/filters/elapsed.js"></script> -<script src="scripts/controllers/twitter.js"></script> -<script src="scripts/controllers/mobile.js"></script> -<script src="scripts/controllers/machine.js"></script> -<script src="scripts/controllers/dimensions.js"></script> -<script src="scripts/controllers/fraud.js"></script> -<!-- endbuild --> - -<script type="text/javascript" src="https://www.google.com/jsapi"></script> -<script type="text/javascript"> - google.load('visualization', '1', {'packages':['corechart']}); -</script> - -<script src="http://maps.googleapis.com/maps/api/js?sensor=false&language=en"></script> -<script src="scripts/vendor/markerwithlabel.js"></script> - -</body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/robots.txt ---------------------------------------------------------------------- diff --git a/web/demos/app/robots.txt b/web/demos/app/robots.txt deleted file mode 100644 index 9417495..0000000 --- a/web/demos/app/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# robotstxt.org - -User-agent: * http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/scripts/app.js ---------------------------------------------------------------------- diff --git a/web/demos/app/scripts/app.js b/web/demos/app/scripts/app.js deleted file mode 100644 index 274f355..0000000 --- a/web/demos/app/scripts/app.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/*global angular*/ -(function () { -'use strict'; - -angular.module('widgets', ['socket']); - -angular.module('twitter', ['rest', 'socket', 'widgets', 'ngGrid']); -angular.module('mobile', ['rest', 'widgets', 'ngGrid', 'google-maps']); -angular.module('machine', ['ng', 'rest', 'widgets']); -angular.module('dimensions', ['ng', 'rest', 'widgets']); -angular.module('fraud', ['rest', 'widgets']); - -angular.module('app', ['ngRoute', 'socket', 'twitter', 'mobile', 'machine', 'dimensions', 'fraud']); - -angular.module('app') - .config(function ($routeProvider, socketProvider) { - if (window.settings) { - socketProvider.setWebSocketURL(settings.webSocketURL); - } - - $routeProvider - .when('/', { - templateUrl: 'views/welcome.html' - }) - .when('/twitterUrls', { - templateUrl: 'views/twitter.html', - controller: 'TwitterUrlsController' - }) - .when('/twitterHashtags', { - templateUrl: 'views/twitter.html', - controller: 'TwitterHashtagsController' - }) - .when('/mobile', { - templateUrl: 'views/mobile.html', - controller: 'MobileController' - }) - .when('/machine', { - templateUrl: 'views/machine.html', - controller: 'MachineController' - }) - .when('/dimensions', { - templateUrl: 'views/dimensions.html', - controller: 'DimensionsController' - }) - .when('/fraud', { - templateUrl: 'views/fraud.html', - controller: 'FraudController' - }) - }); - -})(); - - - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/scripts/controllers/dimensions.js ---------------------------------------------------------------------- diff --git a/web/demos/app/scripts/controllers/dimensions.js b/web/demos/app/scripts/controllers/dimensions.js deleted file mode 100644 index 41c9bd0..0000000 --- a/web/demos/app/scripts/controllers/dimensions.js +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/*global settings, angular, google, jQuery, _, URI*/ -(function () { - 'use strict'; - - var chartOptions = { - legend: 'none', - chartArea: { top: 20, height: 240 } - }; - - function getEmptyChartOptionsFn(scope) { - return function () { - var now = Date.now(); - var max = new Date(now); - var min = new Date(now - scope.lookback * 60 * 1000); - var options = jQuery.extend({}, chartOptions, { - vAxis: { minValue: 0, maxValue: 100 }, - hAxis: { viewWindow: { min: min, max: max }} - }); - return options; - }; - } - - function chartData(data, property) { - return _.map(data, function (obj) { - return { - timestamp: obj.timestamp, - value: obj[property] - }; - }); - } - - function chartDataFn(data, fn) { - return _.map(data, function (obj) { - return { - timestamp: obj.timestamp, - value: fn(obj) - }; - }); - } - - function getRequestParams($scope) { - return { - publisher: $scope.publisher.value, - advertiser: $scope.advertiser.value, - adunit: $scope.adunit.value, - lookback: $scope.lookback, - includeLastMinute: $scope.includeLastMinute - }; - } - - function PollRequest (rest, scope, callback) { - this.rest = rest; - this.scope = scope; - this.max = scope.lookback; - this.dataCache = null; - this.callback = callback; - this.cancelled = false; - this.interval = null; - this.timeout = null; - this.params = getRequestParams(this.scope); - } - - PollRequest.prototype = { - cancel: function () { - this.cancelled = true; - this.scope.requestProgress = 0; - clearInterval(this.interval); - clearTimeout(this.timeout); - }, - - responseStatus: function () { - this.scope.requestProgress = Math.round((Date.now() - this.requestStartTime) / 1000); - this.scope.$apply(); - }, - - fetchDimensionsData: function () { - if (this.dataCache && this.dataCache.length) { - this.params.lastTimestamp = _.last(this.dataCache).timestamp; - } - - var max = this.max; - - this.requestStartTime = Date.now(); - - this.interval = setInterval(this.responseStatus.bind(this), 250); - - var that = this; - - this.rest.getDimensionsData(this.params).then(function (response) { - if (that.cancelled) { - return; - } - - that.scope.response = response; - var minutes = response.minutes; - that.scope.requestProgress = 0; - clearInterval(that.interval); - - var now = Date.now(); - that.scope.lastResponse = new Date(now); - that.scope.responseTime = now - that.requestStartTime; - if (!that.dataCache) { - that.dataCache = minutes; - - that.scope.minutesCached = 0; - that.scope.minutesReceived = minutes.length; - - } else if (minutes.length > 0) { - that.scope.minutesCached = that.dataCache.length; - that.scope.minutesReceived = minutes.length; - - that.dataCache.pop(); // remove last element since response should have new values for the last minute - - var newlength = that.dataCache.length + minutes.length; - - if (newlength > max) { - that.dataCache.splice(0, newlength - max); - } - that.dataCache.push.apply(that.dataCache, minutes); // add all elements - } - - that.callback(that.dataCache); - var nextTimeout = that.scope.pollInterval * 1000 - (Date.now() - that.requestStartTime); - nextTimeout = Math.max(0, nextTimeout); - - that.timeout = setTimeout(that.fetchDimensionsData.bind(that), nextTimeout); - }, - function (errorResponse) { - that.cancel(); - }); - } - }; - - - angular.module('dimensions') - .controller('DimensionsController', ['$scope', '$timeout', '$location', '$routeParams', 'rest', function ($scope, $timeout, $location, $routeParams, rest) { - var queryParams = new URI(window.location.href).query(true); - var emptyChartOptionsFn = getEmptyChartOptionsFn($scope); - - rest.getApp(settings.dimensions.appName).then(function (app) { - $scope.app = app; - $scope.appURL = settings.appsURL + app.id; - }); - - $scope.pollInterval = settings.dimensions.pollInterval; - $scope.includeLastMinute = false; - - $scope.range = function (name) { - var r = settings.dimensions.range[name]; - return _.range(r.start, r.stop + 1); - }; - - function setupSelect(name, label) { - var rangeValues = $scope.range(name); - var list = _.map(rangeValues, function (value) { - return { - value: String(value), - label: label + ' ' + value - }; - }); - list.splice(0, 0, { value: "", label: 'ALL '}); - - $scope.select[name] = list; - - var selected = null; - - if (queryParams[name]) { - selected = _.findWhere(list, { value: queryParams[name] }); - } - - if (selected) { - $scope[name] = selected; - } else { - $scope[name] = list[0]; - } - } - - $scope.select = {}; - setupSelect('publisher', 'Publisher'); - setupSelect('advertiser', 'Advertiser'); - setupSelect('adunit', 'Ad Unit'); - $scope.lookback = queryParams.lookback ? parseInt(queryParams.lookback, 10) : settings.dimensions.lookback; - - $scope.reload = function () { - //TODO have Angular route instead of reloading the page - window.location.href = window.location.pathname + '?' + jQuery.param(getRequestParams($scope)); - }; - - function updateCharts(data) { - $scope.costChart = { - data: chartData(data, 'cost'), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - $scope.revenueChart = { - data: chartData(data, 'revenue'), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - $scope.impressionsChart = { - data: chartData(data, 'impressions'), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - $scope.clicksChart = { - data: chartData(data, 'clicks'), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - $scope.ctrChart = { - data: chartDataFn(data, function (item) { - return item.clicks / item.impressions * 100; - }), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - $scope.marginChart = { - data: chartDataFn(data, function (item) { - return (item.cost - item.revenue) / item.revenue; - }), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - } - - $scope.costChart = { - emptyChartOptions: emptyChartOptionsFn - }; - $scope.revenueChart = { - emptyChartOptions: emptyChartOptionsFn - }; - $scope.impressionsChart = { - emptyChartOptions: emptyChartOptionsFn - }; - $scope.clicksChart = { - emptyChartOptions: emptyChartOptionsFn - }; - $scope.ctrChart = { - emptyChartOptions: emptyChartOptionsFn - }; - $scope.marginChart = { - emptyChartOptions: emptyChartOptionsFn - }; - - var request = null; - function reloadCharts() { - //TODO check if lookback is valid - if (request) { - request.cancel(); - } - request = new PollRequest(rest, $scope, updateCharts); - request.fetchDimensionsData(); - } - - $scope.$watch('[publisher, advertiser, adunit]', function () { - reloadCharts(); - }, true); - - function watchWithDelay(model, delay) { - var timeout; - var firstUpdate = true; - $scope.$watch(model, function () { - if (!firstUpdate) { // skip first change since there is a watch for select fields - clearTimeout(timeout); - timeout = setTimeout(reloadCharts, delay); - } else { - firstUpdate = false; - } - }); - } - - watchWithDelay('lookback', 500); - watchWithDelay('pollInterval', 500); - watchWithDelay('includeLastMinute', 0); //TODO no delay necessary - - // stop server polling on destroy (e.g. when navigating to another view) - $scope.$on('$destroy', function () { - if (request) { - request.cancel(); - } - }.bind(this)); - }]); - -})(); http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/scripts/controllers/fraud.js ---------------------------------------------------------------------- diff --git a/web/demos/app/scripts/controllers/fraud.js b/web/demos/app/scripts/controllers/fraud.js deleted file mode 100644 index a19f022..0000000 --- a/web/demos/app/scripts/controllers/fraud.js +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/*global angular, jQuery, _*/ -(function () { -'use strict'; - -angular.module('fraud') - - .controller('FraudController', ['$scope', 'rest', 'socket', function ($scope, rest, socket) { - - // topic for publishing transactions - var txTopic = 'demos.app.frauddetect.submitTransaction'; - var appPromise = rest.getApp(settings.fraud.appName); - appPromise.then(function (app) { - $scope.app = app; - $scope.appURL = settings.appsURL + app.id; - $scope.startedTime = app.startedTime; - }); - - // Options for merchant, terminal, zip, card, bin - $scope.alertTypeTitles = { - "smallThenLarge": "Suspicious Transaction Sequence", - "sameCard": "Same Card Multiple Times", - "sameBankId": "Same Bank Number Multiple Times", - "aboveAvg": "Above Average Transaction" - } - $scope.stats = [ - { id: 'totalTxns', topic: 'demos.app.frauddetect.totalTransactions', value: 0, label: 'Total Txns' }, - { id: 'amtInLastSecond', topic: 'demos.app.frauddetect.txLastSecond', value: 0, label: 'Total Dollars / sec' }, - // { id: 'amtInLastHour', topic: 'demos.app.frauddetect.txLastHour', value: 0, label: 'Total for Last Hour' }, - { id: 'avgAmtInLastSecond', topic: 'demos.app.frauddetect.avgLastSecond', value: 0, label: 'Avg Txn Amount / sec' }, - { id: 'numFrauds', topic: 'demos.app.frauddetect.totalFrauds', value: 0, label: 'No. of Anomalies Detected' }, - // { id: 'avgScore', topic: 'demos.app.frauddetect.avgScore', value: 0, label: 'Average Score' } - ]; - $scope.merchants = ['Wal-Mart', 'Target', 'Amazon', 'Apple', 'Sears', 'Macys', 'JCPenny', 'Levis']; - $scope.terminals = [1, 2, 3, 4, 5, 6, 7, 8]; - $scope.zips = [94086, 94087, 94088, 94089, 94090, 94091, 94092, 94093]; - $scope.actions = [ - { - id: 1, - subtitle: $scope.alertTypeTitles.smallThenLarge, - severity: 'low', - description: 'This anomaly is when one credit card is used for a small purchase, then immediately again for a larger purchase. The idea here is that a scammer will first try a small purchase to ensure that the card works, then proceed with a larger purchase upon success.', - generateTxns: function(e) { - - var bin = getRandomBin(); - var card = getRandomCard(); - - submitTransaction({ - 'zipCode': getRandom('zips'), - 'merchantId': getRandom('merchants'), - 'terminalId': getRandom('terminals'), - 'bankIdNum': bin, - 'ccNum': card, - 'amount': 5.00 - }); - - setTimeout(function() { - submitTransaction({ - 'zipCode': getRandom('zips'), - 'merchantId': getRandom('merchants'), - 'terminalId': getRandom('terminals'), - 'bankIdNum': bin, - 'ccNum': card, - 'amount': 600.00 - }); - }, 5000) - - } - }, - // { - // id: 2, - // subtitle: $scope.alertTypeTitles.sameCard, - // description: 'This anomaly is when one credit card is used for multiple transactions across one or more vendors within a short time interval.', - // generateTxns: function() { - // - // var bin = getRandomBin(); - // var card = getRandomCard(); - // var merchant = getRandom('merchants'); - // - // var intval = setInterval(function() { - // submitTransaction({ - // 'zipCode': getRandom('zips'), - // 'merchantId': merchant, - // 'terminalId': getRandom('terminals'), - // 'bankIdNum': bin, - // 'ccNum': card, - // 'amount': roundToPrice(10 + Math.random() * 1000) - // }); - // }, 1000); - // - // setTimeout(function() { - // clearInterval(intval); - // }, 8000); - // } - // }, - { - id: 2, - subtitle: $scope.alertTypeTitles.sameBankId, - severity: 'high', - description: 'This anomaly is detected when several transactions are made by cards issued by the same bank at the same terminal ID over moving window of 30 sec.', - generateTxns: function() { - var bin = getRandomBin().replace(/\d{4}$/, '1111'); - var zipCode = getRandom('zips'); - var terminalId = getRandom('terminals'); - var merchant = getRandom('merchants'); - - var intval = setInterval(function() { - submitTransaction({ - 'zipCode': zipCode, - 'merchantId': merchant, - 'terminalId': terminalId, - 'bankIdNum': bin, - 'ccNum': getRandomCard(), - 'amount': roundToPrice(100 + Math.random() * 10) - }, true); - }, 200); - - $.pnotify({ - title: 'Several Transactions Being Sent', - text: '<strong>Bank ID:</strong> ' + bin + ', <strong>Merchant:</strong> ' + merchant, - type: 'success' - }); - - setTimeout(function() { - clearInterval(intval); - }, 11000); - } - }, - { - id: 3, - subtitle: $scope.alertTypeTitles.aboveAvg, - severity: 'medium', - description: 'This anomaly is when a transaction at a given merchant significantly exceeds that merchant\'s average transaction amount.', - generateTxns: function() { - console.log('getting randomStats'); - // $.get('/fraud/randomStats').done(function(res) { - // var bin = getRandomBin(); - // var merchantId = res.merchantId; - // var terminalId = res.terminalId; - // var zipCode = res.zipCode; - // var amount = roundToPrice(res.sma + 35000); - // - // for (var i = 5; i >= 0; i--) { - // submitTransaction({ - // 'zipCode': zipCode, - // 'merchantId': merchantId, - // 'terminalId': terminalId, - // 'bankIdNum': getRandomBin(), - // 'ccNum': getRandomCard(), - // 'amount': 20 + Math.round(Math.random() * 10) - // }, true); - // } - // - // setTimeout(function() { - // submitTransaction({ - // 'zipCode': zipCode, - // 'merchantId': merchantId, - // 'terminalId': terminalId, - // 'bankIdNum': getRandomBin(), - // 'ccNum': getRandomCard(), - // 'amount': amount - // }); - // }, 3000) - // - // }); - $.pnotify({ - 'type': 'info', - 'title': 'Retrieving Average Information' - }); - $.get('/fraud/randomStats').done(function(res) { - - var bin = getRandomBin(); - var merchantId = res.merchantId; - var terminalId = res.terminalId; - var zipCode = res.zipCode; - var amount = roundToPrice(res.sma + 1500); - - setTimeout(function() { - submitTransaction({ - 'zipCode': zipCode, - 'merchantId': merchantId, - 'terminalId': terminalId, - 'bankIdNum': getRandomBin(), - 'ccNum': getRandomCard(), - 'amount': amount - }); - }, 1000) - - }); - } - } - ]; - - // subscribe to appropriate topics for alerts and stats - appPromise.then(function(app) { - socket.subscribe('demos.app.frauddetect.fraudAlert', function(res) { - // console.log('received fraudAlert: ', res); - // console.log(res.data.alertType, res.data.alertData ? res.data.alertData.fullCcNum : ''); - if (res.data.alertType === 'aboveAvg') { - console.log('aboveAvg', res.data); - } - if (res.data.userGenerated === "true" || res.data.userGenerated === true) { - displayAlert(res.data); - } - }, $scope); - socket.subscribe('demos.app.frauddetect.txSummary', function(res) { - var data = res.data; - _.each(['amtInLastSecond','avgAmtInLastSecond','totalTxns','txnsInLastSecond'], function(key) { - - // Find stat to update - var stat = _.find($scope.stats, function(obj) { - return obj.id == key; - }); - - // Check that stat was found - if (stat) { - - if (['amtInLastSecond', 'avgAmtInLastSecond'].indexOf(key) > -1) { - - stat.value = '$' + makeMoney(data[key]); - - } else { - - stat.value = commaGroups(data[key]); - - } - - } - - }); - $scope.$apply(); - }, $scope); - }); - $scope.stats.forEach(function(stat){ - socket.subscribe(stat.topic, function(res) { - console.log("stat topic " + stat.topic + " data received: ", res); - stat.value = res.value; - $scope.$apply(); - }, $scope); - }); - - $scope.alerts = []; - - // helper function for choosing random items from a list - function getRandom(list) { - return $scope[list][ Math.floor(Math.random() * $scope[list].length) ]; - } - function roundToPrice(amt) { - // return Math.round( amt * 100 ) / 100; - return Math.round(amt); - } - function getRandomBin() { - // Bank ID will be between 1000 0000 and 3500 0000 (25 BINs) - var base = Math.floor(Math.random() * 25) + 10; - return base + "00 0000"; - } - function getRandomCard() { - // CC will be 1000 0000 to 1400 0000 (400,000 cards per BIN) - var base = Math.floor(Math.random() * 400000) + 10000000; - var baseString = base + ''; - return baseString.substring(0, 4) + " " + baseString.substring(4); - } - function displayAlert(data) { - var index = $scope.alerts.push(data) - 1; - var alertTitle = $scope.alertTypeTitles[data.alertType]; - var html = ''; - switch(data.alertType) { - case 'smallThenLarge': - html = [ - '<article class="alert-msg low" style="display:none">', - '<h1>' + alertTitle + '</h1>', - '<p>' + data.message + '</p>', - '<div><a href="#" class="btn view-txn-btn" data-txidx="' + index + '">view details</a></div>', - '</article>' - ].join(''); - break; - case 'sameBankId': - console.log('same bank', data); - html = [ - '<article class="alert-msg high" style="display:none">', - '<h1>' + alertTitle + '</h1>', - '<p>' + data.message + '</p>', - '<div><a href="#" class="btn view-txn-btn" data-txidx="' + index + '">view details</a></div>', - '</article>' - ].join(''); - break; - default: - html = [ - '<article class="alert-msg medium" style="display:none">', - '<h1>' + alertTitle + '</h1>', - '<p>' + data.message + '</p>', - '<div><a href="#" class="btn view-txn-btn" data-txidx="' + index + '">view details</a></div>', - '</article>' - ].join(''); - break; - - - } - var $el = $(html); - $('#alertDisplayBox').prepend($el); - $el - .slideDown() - .animate({ 'opacity': 0.5 }, 180) - .animate({ 'opacity': 1 }, 180) - .animate({ 'opacity': 0.5 }, 180) - .animate({ 'opacity': 1 }, 180) - } - function submitTransaction(txn, noMessage) { - socket.publish(txTopic, txn); - console.log('txn', txn); - if (!noMessage) { - $.pnotify({ - 'title': 'Transaction Submitted', - 'text': - '<strong>card</strong>: ' + txn.bankIdNum + ' ' + txn.ccNum + '<br/> ' + - '<strong>amount</strong>: $' + makeMoney(txn.amount) + '<br/> ' + - '<strong>merchant</strong>: ' + txn.merchantId + ', <strong>terminal</strong>: ' + txn.terminalId, - - 'type': 'success' - }); - } - } - function genTxnDisplayMarkup(alert) { - var html = ''; - switch(alert.alertType) { - case "smallThenLarge": - var info = alert.alertData; - html = [ - '<strong>Card Number:</strong> ' + info.fullCcNum + '<br/>', - '<strong>Zip Code:</strong> ' + info.zipCode + '<br/>', - '<strong>Merchant:</strong> ' + info.merchantId + ' (' + info.merchantType.toLowerCase().replace('_', ' ') + ')' + '<br/>', - '<strong>Small Amount:</strong> $' + makeMoney(info.small) + '<br/>', - '<strong>Large Amount:</strong> $' + makeMoney(info.large) + '<br/>', - '<strong>Threshold:</strong> $' + makeMoney(info.threshold) + '<br/>', - '<strong>Time:</strong> ' + new Date(1*info.time).toLocaleString() + '<br/>' - ].join(''); - - break; - - case "sameBankId": - var info = alert.alertData; - html = [ - '<strong>Transaction Count:</strong> ' + info.count + '<br/>', - '<strong>Bank ID Number:</strong> ' + info.bankIdNum + '<br/>', - '<strong>Zip Code:</strong> ' + info.zipCode + '<br/>', - '<strong>Merchant:</strong> ' + info.merchantId + ' (' + info.merchantType.toLowerCase().replace('_', ' ') + ')' + '<br/>', - '<strong>Terminal:</strong> ' + info.terminalId + '<br/>', - '<strong>Time:</strong> ' + new Date(1*info.time).toLocaleString() + '<br/>' - ].join(''); - - break; - - case "aboveAvg": - var info = alert.alertData; - html = [ - '<strong>Dollar Amount:</strong> $' + makeMoney(info.amount) + '<br/>', - '<strong>Last Average:</strong> $' + makeMoney(info.lastSmaValue) + '<br/>', - '<strong>Difference:</strong> $' + makeMoney(info.change) + '<br/>', - '<strong>Zip Code:</strong> ' + info.zipCode + '<br/>', - '<strong>Merchant:</strong> ' + info.merchantId + ' (' + info.merchantType.toLowerCase().replace('_', ' ') + ')' + '<br/>', - '<strong>Terminal:</strong> ' + info.terminalId + '<br/>', - '<strong>Time:</strong> ' + new Date(1*info.time).toLocaleString() + '<br/>' - ].join(''); - break; - } - return html; - } - function makeMoney(value) { - value = (value * 1).toFixed(2); - return commaGroups(value); - } - function commaGroups(value) { - var parts = value.toString().split("."); - parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); - return parts.join("."); - } - - var scopeDestroyed = false; - - function updateFraudCount() { - if (scopeDestroyed) { - return; - } - - if ($scope.startedTime) { - $.get('/fraud/alertCount?since=' + $scope.startedTime).done(function(res) { - - var countStat = _.find($scope.stats, function(obj) { - return obj.id == 'numFrauds'; - }); - - var value = _.reduce(res, function(memo, val, key) { return memo + val }, 0); - - countStat.value = commaGroups(value); - - setTimeout(updateFraudCount, 2000); - }); - } else { - setTimeout(updateFraudCount, 2000); - } - } - - // Set up viewing transaction modal - $('#alertDisplayBox').on('click', '.view-txn-btn', function(evt) { - evt.preventDefault(); - var index = $(this).attr('data-txidx'); - var alert = $scope.alerts[index]; - $('#txn-modal .modal-body').html(genTxnDisplayMarkup(alert)); - $('#txn-modal').modal(); - }); - - // Start interval to poll for alerts count - updateFraudCount(); - - $scope.clearFrauds = function() { - $('#alertDisplayBox').html(""); - } - - // stop server polling on destroy (e.g. when navigating to another view) - $scope.$on('$destroy', function () { - scopeDestroyed = true; - }.bind(this)); - }]); - -})(); http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/scripts/controllers/machine.js ---------------------------------------------------------------------- diff --git a/web/demos/app/scripts/controllers/machine.js b/web/demos/app/scripts/controllers/machine.js deleted file mode 100644 index d6a6d3a..0000000 --- a/web/demos/app/scripts/controllers/machine.js +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/*global settings, angular, google, jQuery, _, URI*/ -(function () { -'use strict'; - -var chartOptions = { - legend: 'none', - vAxis: { format: settings.machine.metricformat }, - chartArea: { top: 20, height: 240 } -}; - -function getEmptyChartOptionsFn(scope) { - return function () { - var now = Date.now(); - var max = new Date(now); - var min = new Date(now - scope.lookback * 60 * 1000); - var options = jQuery.extend({}, chartOptions, { - vAxis: { minValue: 0, maxValue: 100 }, - hAxis: { viewWindow: { min: min, max: max }} - }); - return options; - }; -} - -function chartData(data, property) { - return _.map(data, function (obj) { - return { - timestamp: obj.timestamp, - value: obj[property] - }; - }); -} - -function getRequestParams($scope) { - return { - customer: $scope.customer.value, - product: $scope.product.value, - os: $scope.os.value, - software1: $scope.software1.value, - software2: $scope.software2.value, - deviceId: $scope.deviceId.value, - lookback: $scope.lookback - }; -} - -function PollRequest (rest, scope, callback) { - this.rest = rest; - this.scope = scope; - this.max = scope.lookback; - this.dataCache = null; - this.callback = callback; - this.cancelled = false; - this.interval = null; - this.timeout = null; - this.params = getRequestParams(this.scope); -} - -PollRequest.prototype = { - cancel: function () { - this.cancelled = true; - this.scope.requestProgress = 0; - clearInterval(this.interval); - clearTimeout(this.timeout); - }, - - responseStatus: function () { - this.scope.requestProgress = Math.round((Date.now() - this.requestStartTime) / 1000); - this.scope.$apply(); - }, - - fetchMachineData: function () { - if (this.dataCache && this.dataCache.length) { - this.params.lastTimestamp = _.last(this.dataCache).timestamp; - } - - var max = this.max; - - this.requestStartTime = Date.now(); - - this.interval = setInterval(this.responseStatus.bind(this), 250); - - var that = this; - - this.rest.getMachineData(this.params).then(function (response) { - if (that.cancelled) { - return; - } - - that.scope.response = response; - var minutes = response.minutes; - that.scope.requestProgress = 0; - clearInterval(that.interval); - - var now = Date.now(); - that.scope.lastResponse = new Date(now); - that.scope.responseTime = now - that.requestStartTime; - if (!that.dataCache) { - that.dataCache = minutes; - - that.scope.minutesCached = 0; - that.scope.minutesReceived = minutes.length; - - } else if (minutes.length > 0) { - that.scope.minutesCached = that.dataCache.length; - that.scope.minutesReceived = minutes.length; - - that.dataCache.pop(); // remove last element since response should have new values for the last minute - - var newlength = that.dataCache.length + minutes.length; - - if (newlength > max) { - that.dataCache.splice(0, newlength - max); - } - that.dataCache.push.apply(that.dataCache, minutes); // add all elements - } - - that.callback(that.dataCache); - - var nextTimeout = settings.machine.pollInterval - (Date.now() - that.requestStartTime); - nextTimeout = Math.max(0, nextTimeout); - - that.timeout = setTimeout(that.fetchMachineData.bind(that), nextTimeout); - }, - function (errorResponse) { - that.cancel(); - }); - } -}; - - -angular.module('machine') - .controller('MachineController', ['$scope', '$timeout', '$location', '$routeParams', 'rest', function ($scope, $timeout, $location, $routeParams, rest) { - var queryParams = new URI(window.location.href).query(true); - var emptyChartOptionsFn = getEmptyChartOptionsFn($scope); - - rest.getApp(settings.machine.appName).then(function (app) { - $scope.app = app; - $scope.appURL = settings.appsURL + app.id; - }); - - $scope.cpu = 0; - $scope.ram = 0; - $scope.hdd = 0; - - $scope.range = function (name) { - var r = settings.machine.range[name]; - return _.range(r.start, r.stop + 1); - }; - - function setupSelect(name, label) { - var rangeValues = $scope.range(name); - var list = _.map(rangeValues, function (value) { - return { - value: String(value), - label: label + ' ' + value - }; - }); - list.splice(0, 0, { value: "", label: 'ALL '}); - - $scope.select[name] = list; - - var selected = null; - - if (queryParams[name]) { - selected = _.findWhere(list, { value: queryParams[name] }); - } - - if (selected) { - $scope[name] = selected; - } else { - $scope[name] = list[0]; - } - } - - $scope.select = {}; - setupSelect('customer', 'Customer'); - setupSelect('product', 'Product'); - setupSelect('os', 'OS'); - setupSelect('software1', 'Software1 Version'); - setupSelect('software2', 'Software2 Version'); - setupSelect('deviceId', 'Device ID'); - $scope.lookback = queryParams.lookback ? parseInt(queryParams.lookback, 10) : settings.machine.lookback; - - $scope.reload = function () { - //TODO have Angular route instead of reloading the page - window.location.href = window.location.pathname + '?' + jQuery.param(getRequestParams($scope)); - }; - - function updateCharts(data) { - if (data && (data.length > 0)) { - var current = _.last(data); - $scope.cpu = parseFloat(current.cpu); - $scope.ram = parseFloat(current.ram); - $scope.hdd = parseFloat(current.hdd); - } - $scope.cpuChart = { - data: chartData(data, 'cpu'), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - $scope.ramChart = { - data: chartData(data, 'ram'), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - $scope.hddChart = { - data: chartData(data, 'hdd'), - options: chartOptions, - emptyChartOptions: emptyChartOptionsFn - }; - } - - $scope.cpuChart = { - emptyChartOptions: emptyChartOptionsFn - }; - $scope.ramChart = { - emptyChartOptions: emptyChartOptionsFn - }; - $scope.hddChart = { - emptyChartOptions: emptyChartOptionsFn - }; - - var request = null; - function reloadCharts() { - //TODO check if lookback is valid - if (request) { - request.cancel(); - } - request = new PollRequest(rest, $scope, updateCharts); - request.fetchMachineData(); - } - - $scope.$watch('[customer, product, os, software1, software1, deviceId]', function () { - reloadCharts(); - }, true); - - var lookbackTimeout; - - var firstUpdate = true; - - $scope.$watch('lookback', function () { - if (!firstUpdate) { // skip first change since there is a watch for select fields - clearTimeout(lookbackTimeout); - lookbackTimeout = setTimeout(reloadCharts, 500); - } else { - firstUpdate = false; - } - }); - - // stop server polling on destroy (e.g. when navigating to another view) - $scope.$on('$destroy', function () { - if (request) { - request.cancel(); - } - }.bind(this)); - }]); - -})(); http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/e1a45507/web/demos/app/scripts/controllers/mobile.js ---------------------------------------------------------------------- diff --git a/web/demos/app/scripts/controllers/mobile.js b/web/demos/app/scripts/controllers/mobile.js deleted file mode 100644 index 2301041..0000000 --- a/web/demos/app/scripts/controllers/mobile.js +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/*global settings, angular, google, jQuery, _*/ -(function () { -'use strict'; - -function translateLatLong(item) { - var match = item.location.match(/\((\d+),(\d+)/); //TODO server should pass this data as numbers - var lat = parseInt(match[1], 10); - var lon = parseInt(match[2], 10); - var phone = parseInt(item.phone, 10); - - //TODO magic numbers - var latitude = 37.40180101292334 + (phone % 4 - 2) * 0.01 - lat * 0.005; - var longitude = -121.9966721534729 + (phone % 8 - 4) * 0.01 + lon * 0.007; - - return { latitude: latitude, longitude: longitude, label: item.phone, phone: item.phone }; -} - -angular.module('mobile') - .controller('MobileController', ['$scope', 'rest', 'socket', function ($scope, rest, socket) { - rest.getApp(settings.mobile.appName).then(function (app) { - $scope.app = app; - $scope.appURL = settings.appsURL + app.id; - }); - - var map = {}; - - socket.subscribe(settings.mobile.topic.out, function(message) { - var item = message.data; - - if (!item.hasOwnProperty('removed')) { - var latlon = translateLatLong(item); - map[item.phone] = latlon; - } else { - delete map[item.phone]; - } - - $scope.$broadcast('datachanged', map); - }, $scope); - - //$scope.$on('phone_added', function (event, phone) { - // map[phone] = { phone: phone }; - // $scope.$broadcast('datachanged', map); - //}); - - //$scope.$on('phone_removed', function (event, phone) { - // removed[phone] = Date.now(); - // delete map[phone]; - // $scope.$broadcast('datachanged', map); - //}); - }]) - .controller('MobileGridControlller', ['$scope', '$filter', '$timeout', 'socket', function ($scope, $filter, $timeout, socket) { - $scope.$on('datachanged', function (event, map) { - $scope.gridData = _.values(map); - }); - - $scope.phone = ''; - $scope.addPhone = function () { - var command = { - command : 'add', - phone : $scope.phone - }; - - var message = { "type" : "publish", "topic" : settings.mobile.topic.in, "data" : command }; - socket.send(message); - - //$scope.$emit('phone_added', $scope.phone); - - $scope.phone = ''; - }; - - $scope.removePhone = function(phone) { - var command = { - command : 'del', - phone : phone - }; - - var message = { "type" : "publish", "topic" : settings.mobile.topic.in, "data" : command }; - socket.send(message); - - //$scope.$emit('phone_removed', phone); - }; - - $scope.gridOptions = { - data: 'gridData', - enableColumnResize: true, - enableRowSelection: false, - columnDefs: [ - { field: "phone", displayName: 'Phone', width: '30%', sortable: false }, - { field: "latitude", displayName: 'Latitude', cellFilter: 'number:3', width: '30%', sortable: false }, - { field: "longitude", displayName: 'Longitude', cellFilter: 'number:3', width: '30%', sortable: false }, - { field: "phone", displayName: '', cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()" ng-click="removePhone(COL_FIELD)"><i class="icon-trash"></i></div>', cellClass: 'mobile-grid-remove', width: '10%', sortable: false } - ] - }; - }]) - .controller('MapController', ['$scope', 'socket', function ($scope, socket) { - google.maps.visualRefresh = true; - - $scope.$on('datachanged', function (event, map) { - $scope.markersProperty = _.values(map); //TODO update only changed marker - }); - - angular.extend($scope, { - position: { - coords: { - latitude: 37.36197126180853, - longitude: -121.92674696445465 - } - }, - zoomProperty: 12 - }); - }]); - -})();
