eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hdenduk...@apache.org
Subject [3/4] incubator-eagle git commit: EAGLE-173 auto refresh when sensitivity mark updated Auto sync service to refresh the sensitivity status.
Date Sat, 05 Mar 2016 01:53:23 GMT
EAGLE-173 auto refresh when sensitivity mark updated
Auto sync service to refresh the sensitivity status.

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

Author: @zombiej
Reviewer: @qingwen220

Closes #107


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

Branch: refs/heads/branch-0.3.0
Commit: d9ef76d9756fbf7c8992918b6f99fa2ca4c392fd
Parents: 7bc5d9a
Author: jiljiang <jiljiang@ebay.com>
Authored: Tue Mar 1 18:38:51 2016 +0800
Committer: jiljiang <jiljiang@ebay.com>
Committed: Tue Mar 1 18:38:51 2016 +0800

----------------------------------------------------------------------
 .../public/feature/classification/controller.js | 62 +++++++++++++++-----
 .../app/public/feature/metrics/controller.js    |  4 +-
 .../public/feature/metrics/page/dashboard.html  |  2 +-
 .../src/main/webapp/app/public/js/app.ui.js     |  2 +-
 4 files changed, 51 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9ef76d9/eagle-webservice/src/main/webapp/app/public/feature/classification/controller.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/classification/controller.js
b/eagle-webservice/src/main/webapp/app/public/feature/classification/controller.js
index ffb8c92..78cac60 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/classification/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/classification/controller.js
@@ -145,9 +145,6 @@
 			};
 			$scope._markItem.tags[$scope.viewConfig.keys[0]] = item.resource;
 			$("#sensitivityMDL").modal();
-			setTimeout(function() {
-				$("#sensitiveType").focus();
-			}, 500);
 		};
 		$scope.confirmUpateSensitivity = function() {
 			$scope._oriItem.sensitiveType = $scope._markItem.sensitivityType;
@@ -178,6 +175,7 @@
 	// =                    Sensitivity - Table                    =
 	// =============================================================
 	feature.controller('sensitivityViewTable', function(Site, $scope, Entities) {
+		$scope.databases = null;
 		$scope.table = null;
 
 		// Mark sensitivity
@@ -191,20 +189,39 @@
 					unit[key] = unit[target];
 				});
 			});
+			return list._promise;
 		};
 
-		$scope.databases = Entities.query($scope.viewConfig.api.database, {site: Site.current().tags.site});
-		_fillAttr($scope.databases, "database", $scope.viewConfig.mapping.database);
+		$scope.loadDatabases = function(database) {
+			var _dbs = Entities.query($scope.viewConfig.api.database, {site: Site.current().tags.site});
+			return _fillAttr(_dbs, "database", $scope.viewConfig.mapping.database).then(function()
{
+				if($scope.databases) {
+					$.each($scope.databases, function(i, oriDB) {
+						var db = common.array.find(oriDB.resource, _dbs, "resource");
+						if(db) {
+							db.show = oriDB.show;
+							db.tables = oriDB.tables;
+						}
+					});
+				}
+				$scope.databases = _dbs;
+			});
+		};
+		$scope.loadDatabases();
 
