You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ji...@apache.org on 2016/04/12 05:28:49 UTC

incubator-eagle git commit: EAGLE-214 Policy edit page need auto switch application For the policy edit page open in different application will alert this error. Need auto switch application when check the policy is in another application.

Repository: incubator-eagle
Updated Branches:
  refs/heads/master f311630fb -> 8e338fea1


EAGLE-214 Policy edit page need auto switch application
For the policy edit page open in different application will alert this error. Need auto switch application when check the policy is in another application.

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

Author: @zombiej
Reviewer: @qingwen220

Closes #141


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

Branch: refs/heads/master
Commit: 8e338fea1a36a7842e72ab23e80c6a29654cb59d
Parents: f311630
Author: jiljiang <ji...@ebay.com>
Authored: Tue Apr 12 11:28:38 2016 +0800
Committer: jiljiang <ji...@ebay.com>
Committed: Tue Apr 12 11:28:38 2016 +0800

----------------------------------------------------------------------
 .../app/public/feature/common/controller.js     | 27 ++++++++++++++++++++
 .../webapp/app/public/js/srv/applicationSrv.js  |  4 +--
 eagle-webservice/src/main/webapp/package.json   |  2 +-
 3 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8e338fea/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
index b758431..6217538 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
@@ -399,6 +399,14 @@
 							var _stream = _findStream($scope.policy.tags.application, $scope.policy.__.streamName);
 							$scope._stream = _stream;
 
+							if(!_stream) {
+								$.dialog({
+									title: "OPS",
+									content: "Stream not found! Current application don't match any stream."
+								});
+								return;
+							}
+
 							if(!_stream.metas) {
 								_stream.metas = Entities.queryEntities("AlertStreamSchemaService", {application: $scope.policy.tags.application, streamName: $scope.policy.__.streamName});
 								_stream.metas._promise.then(function() {
@@ -535,6 +543,25 @@
 							return;
 						}
 
+						var _application = Application.current();
+						if(_application.tags.application !== $scope.policy.tags.application) {
+							_application = Application.find($scope.policy.tags.application);
+							if(_application) {
+								Application.current(_application, false);
+								console.log("Application not match. Do reload...");
+								$wrapState.reload();
+							} else {
+								$.dialog({
+									title: "OPS",
+									content: "Application not found! Current policy don't match any application."
+								}, function() {
+									$location.path("/common/policyList");
+									$scope.$apply();
+								});
+							}
+							return;
+						}
+
 						// === Revert inner data ===
 						// >> De-dupe
 						$scope.policy.__.dedupe = common.parseJSON($scope.policy.dedupeDef, {});

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8e338fea/eagle-webservice/src/main/webapp/app/public/js/srv/applicationSrv.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/srv/applicationSrv.js b/eagle-webservice/src/main/webapp/app/public/js/srv/applicationSrv.js
index d911194..187adb4 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/srv/applicationSrv.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/srv/applicationSrv.js
@@ -34,7 +34,7 @@
 		Application.featureList.set = {};
 
 		// Set current application
-		Application.current = function(app) {
+		Application.current = function(app, reload) {
 			if(arguments.length && _current !== app) {
 				var _prev = _current;
 				_current = app;
@@ -43,7 +43,7 @@
 					sessionStorage.setItem("application", _current.tags.application);
 				}
 
-				if(_prev) {
+				if(_prev && reload !== false) {
 					console.log("[Application] Switch. Redirect to landing page.");
 					$wrapState.go('landing', true);
 				}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8e338fea/eagle-webservice/src/main/webapp/package.json
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/package.json b/eagle-webservice/src/main/webapp/package.json
index f849091..1db0bbb 100644
--- a/eagle-webservice/src/main/webapp/package.json
+++ b/eagle-webservice/src/main/webapp/package.json
@@ -4,7 +4,7 @@
 	"author": "ApacheEagle",
 	"repository": {
 		"type:": "git",
-		"url": "https://github.com/apache/incubator-kylin.git"
+		"url": "https://github.com/apache/incubator-eagle.git"
 	},
 	"license": "Apache-2.0",
 	"dependencies": {