You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by ds...@apache.org on 2013/12/03 23:41:23 UTC

svn commit: r1547623 - in /incubator/streams/branches/webservice: streams-components/src/main/java/org/apache/streams/components/storm/ streams-web/src/main/webapp/demo/ streams-web/src/main/webapp/demo/js/

Author: dsullivan
Date: Tue Dec  3 22:41:23 2013
New Revision: 1547623

URL: http://svn.apache.org/r1547623
Log:
adding new functions to activityDemo.js

Modified:
    incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormActivityAggregator.java
    incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html
    incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js
    incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/login.html

Modified: incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormActivityAggregator.java
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormActivityAggregator.java?rev=1547623&r1=1547622&r2=1547623&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormActivityAggregator.java (original)
+++ incubator/streams/branches/webservice/streams-components/src/main/java/org/apache/streams/components/storm/StormActivityAggregator.java Tue Dec  3 22:41:23 2013
@@ -26,6 +26,7 @@ public class StormActivityAggregator {
         TopologyBuilder builder = new TopologyBuilder();
 
         builder.setSpout("activity", spout, 10);
+
         builder.setBolt("distribute", bolt, 3).shuffleGrouping("activity");
 
         Config conf = new Config();

Modified: incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html?rev=1547623&r1=1547622&r2=1547623&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html (original)
+++ incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html Tue Dec  3 22:41:23 2013
@@ -21,13 +21,27 @@
 </head>
 <body onload="activityDemo.getActivities()">
 
-    <form  class="form-activities">
-        <label>Filters to Add:</label>
-        <input id="addFilters" type="text" class="form-control" placeholder="Separate multiple filters with commas" autofocus><br>
-        <label>Filters to Remove:</label>
-        <input id="removeFilters" type="text" class="form-control" placeholder="Separate filters with spaces" autofocus><br>
-        <button id="submitButton" type="button" class="btn btn-lg btn-primary btn-block" onclick="activityDemo.setFilters()">Update Filters</button><br><br>
-    </form>
+<form class="form-activities">
+    <label>Filters to Add:</label>
+
+    <div class="row">
+        <div class="col-lg-12">
+            <div class="input-group">
+                <input id="addFilters" type="text" class="form-control" placeholder="Separate multiple filters with commas" autofocus>
+                <span class="input-group-btn">
+                    <button class="btn btn-default" type="button" onclick="activityDemo.newFilters()">+</button>
+                </span>
+            </div>
+        </div>
+    </div>
+    <br>
+    <label>Filters to Remove:</label>
+    <input id="removeFilters" type="text" class="form-control" placeholder="Separate filters with spaces" autofocus><br>
+    <button id="submitButton" type="button" class="btn btn-lg btn-primary btn-block"
+            onclick="activityDemo.setFilters()">Update
+    </button>
+    <br><br>
+</form>
     <div id="activityStream"></div>
     <script type="text/x-handlebars-template" id='activity-template'>
         <!--Iterates through each activity in the array that was returned from Streams-->

Modified: incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js?rev=1547623&r1=1547622&r2=1547623&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js (original)
+++ incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js Tue Dec  3 22:41:23 2013
@@ -1,10 +1,11 @@
 var activityDemo = activityDemo || (function(){
     var activityStream = "";
     var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
-    var localPath = "";
     var appPath = "/streams-web/app";
     //TODO: replace this with SSO
     var subscriberId = subscriberId || $.cookie("subscriberId");
+    var addFilters = [];
+    var removeFilters = [];
 
     // Submits form if Enter key is pressed
     var searchKeyPress = function(e){
@@ -17,6 +18,29 @@ var activityDemo = activityDemo || (func
         }
     };
 
+    var newFilters = function(){
+        var filtersString = $("#addFilters").val();
+        var splitAddFilters = filtersString.split(",");
+        $.each(splitAddFilters, function(key, value){
+            var trimmedFilter = value.trim();
+            if(!$.inArray(trimmedFilter, addFilters)){
+                addFilters.push(trimmedFilter);
+            }
+            if($.inArray(trimmedFilter, removeFilters)){
+                removeFilters.pop(trimmedFilter);
+            }
+        });
+    };
+
+    var dropFilter = function(filter){
+        if(!$.inArray(filter, addFilters)){
+            addFilters.pop(filter);
+        }
+        if($.inArray(filter, removeFilters)){
+            removeFilters.push(filter);
+        }
+    };
+
     // Sets the subscriber's filters based on input from the user.
     var setFilters = function(){
 
@@ -91,7 +115,9 @@ var activityDemo = activityDemo || (func
     return {
         searchKeyPress: searchKeyPress,
         getActivities: getActivities,
-        setFilters: setFilters
+        setFilters: setFilters,
+        newFilters: newFilters,
+        dropFilter: dropFilter
         }
 
 })();

Modified: incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/login.html
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/login.html?rev=1547623&r1=1547622&r2=1547623&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/login.html (original)
+++ incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/login.html Tue Dec  3 22:41:23 2013
@@ -21,8 +21,8 @@
 <body>
 
 <form class="form-activities">
-    <input id="username" type="text" class="form-control" placeholder="Enter username here" autofocus><br>
-    <button id="submitButton" type="button" class="btn btn-lg btn-primary btn-block" onclick="Login.loginPressed()">Login</button><br><br>
+    <input id="username" type="text" class="form-control" onkeypress="Login.searchKeyPress(event)" placeholder="Enter username here" autofocus><br>
+    <button id="submitButton" type="button" class="btn btn-lg btn-primary btn-block" onclick="Login.loginPressed()" >Login</button><br><br>
 </form>
 
 <!-- Bootstrap core JavaScript