eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject incubator-eagle git commit: EAGLE-112 Should support sum aggregation in front end for slide window function Also In front end, we should able to rename the aggregation value with a meaning name, so the downstream components like alert notification part c
Date Mon, 11 Jan 2016 03:08:54 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master e08750137 -> ce64b4202


EAGLE-112 Should support sum aggregation in front end for slide window function
Also In front end, we should able to rename the aggregation value with a meaning name, so
the downstream components like alert notification part could display more meaning full information

https://issues.apache.org/jira/browse/EAGLE-112

Author: @zombieJ
Reviewer: @sunlibin

Closes #53


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/ce64b420
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/ce64b420
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/ce64b420

Branch: refs/heads/master
Commit: ce64b4202de6f6b093cd96414449a7d1af3f9047
Parents: e087501
Author: jiljiang <jiljiang@ebay.com>
Authored: Mon Jan 11 11:08:49 2016 +0800
Committer: jiljiang <jiljiang@ebay.com>
Committed: Mon Jan 11 11:08:49 2016 +0800

----------------------------------------------------------------------
 .../main/webapp/app/partials/dam/policyEdit.html   |  9 ++++++++-
 .../webapp/app/public/js/ctrl/policyController.js  | 17 ++++++++++-------
 2 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ce64b420/eagle-webservice/src/main/webapp/app/partials/dam/policyEdit.html
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/partials/dam/policyEdit.html b/eagle-webservice/src/main/webapp/app/partials/dam/policyEdit.html
index 11f029e..038a590 100644
--- a/eagle-webservice/src/main/webapp/app/partials/dam/policyEdit.html
+++ b/eagle-webservice/src/main/webapp/app/partials/dam/policyEdit.html
@@ -196,7 +196,7 @@
 								<div class="input-group">
 									<div class="input-group-btn">
 										<select class="form-control" ng-model="policy.__.groupAgg" ng-change="updateGroupAgg()">
-											<option ng-repeat="op in ['max','min','avg','count']">{{op}}</option>
+											<option ng-repeat="op in ['max','min','avg','count', 'sum']">{{op}}</option>
 										</select>
 									</div>
 									<select class="form-control" ng-model="policy.__.groupAggPath" ng-class="{'has-warning'
: !policy.__.groupAggPath}" id="groupAggPath"
@@ -220,6 +220,13 @@
 								</div>
 							</div>
 						</div>
+
+						<div class="col-md-4">
+							<div class="form-group">
+								<label for="window">Alias (Optional)</label>
+								<input type="text" class="form-control" ng-model="policy.__.groupAggAlias" placeholder="Default:
aggValue" />
+							</div>
+						</div>
 					</div>
 
 					<!-- Group -->

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/ce64b420/eagle-webservice/src/main/webapp/app/public/js/ctrl/policyController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/ctrl/policyController.js b/eagle-webservice/src/main/webapp/app/public/js/ctrl/policyController.js
index 6061494..1ca741c 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/ctrl/policyController.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/ctrl/policyController.js
@@ -466,12 +466,12 @@ damControllers.controller('policyDetailCtrl', function(globalContent,
Site, damC
 
 						// >> Parse expression
 						$scope.policy.__.conditions = {};
-						var _condition = _policyUnit.expression.match(/from\s+(\w+)(\[(.*)\])?(#window[^\)]*\))?\s+(select
(\w+\, )?(\w+)\((\w+)\) as aggValue (group by (\w+) )?having aggValue ([<>=]+) ([^\s]+))?/);
+						var _condition = _policyUnit.expression.match(/from\s+(\w+)(\[(.*)\])?(#window[^\)]*\))?\s+(select
(\w+\, )?(\w+)\((\w+)\) as [\w\d_]+ (group by (\w+) )?having ([\w\d_]+) ([<>=]+) ([^\s]+))?/);
 						var _cond_stream = _condition[1];
 						var _cond_query = _condition[3] || "";
 						var _cond_window = _condition[4];
 						var _cond_group = _condition[5];
-						var _cond_groupUnit = _condition.slice(7,13);
+						var _cond_groupUnit = _condition.slice(7,14);
 
 						if(!_condition) {
 							$scope.policy.__.advanced = true;
@@ -552,8 +552,9 @@ damControllers.controller('policyDetailCtrl', function(globalContent,
Site, damC
 										$scope.policy.__.group = _cond_groupUnit[3];
 										$scope.policy.__.groupAgg = _cond_groupUnit[0];
 										$scope.policy.__.groupAggPath = _cond_groupUnit[1];
-										$scope.policy.__.groupCondOp = _cond_groupUnit[4];
-										$scope.policy.__.groupCondVal = _cond_groupUnit[5];
+										$scope.policy.__.groupAggAlias = _cond_groupUnit[4] === "aggValue" ? "" : _cond_groupUnit[4];
+										$scope.policy.__.groupCondOp = _cond_groupUnit[5];
+										$scope.policy.__.groupCondVal = _cond_groupUnit[6];
 									} else {
 										$scope.policy.__.group = "";
 										$scope.policy.__.groupAgg = "count";
@@ -635,7 +636,7 @@ damControllers.controller('policyDetailCtrl', function(globalContent,
Site, damC
 			// Aggregation
 			$scope.groupAggPathList = function() {
 				return $.grep(common.getValueByPath($scope, "_stream.metas", []), function(meta) {
-					return $.inArray(meta.attrType, ['long','integer','number']) !== -1;
+					return $.inArray(meta.attrType, ['long','integer','number', 'double', 'float']) !==
-1;
 				});
 			};
 
@@ -754,19 +755,21 @@ damControllers.controller('policyDetailCtrl', function(globalContent,
Site, damC
 
 					// > Group
 					if($scope.policy.__.group) {
-						_windowStr += common.template(" select ${group}, ${groupAgg}(${groupAggPath}) as aggValue
group by ${group} having aggValue ${groupCondOp} ${groupCondVal}", {
+						_windowStr += common.template(" select ${group}, ${groupAgg}(${groupAggPath}) as ${groupAggAlias}
group by ${group} having ${groupAggAlias} ${groupCondOp} ${groupCondVal}", {
 							group: $scope.policy.__.group,
 							groupAgg: $scope.policy.__.groupAgg,
 							groupAggPath: $scope.policy.__.groupAggPath,
 							groupCondOp: $scope.policy.__.groupCondOp,
 							groupCondVal: $scope.policy.__.groupCondVal,
+							groupAggAlias: $scope.policy.__.groupAggAlias || "aggValue"
 						});
 					} else {
-						_windowStr += common.template(" select ${groupAgg}(${groupAggPath}) as aggValue having
aggValue ${groupCondOp} ${groupCondVal}", {
+						_windowStr += common.template(" select ${groupAgg}(${groupAggPath}) as ${groupAggAlias}
having ${groupAggAlias} ${groupCondOp} ${groupCondVal}", {
 							groupAgg: $scope.policy.__.groupAgg,
 							groupAggPath: $scope.policy.__.groupAggPath,
 							groupCondOp: $scope.policy.__.groupCondOp,
 							groupCondVal: $scope.policy.__.groupCondVal,
+							groupAggAlias: $scope.policy.__.groupAggAlias || "aggValue"
 						});
 					}
 				} else {


Mime
View raw message