eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject eagle git commit: [EAGLE-909] UI Policy definition require siteID
Date Fri, 17 Feb 2017 10:58:14 GMT
Repository: eagle
Updated Branches:
  refs/heads/master 255f00f17 -> 71522d956


[EAGLE-909] UI Policy definition require siteID

add siteId in def page.
check submit if not siteId config

Author: zombieJ <smith3816@gmail.com>

Closes #814 from zombieJ/EAGLE-909.


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

Branch: refs/heads/master
Commit: 71522d95648d93cf8791c4a4112d3756a0b601bc
Parents: 255f00f
Author: zombieJ <smith3816@gmail.com>
Authored: Fri Feb 17 18:57:45 2017 +0800
Committer: Hao Chen <hao@apache.org>
Committed: Fri Feb 17 18:57:45 2017 +0800

----------------------------------------------------------------------
 .../partials/alert/policyEdit/advancedMode.html | 18 +++++---
 .../webapp/app/dev/public/js/ctrls/alertCtrl.js |  2 +-
 .../app/dev/public/js/ctrls/alertEditCtrl.js    | 45 +++++++++++---------
 3 files changed, 38 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/71522d95/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit/advancedMode.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit/advancedMode.html
b/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit/advancedMode.html
index 995a8a5..a2c09f1 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit/advancedMode.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/policyEdit/advancedMode.html
@@ -36,17 +36,21 @@
 				</div>
 			</div>
 			<div class="box-body">
+				<div class="form-group">
+					<label>* Site</label>
+					<select class="form-control" ng-model="policy.siteId">
+						<option ng-repeat="site in Site.list track by $index" value="{{site.siteId}}">
+							{{site.siteName || site.siteId}}
+						</option>
+					</select>
+				</div>
+				<hr />
+
 				<div ng-show="sourceTab === 'all'">
 					<div class="input-with-icon">
-						<input type="text" class="form-control" placeholder="Search..." ng-model="searchSourceKey"
/>
+						<input type="text" class="form-control" placeholder="Filter..." ng-model="searchSourceKey"
/>
 						<span class="fa fa-search"></span>
 					</div>
-					<p>
-						Group Type:
-						<a ng-class="{'text-bold': searchType === 'app'}" ng-click="searchType = 'app'">Application</a>
-						/
-						<a ng-class="{'text-bold': searchType === 'site'}" ng-click="searchType = 'site'">Site</a>
-					</p>
 
 					<p ng-hide="getSearchApplication()" class="text-warning">No stream match</p>
 					<div ng-show="getSearchApplication()">

http://git-wip-us.apache.org/repos/asf/eagle/blob/71522d95/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
index c866efb..d464858 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
@@ -150,7 +150,7 @@
 
 			if ($scope.siteFilter) {
 				$scope.policyList = $.grep(originPolicyList, function (policy) {
-					return policy.definition.siteId === $scope.siteFilter;
+					return policy.siteId === $scope.siteFilter;
 				});
 			} else {
 				$scope.policyList = originPolicyList;

http://git-wip-us.apache.org/repos/asf/eagle/blob/71522d95/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
index f079e76..9b62f6a 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js
@@ -78,11 +78,10 @@
 		}, $scope.policy);
 		console.log("[Policy]", $scope.policy);
 
-		var cacheSearchType;
+		var cacheSiteId;
 		var cacheSearchSourceKey;
 		var searchApplications;
 
-		$scope.searchType = "app";
 		$scope.searchSourceKey = "";
 		$scope.applications = {};
 		$scope.newPolicy = !$scope.policy.name;
@@ -105,25 +104,32 @@
 		// =                        Input Stream                        =
 		// ==============================================================
 		$scope.getSearchApplication = function() {
-			if(cacheSearchSourceKey !== $scope.searchSourceKey.toUpperCase() || cacheSearchType !==
$scope.searchType) {
+			var siteId = $scope.policy.siteId;
+
+			if(cacheSearchSourceKey !== $scope.searchSourceKey.toUpperCase() || cacheSiteId !== siteId)
{
 				var match = false;
-				cacheSearchSourceKey = $scope.searchSourceKey.toUpperCase();
-				cacheSearchType = $scope.searchType;
-
-				searchApplications = {};
-				$.each($scope.applications, function (appName, streams) {
-					$.each(streams, function (i, stream) {
-						var groupName = cacheSearchType === "app" ? stream.dataSource : stream.siteId;
-						if(
-							groupName.toUpperCase().indexOf(cacheSearchSourceKey) >= 0 ||
-							stream.streamId.toUpperCase().indexOf(cacheSearchSourceKey) >= 0
-						) {
-							match = true;
-							var group = searchApplications[groupName] = searchApplications[groupName] || [];
-							group.push(stream);
-						}
+
+				if (siteId) {
+					cacheSearchSourceKey = $scope.searchSourceKey.toUpperCase();
+					cacheSiteId = siteId;
+
+					searchApplications = {};
+					$.each($scope.applications, function (appName, streams) {
+						$.each(streams, function (i, stream) {
+							var groupName = stream.dataSource;
+							if(
+								stream.siteId === siteId && (
+									groupName.toUpperCase().indexOf(cacheSearchSourceKey) >= 0 ||
+									stream.streamId.toUpperCase().indexOf(cacheSearchSourceKey) >= 0
+								)
+							) {
+								match = true;
+								var group = searchApplications[groupName] = searchApplications[groupName] || [];
+								group.push(stream);
+							}
+						});
 					});
-				});
+				}
 
 				if(!match) {
 					searchApplications = null;
@@ -336,6 +342,7 @@
 				$scope.policy.name &&
 				!$scope.checkPolicyName() &&
 				common.number.parse($scope.policy.parallelismHint) > 0 &&
+				$scope.policy.siteId &&
 				$scope.policy.definition.value &&
 				$scope.policy.outputStreams.length &&
 				$scope.policyPublisherList.length


Mime
View raw message