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/03/24 04:24:42 UTC

incubator-eagle git commit: EAGLE-207 Management page add tips Admin management page add navigation route for admin to go back home page & Add unsaved tips if change the config

Repository: incubator-eagle
Updated Branches:
  refs/heads/master f9b131671 -> 60f4fcf5c


EAGLE-207 Management page add tips
Admin management page add navigation route for admin to go back home page & Add unsaved tips if change the config

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

Author: @zombiej
Reviewer: @RalphSu

Closes #131


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

Branch: refs/heads/master
Commit: 60f4fcf5caf1c7027ec9ad43fb0538b7af16f5fd
Parents: f9b1316
Author: jiljiang <ji...@ebay.com>
Authored: Thu Mar 24 11:24:32 2016 +0800
Committer: jiljiang <ji...@ebay.com>
Committed: Thu Mar 24 11:24:32 2016 +0800

----------------------------------------------------------------------
 .../webapp/app/partials/config/application.html |  3 ++
 .../webapp/app/partials/config/feature.html     |  3 ++
 .../main/webapp/app/partials/config/site.html   |  3 ++
 .../src/main/webapp/app/public/css/main.css     |  4 ++
 .../public/js/ctrl/configurationController.js   | 45 +++++++++++++++++++-
 5 files changed, 57 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60f4fcf5/eagle-webservice/src/main/webapp/app/partials/config/application.html
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/partials/config/application.html b/eagle-webservice/src/main/webapp/app/partials/config/application.html
index eeb804e..0bf194c 100644
--- a/eagle-webservice/src/main/webapp/app/partials/config/application.html
+++ b/eagle-webservice/src/main/webapp/app/partials/config/application.html
@@ -21,6 +21,9 @@
 		<h3 class="box-title">
 			<span class="fa fa-cogs"></span>
 			Configuration
+			<small class="text-danger" ng-show="changed">
+				<span class="label label-warning label-sm">Unsaved</span>
+			</small>
 		</h3>
 	</div><!-- /.box-header -->
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60f4fcf5/eagle-webservice/src/main/webapp/app/partials/config/feature.html
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/partials/config/feature.html b/eagle-webservice/src/main/webapp/app/partials/config/feature.html
index 019286f..945d90b 100644
--- a/eagle-webservice/src/main/webapp/app/partials/config/feature.html
+++ b/eagle-webservice/src/main/webapp/app/partials/config/feature.html
@@ -21,6 +21,9 @@
 		<h3 class="box-title">
 			<span class="fa fa-cogs"></span>
 			Configuration
+			<small class="text-danger" ng-show="changed">
+				<span class="label label-warning label-sm">Unsaved</span>
+			</small>
 		</h3>
 	</div><!-- /.box-header -->
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60f4fcf5/eagle-webservice/src/main/webapp/app/partials/config/site.html
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/partials/config/site.html b/eagle-webservice/src/main/webapp/app/partials/config/site.html
index 85a75a3..f7d43eb 100644
--- a/eagle-webservice/src/main/webapp/app/partials/config/site.html
+++ b/eagle-webservice/src/main/webapp/app/partials/config/site.html
@@ -21,6 +21,9 @@
 		<h3 class="box-title">
 			<span class="fa fa-cogs"></span>
 			Configuration
+			<small class="text-danger" ng-show="changed">
+				<span class="label label-warning label-sm">Unsaved</span>
+			</small>
 		</h3>
 	</div><!-- /.box-header -->
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60f4fcf5/eagle-webservice/src/main/webapp/app/public/css/main.css
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/css/main.css b/eagle-webservice/src/main/webapp/app/public/css/main.css
index b61ca8f..a68b1fa 100644
--- a/eagle-webservice/src/main/webapp/app/public/css/main.css
+++ b/eagle-webservice/src/main/webapp/app/public/css/main.css
@@ -450,6 +450,10 @@ ul.tree.tree-bordered > li > ul > li > a {
 	color: #FFFFFF;
 }
 