-		$scope.loadTables = function(database) {
-			if(database.tables) return;
-			var _qry = {
+		$scope.loadTables = function(database, force) {
+			var _tables, _qry;
+			if(database.tables && !force) return;
+			_qry = {
 				site: Site.current().tags.site
 			};
 			_qry[$scope.viewConfig.mapping.database] = database[$scope.viewConfig.mapping.database];
-			database.tables = Entities.query($scope.viewConfig.api.table, _qry);
-			_fillAttr(database.tables, "table", $scope.viewConfig.mapping.table);
-			_fillAttr(database.tables, "database", $scope.viewConfig.mapping.database);
+			_tables = Entities.query($scope.viewConfig.api.table, _qry);
+			if(!database.tables) database.tables = _tables;
+			_fillAttr(_tables, "table", $scope.viewConfig.mapping.table);
+			return _fillAttr(_tables, "database", $scope.viewConfig.mapping.database).then(function()
{
+				database.tables = _tables;
+			});
 		};
 
 		$scope.loadColumns = function(database, table) {
@@ -220,6 +237,21 @@
 			_fillAttr(table.columns, "column", $scope.viewConfig.mapping.column);
 		};
 
+		$scope.refreshData = function() {
+			$scope.loadDatabases().then(function() {
+				if(!$scope.table) return;
+
+				var _table = $scope.table;
+				var _db = common.array.find($scope.table.database, $scope.databases, "database");
+				if(_db) {
+					$scope.loadTables(_db, true).then(function() {
+						$scope.table = common.array.find(_table.table, _db.tables, "table");
+						$scope.table.columns = _table.columns;
+					});
+				}
+			});
+		};
+
 		// =================== Sensitivity ===================
 		$scope.markSensitivity = function(item, event) {
 			if(event) event.stopPropagation();
@@ -234,14 +266,12 @@
 			};
 			$scope._markItem.tags[$scope.viewConfig.keys[0]] = item.resource;
 			$("#sensitivityMDL").modal();
-			setTimeout(function() {
-				$("#sensitiveType").focus();
-			}, 500);
 		};
 		$scope.confirmUpateSensitivity = function() {
 			$scope._oriItem.sensitiveType = $scope._markItem.sensitivityType;
 			Entities.updateEntity($scope.viewConfig.service, $scope._markItem, {timestamp: false})._promise.success(function(data)
{
 				Entities.dialog(data);
+				$scope.refreshData();
 			});
 			$("#sensitivityMDL").modal('hide');
 		};
@@ -259,7 +289,9 @@
 					site: Site.current().tags.site
 				};
 				_qry[$scope.viewConfig.keys[0]] = item.resource;
-				Entities.deleteEntities($scope.viewConfig.service, _qry);
+				Entities.deleteEntities($scope.viewConfig.service, _qry)._promise.then(function() {
+					$scope.refreshData();
+				});
 
 				item.sensitiveType = null;
 				$scope.$apply();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9ef76d9/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js b/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
index eb1bfb0..5ec9b95 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
@@ -174,7 +174,7 @@
 		};
 
 		// ======================== Menu ========================
-		function newGroup() {
+		$scope.newGroup = function() {
 			if($scope.lock) return;
 
 			UI.createConfirm("Group", {}, [{field: "name"}], function(entity) {
@@ -217,7 +217,7 @@
 				_menu_newChart,
 				{icon: "trash", title: "Delete Group", danger: true, func: deleteGroup}
 			]},
-			{icon: "plus", title: "New Group", func: newGroup}
+			{icon: "plus", title: "New Group", func: $scope.newGroup}
 		] : [];
 
 		// ===================== Dashboard ======================

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9ef76d9/eagle-webservice/src/main/webapp/app/public/feature/metrics/page/dashboard.html
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/metrics/page/dashboard.html
b/eagle-webservice/src/main/webapp/app/public/feature/metrics/page/dashboard.html
index d7e937f..df85c10 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/metrics/page/dashboard.html
+++ b/eagle-webservice/src/main/webapp/app/public/feature/metrics/page/dashboard.html
@@ -31,7 +31,7 @@
 		</ul>
 	</div>
 
-	<button class="btn btn-primary" ng-if="Auth.isRole('ROLE_ADMIN')" ng-show="dashboard.groups.length"
+	<button class="btn btn-primary" ng-if="Auth.isRole('ROLE_ADMIN')"
 			ng-click="saveDashboard()" ng-disabled="lock">
 		<span class="fa fa-floppy-o"></span> Save
 	</button>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d9ef76d9/eagle-webservice/src/main/webapp/app/public/js/app.ui.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/app.ui.js b/eagle-webservice/src/main/webapp/app/public/js/app.ui.js
index 893ae0f..ca494d3 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/app.ui.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/app.ui.js
@@ -68,7 +68,7 @@
 	var _modal = $.fn.modal;
 	$.fn.modal = function() {
 		setTimeout(function() {
-			$(this).find("input[type='text'], textarea").filter(':visible:first').focus();
+			$(this).find("input[type='text'], textarea").filter(':not([readonly]):enabled:visible:first').focus();
 		}.bind(this), 500);
 		_modal.apply(this, arguments);
 		return this;


Mime
View raw message