+.label.label-sm {
+	padding: .0em .4em .1em;
+}
+
 /* Row */
 .row.narrow {
 	margin-left: -5px;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/60f4fcf5/eagle-webservice/src/main/webapp/app/public/js/ctrl/configurationController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/ctrl/configurationController.js b/eagle-webservice/src/main/webapp/app/public/js/ctrl/configurationController.js
index c17cdf3..4841f11 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/ctrl/configurationController.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/ctrl/configurationController.js
@@ -20,6 +20,21 @@
 	'use strict';
 
 	var eagleControllers = angular.module('eagleControllers');
+
+	// =============================================================
+	// =                         Function                          =
+	// =============================================================
+	function watchEdit($scope, key) {
+		$scope.changed = false;
+		setTimeout(function() {
+			var _func = $scope.$watch(key, function(newValue, oldValue) {
+				if(angular.equals(newValue, oldValue)) return;
+				$scope.changed = true;
+				_func();
+			}, true);
+		}, 100);
+	}
+
 	// =============================================================
 	// =                       Configuration                       =
 	// =============================================================
@@ -29,6 +44,10 @@
 		PageConfig.hideSite = true;
 		$scope._pageLock = false;
 
+		PageConfig
+			.addNavPath("Home", "/")
+			.addNavPath("Feature Config");
+
 		// ================== Feature ==================
 		// Current feature
 		$scope.feature = Application.featureList[0];
@@ -86,6 +105,9 @@
 				$scope._pageLock = false;
 			});
 		};
+
+		// Watch config update
+		watchEdit($scope, "features");
 	});
 
 	// ======================== Application ========================
@@ -94,6 +116,10 @@
 		PageConfig.hideSite = true;
 		$scope._pageLock = false;
 
+		PageConfig
+			.addNavPath("Home", "/")
+			.addNavPath("Application Config");
+
 		// ================ Application ================
 		// Current application
 		$scope.application = Application.list[0];
@@ -166,16 +192,19 @@
 			application.features.push(feature);
 			common.array.remove(feature, application.optionalFeatures);
 			highlightFeature(feature);
+			$scope.changed = true;
 		};
 
 		$scope.removeFeature = function(feature, application) {
 			application.optionalFeatures.push(feature);
 			common.array.remove(feature, application.features);
+			$scope.changed = true;
 		};
 
 		$scope.moveFeature = function(feature, list, offset) {
 			common.array.moveOffset(feature, list, offset);
 			highlightFeature(feature);
+			$scope.changed = true;
 		};
 
 		// Save feature
@@ -191,6 +220,9 @@
 				$scope._pageLock = false;
 			});
 		};
+
+		// Watch config update
+		watchEdit($scope, "applications");
 	});
 
 	// ============================ Site ===========================
@@ -199,6 +231,10 @@
 		PageConfig.hideSite = true;
 		$scope._pageLock = false;
 
+		PageConfig
+			.addNavPath("Home", "/")
+			.addNavPath("Site Config");
+
 		// =================== Site ====================
 		// Current site
 		$scope.site = Site.list[0];
@@ -292,16 +328,19 @@
 			common.array.remove(application, site.optionalApplications);
 			application.enabled = true;
 			highlightApplication(application);
+			$scope.changed = true;
 		};
 
 		$scope.removeApplication = function(application, site) {
 			site.optionalApplications.push(application);
 			common.array.remove(application, site.applications);
 			application.enabled = false;
+			$scope.changed = true;
 		};
 
 		$scope.setApplication = function(application) {
-			UI.updateConfirm("Application", {config: application.config}, [
+			var _oriConfig = application.config;
+			UI.updateConfirm("Application", {config: _oriConfig}, [
 				{name: "Configuration", field: "config", type: "blob"}
 			], function(entity) {
 				if(entity.config !== "" && !common.parseJSON(entity.config, false)) {
@@ -310,6 +349,7 @@
 			}).then(null, null, function(holder) {
 				application.config = holder.entity.config;
 				holder.closeFunc();
+				if(_oriConfig !== application.config) $scope.changed = true;
 			});
 		};
 
@@ -328,5 +368,8 @@
 				$scope._pageLock = false;
 			});
 		};
+
+		// Watch config update
+		watchEdit($scope, "sites");
 	});
 })();
\ No newline at end of file