eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject [01/44] incubator-eagle git commit: update pom using npm to install web deps
Date Mon, 30 Nov 2015 02:50:35 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master dfcf14098 -> 92a040843


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/config.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/config.js b/eagle-webservice/src/main/webapp/public/js/config.js
deleted file mode 100755
index afb8598..0000000
--- a/eagle-webservice/src/main/webapp/public/js/config.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-"use strict";
-
-var app = {};
-
-app.config = {
-	// ============================================================================
-	// =                                   URLs                                   =
-	// ============================================================================
-	urls: {
-		HOST: '',
-
-		updateEntity: 'rest/entities?serviceName=${serviceName}',
-		queryEntity: 'rest/entities/rowkey?serviceName=${serviceName}&value=${encodedRowkey}',
-		queryEntities: 'rest/list?query=${serviceName}[${condition}]{${values}}&pageSize=100000',
-		deleteEntity: 'rest/entities/delete?serviceName=${serviceName}&byId=true',
-		deleteEntities: 'rest/entities?query=${serviceName}[${condition}]{*}&pageSize=100000',
-
-		queryGroup: 'rest/list?query=${serviceName}[${condition}]<${groupBy}>{${values}}&pageSize=100000',
-		querySeries: 'rest/list?query=${serviceName}[${condition}]<${groupBy}>{${values}}&pageSize=100000&timeSeries=true&intervalmin=${intervalmin}',
-
-		query: 'rest/',
-
-		userProfile: 'rest/authentication',
-		logout: 'logout',
-	},
-
-	// ============================================================================
-	// =                               Data Sources                               =
-	// ============================================================================
-	dataSource: {
-		uiInvisibleList: ["userProfile"],
-	},
-};
-
-// ============================================================================
-// =                                   URLs                                   =
-// ============================================================================
-app.getURL = function(name, kvs) {
-	var _host = localStorage.getItem("HOST") || app.config.urls.HOST;
-	var _path = app.config.urls[name];
-	if(!_path) throw "URL:'" + name + "' not exist!";
-	var _url = (_host ? _host + "/" : '') + _path;
-	if(kvs !== undefined) {
-		_url = common.template(_url, kvs);
-	}
-	return _url;
-};
-
-app._Host = function(host) {
-	if(host) {
-		localStorage.setItem("HOST", host);
-		return app;
-	}
-	return localStorage.getItem("HOST");
-};
-app._Host.clear = function() {
-	localStorage.removeItem("HOST");
-};
-app._Host.sample = "http://localhost:9099/eagle-service";
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/ctrl/alertController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/ctrl/alertController.js b/eagle-webservice/src/main/webapp/public/js/ctrl/alertController.js
deleted file mode 100755
index 075c309..0000000
--- a/eagle-webservice/src/main/webapp/public/js/ctrl/alertController.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-// =============================================================
-// =                        Alert List                         =
-// =============================================================
-damControllers.controller('alertListCtrl', function(globalContent, Site, damContent, $scope, $routeParams, $interval, $timeout, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.pageSubTitle = Site.current().name;
-
-	var MAX_PAGESIZE = 10000;
-
-	// Initial load
-	$scope.dataSource = $routeParams.dataSource;
-
-	$scope.alertList = [];
-	$scope.alertList.ready = false;
-
-	// Load data
-	function _loadAlerts() {
-		if($scope.alertList._promise) {
-			$scope.alertList._promise.abort();
-		}
-
-		var _list = Entities.queryEntities("AlertService", {
-			site: Site.current().name,
-			dataSource: $scope.dataSource,
-			hostname: null,
-			_pageSize: MAX_PAGESIZE,
-			_duration: 1000 * 60 * 60 * 24 * 30,
-			__ETD: 1000 * 60 * 60 * 24
-		});
-		$scope.alertList._promise = _list._promise;
-		_list._promise.then(function() {
-			var index;
-
-			if($scope.alertList[0]) {
-				// List new alerts
-				for(index = 0 ; index < _list.length ; index += 1) {
-					var _alert = _list[index];
-					_alert.__new = true;
-					if(_alert.encodedRowkey === $scope.alertList[0].encodedRowkey) {
-						break;
-					}
-				}
-
-				if(index > 0) {
-					$scope.alertList.unshift.apply($scope.alertList, _list.slice(0, index));
-
-					// Clean up UI highlight
-					$timeout(function() {
-						$.each(_list, function(i, alert) {
-							delete alert.__new;
-						});
-					}, 100);
-				}
-			} else {
-				// List all alerts
-				$scope.alertList.push.apply($scope.alertList, _list);
-			}
-
-			$scope.alertList.ready = true;
-		});
-	}
-
-	_loadAlerts();
-	var _loadInterval = $interval(_loadAlerts, app.time.refreshInterval);
-	$scope.$on('$destroy',function(){
-		$interval.cancel(_loadInterval);
-	});
-});
-
-// =============================================================
-// =                       Alert Detail                        =
-// =============================================================
-damControllers.controller('alertDetailCtrl', function(globalContent, Site, damContent, $scope, $routeParams, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.pageTitle = "Alert Detail";
-	globalContent.navPath = ["Alert List", "Alert Detail"];
-	globalContent.lockSite = true;
-
-	$scope.common = common;
-
-	// Query policy
-	$scope.alertList = Entities.queryEntity("AlertService", $routeParams.encodedRowkey);
-	$scope.alertList._promise.then(function() {
-		if($scope.alertList.length === 0) {
-			$.dialog({
-				title: "OPS!",
-				content: "Alert not found!",
-			}, function() {
-				location.href = "#/dam/alertList";
-			});
-			return;
-		} else {
-			var alert = $scope.alertList[0];
-
-			$scope.alert = alert;
-			Site.current(Site.find($scope.alert.tags.site));
-			console.log($scope.alert);
-		}
-	});
-
-	// UI
-	$scope.getMessageTime = function(alert) {
-		var _time = common.getValueByPath(alert, "alertContext.properties.timestamp");
-		return Number(_time);
-	};
-});

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/ctrl/authController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/ctrl/authController.js b/eagle-webservice/src/main/webapp/public/js/ctrl/authController.js
deleted file mode 100755
index bed94fb..0000000
--- a/eagle-webservice/src/main/webapp/public/js/ctrl/authController.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-// =============================================================
-// =                     User Profile List                     =
-// =============================================================
-damControllers.controller('authLoginCtrl', function(globalContent, Site, Authorization, $scope) {
-	globalContent.hideSidebar = true;
-	globalContent.hideSite = true;
-	globalContent.hideUser = true;
-
-	$scope.username = "";
-	$scope.password = "";
-	$scope.lock = false;
-
-	// UI
-	setTimeout(function() {
-		$("#username").focus();
-	});
-
-	// Login
-	$scope.login = function(event, forceSubmit) {
-		if($scope.lock) return;
-
-		if(event.which === 13 || forceSubmit) {
-			$scope.lock = true;
-
-			Authorization.login($scope.username, $scope.password).then(function(success) {
-				if(success) {
-					Site.refresh();
-					Authorization.refresh();
-					Authorization.path(true);
-				} else {
-					$.dialog({
-						title: "OPS",
-						content: "User name or password not correct."
-					}).on("hidden.bs.modal", function() {
-						$("#username").focus();
-					});
-				}
-			}).finally(function() {
-				$scope.lock = false;
-			});
-		}
-	};
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/ctrl/damController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/ctrl/damController.js b/eagle-webservice/src/main/webapp/public/js/ctrl/damController.js
deleted file mode 100755
index 8ef2c95..0000000
--- a/eagle-webservice/src/main/webapp/public/js/ctrl/damController.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-/* Controllers */
-var damControllers = angular.module('damControllers', ['ui.bootstrap', 'eagle.components']);
-
-damControllers.service('damContent', function(Entities) {
-	var content = {
-		config: {
-			pageList: [
-				{icon: "list", title: "Policies", url: "#/dam/summary"},
-				{icon: "exclamation-triangle", title: "Alerts", url: "#/dam/alertList"},
-				{icon: "user-secret", title: "Classification", url: "#/dam/sensitivitySummary"},
-				{icon: "graduation-cap", title: "User Profiles", url: "#/dam/userProfileList"},
-				{icon: "bullseye", title: "Metadata", url: "#/dam/streamList"},
-				{icon: "server", title: "Setup", url: "#/dam/siteList", roles: ["ROLE_ADMIN"]},
-			],
-			navMapping: {
-				"Policy View": "#/dam/summary",
-				"Polict List": "#/dam/policyList",
-				"Alert List": "#/dam/alertList",
-				"User Profile": "#/dam/userProfileList",
-			},
-		},
-		updatePolicyStatus: function(policy, status) {
-			$.dialog({
-				title: "Confirm",
-				content: "Do you want to " + (status ? "enable" : "disable") + " policy[" + policy.tags.policyId + "]?",
-				confirm: true,
-			}, function(ret) {
-				if(ret) {
-					policy.enabled = status;
-					Entities.updateEntity("AlertDefinitionService", policy);
-				}
-			});
-		},
-		deletePolicy: function(policy, callback) {
-			$.dialog({
-				title: "Confirm",
-				content: "Do you want to delete policy[" + policy.tags.policyId + "]?",
-				confirm: true,
-			}, function(ret) {
-				if(ret) {
-					policy.enabled = status;
-					Entities.deleteEntity("AlertDefinitionService", policy)._promise.finally(function() {
-						if(callback) {
-							callback(policy);
-						}
-					});
-				}
-			});
-		},
-	};
-	return content;
-});
-
-// =============================================================
-// =                          Summary                          =
-// =============================================================
-damControllers.controller('summaryCtrl', function(globalContent, Site, damContent, $scope, $q, Entities, $route) {
-	globalContent.setConfig(damContent.config);
-	globalContent.pageSubTitle = Site.current().name;
-
-	$scope.dataSources = {};
-	$scope.dataReady = false;
-
-	var _policyList = Entities.queryGroup("AlertDefinitionService", {dataSource:null, site: Site.current().name}, "@dataSource", "count");
-
-	_policyList._promise.then(function() {
-		// List programs
-		$.each(_policyList, function(i, unit) {
-			var _dataSrc = Site.current().dataSrcList.find(unit.key[0]);
-			if(_dataSrc) {
-				_dataSrc.count = unit.value[0];
-			} else {
-				var _siteHref = $("<a href='#/dam/siteList'>").text("Setup");
-				var _dlg = $.dialog({
-					title: "Data Source Not Found",
-					content: $("<div>")
-						.append("Data Source [" + unit.key[0] + "] not found. Please check your configuration in ")
-						.append(_siteHref)
-						.append(" page.")
-				});
-				_siteHref.click(function() {
-					_dlg.modal('hide');
-				});
-			}
-		});
-
-		$scope.dataReady = true;
-	});
-});

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/ctrl/policyController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/ctrl/policyController.js b/eagle-webservice/src/main/webapp/public/js/ctrl/policyController.js
deleted file mode 100755
index a9af862..0000000
--- a/eagle-webservice/src/main/webapp/public/js/ctrl/policyController.js
+++ /dev/null
@@ -1,885 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-
-// =============================================================
-// =                        Policy List                        =
-// =============================================================
-damControllers.controller('policyListCtrl', function(globalContent, Site, damContent, $scope, $routeParams, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.pageTitle = "Policy List";
-	globalContent.pageSubTitle = Site.current().name;
-	globalContent.navPath = ["Policy View", "Polict List"];
-
-	// Initial load
-	$scope.policyList = [];
-	if($routeParams.dataSource) {
-		$scope.dataSource = Site.current().dataSrcList.find($routeParams.dataSource);
-	}
-
-	// List policies
-	var _policyList = Entities.queryEntities("AlertDefinitionService", {site: Site.current().name, dataSource: $routeParams.dataSource});
-	_policyList._promise.then(function() {
-		$.each(_policyList, function(i, policy) {
-			if($.inArray(policy.tags.dataSource, app.config.dataSource.uiInvisibleList) === -1) {
-				policy.__mailStr = common.getValueByPath(common.parseJSON(policy.notificationDef, {}), "0.recipients", "");
-				policy.__mailList = policy.__mailStr.trim() === "" ? [] : policy.__mailStr.split(/[\,\;]/);
-				policy.__expression = common.parseJSON(policy.policyDef, {}).expression;
-
-				$scope.policyList.push(policy);
-			}
-		});
-	});
-	$scope.policyList._promise = _policyList._promise;
-
-	// Function
-	$scope.searchFunc = function(item) {
-		var key = $scope.search;
-		if(!key) return true;
-
-		var _key = key.toLowerCase();
-		function _hasKey(item, path) {
-			var _value = common.getValueByPath(item, path, "").toLowerCase();
-			return _value.indexOf(_key) !== -1;
-		}
-		return _hasKey(item, "tags.policyId") || _hasKey(item, "__expression") || _hasKey(item, "desc") || _hasKey(item, "owner") || _hasKey(item, "__mailStr");
-	};
-
-	$scope.updatePolicyStatus = damContent.updatePolicyStatus;
-	$scope.deletePolicy = function(policy) {
-		damContent.deletePolicy(policy, function(policy) {
-			var _index = $scope.policyList.indexOf(policy);
-			$scope.policyList.splice(_index, 1);
-		});
-	};
-});
-
-// =============================================================
-// =                       Policy Detail                       =
-// =============================================================
-damControllers.controller('policyDetailCtrl', function(globalContent, Site, damContent, charts, $scope, $routeParams, Entities) {
-	var MAX_PAGESIZE = 10000;
-
-	globalContent.setConfig(damContent.config);
-	globalContent.pageTitle = "Policy Detail";
-	globalContent.navPath = ["Policy View", "Polict List", "Polict Detail"];
-	globalContent.lockSite = true;
-
-	charts = charts($scope);
-
-	$scope.common = common;
-
-	// Query policy
-	if($routeParams.encodedRowkey) {
-		$scope.policyList = Entities.queryEntity("AlertDefinitionService", $routeParams.encodedRowkey);
-	} else {
-		$scope.policyList = Entities.queryEntities("AlertDefinitionService", {
-			policyId: $routeParams.policy,
-			site: $routeParams.site,
-			alertExecutorId: $routeParams.executor
-		});
-	}
-	$scope.policyList._promise.then(function() {
-		if($scope.policyList.length === 0) {
-			$.dialog({
-				title: "OPS!",
-				content: "Policy not found!",
-			}, function() {
-				location.href = "#/dam/policyList";
-			});
-			return;
-		} else {
-			var policy = $scope.policyList[0];
-
-			policy.__mailStr = common.getValueByPath(common.parseJSON(policy.notificationDef, {}), "0.recipients", "");
-			policy.__mailList = policy.__mailStr.trim() === "" ? [] : policy.__mailStr.split(/[\,\;]/);
-			policy.__expression = common.parseJSON(policy.policyDef, {}).expression;
-
-			$scope.policy = policy;
-			Site.current(Site.find($scope.policy.tags.site));
-			console.log($scope.policy);
-		}
-
-		// Visualization
-		var _cond = {
-			dataSource: policy.tags.dataSource,
-			policyId: policy.tags.policyId,
-			_duration: 1000 * 60 * 60 * 24 * 30,
-		};
-
-		// > eagle.policy.eval.count
-		$scope.policyEvalSeries = Entities.querySeries("GenericMetricService", $.extend({_metricName: "eagle.policy.eval.count"}, _cond), "@cluster", "sum(value)", 60 * 24);
-
-		// > eagle.policy.eval.fail.count
-		$scope.policyEvalFailSeries = Entities.querySeries("GenericMetricService", $.extend({_metricName: "eagle.policy.eval.fail.count"}, _cond), "@cluster", "sum(value)", 60 * 24);
-
-		// > eagle.alert.count
-		$scope.alertSeries = Entities.querySeries("GenericMetricService", $.extend({_metricName: "eagle.alert.count"}, _cond), "@cluster", "sum(value)", 60 * 24);
-
-		// > eagle.alert.fail.count
-		$scope.alertFailSeries = Entities.querySeries("GenericMetricService", $.extend({_metricName: "eagle.alert.fail.count"}, _cond), "@cluster", "sum(value)", 60 * 24);
-
-		// Alert list
-		$scope.alertList = Entities.queryEntities("AlertService", {
-			site: Site.current().name,
-			dataSource: policy.tags.dataSource,
-			policyId: policy.tags.policyId,
-			_pageSize: MAX_PAGESIZE,
-			_duration: 1000 * 60 * 60 * 24 * 30,
-			__ETD: 1000 * 60 * 60 * 24
-		});
-	});
-
-	// Function
-	$scope.updatePolicyStatus = damContent.updatePolicyStatus;
-	$scope.deletePolicy = function(policy) {
-		damContent.deletePolicy(policy, function(policy) {
-			location.href = "#/dam/policyList";
-		});
-	};
-});
-
-// =============================================================
-// =                        Policy Edit                        =
-// =============================================================
-(function() {
-	function policyCtrl(create, globalContent, Site, damContent, $scope, $routeParams, $location, $q, Entities) {
-		globalContent.setConfig(damContent.config);
-		globalContent.pageTitle = "Policy Edit";
-		globalContent.pageSubTitle = Site.current().name;
-		globalContent.navPath = ["Policy View", "Polict List", "Polict Edit"];
-
-		var _winTimeDesc = "Number unit[millisecond, sec, min, hour, day, month, year]. e.g. 23 sec";
-		var _winTimeRegex = /^\d+\s+(millisecond|milliseconds|second|seconds|sec|minute|minutes|min|hour|hours|day|days|week|weeks|month|months|year|years)$/;
-		var _winTimeDefaultValue = '10 min';
-		$scope.config = {
-			window: [
-				// Display name, window type, required columns[Title, Description || "LONG_FIELD", Regex check, default value]
-				{
-					title: "Message Time Slide",
-					description: "Using timestamp filed from input is used as event's timestamp",
-					type: "externalTime",
-					fields:[
-						{title: "Field", defaultValue: "timestamp", hide: true},
-						{title: "Time", description: _winTimeDesc, regex: _winTimeRegex, defaultValue: _winTimeDefaultValue},
-					]
-				},
-				{
-					title: "System Time Slide",
-					description: "Using System time is used as timestamp for event's timestamp",
-					type: "time",
-					fields:[
-						{title: "Time", description: _winTimeDesc, regex: _winTimeRegex, defaultValue: _winTimeDefaultValue},
-					]
-				},
-				{
-					title: "System Time Batch",
-					description: "Same as System Time Window except the policy is evaluated at fixed duration",
-					type: "timeBatch",
-					fields:[
-						{title: "Time", description: _winTimeDesc, regex: _winTimeRegex, defaultValue: _winTimeDefaultValue},
-					]
-				},
-				{
-					title: "Length Slide",
-					description: "The slide window has a fixed length",
-					type: "length",
-					fields:[
-						{title: "Number", description: "Number only. e.g. 1023", regex: /^\d+$/},
-					]
-				},
-				{
-					title: "Length Batch",
-					description: "Same as Length window except the policy is evaluated in batch mode when fixed event count reached",
-					type: "lengthBatch",
-					fields:[
-						{title: "Number", description: "Number only. e.g. 1023", regex: /^\d+$/},
-					]
-				},
-			],
-		};
-
-		$scope.create = create;
-		$scope.encodedRowkey = $routeParams.encodedRowkey;
-
-		$scope.step = 0;
-		$scope.dataSources = {};
-		$scope.policy = {};
-
-		// ==========================================
-		// =            Data Preparation            =
-		// ==========================================
-		// Steam list
-		var _streamList = Entities.queryEntities("AlertStreamService", '@streamName=~".*"');
-		var _executorList = Entities.queryEntities("AlertExecutorService", '@streamName=~".*"');
-		$scope.streamList = _streamList;
-		$scope.executorList = _executorList;
-		$scope.streamReady = false;
-
-		$q.all([_streamList._promise, _executorList._promise]).then(function() {
-			// Map executor with stream
-			$.each(_executorList, function(i, executor) {
-				$.each(_streamList, function(j, stream) {
-					if(stream.tags.dataSource === executor.tags.dataSource && stream.tags.streamName === executor.tags.streamName) {
-						stream.alertExecutor = executor;
-						return false;
-					}
-				});
-			});
-
-			// Fill stream list
-			$.each(_streamList, function(i, unit) {
-				var _srcStreamList = $scope.dataSources[unit.tags.dataSource] = $scope.dataSources[unit.tags.dataSource] || [];
-				_srcStreamList.push(unit);
-			});
-
-			$scope.streamReady = true;
-
-			// ==========================================
-			// =                Function                =
-			// ==========================================
-			function _findStream(dataSource, streamName) {
-				var _streamList = $scope.dataSources[dataSource];
-				if(!_streamList) return null;
-
-				for(var i = 0 ; i < _streamList.length ; i += 1) {
-					if(_streamList[i].tags.streamName === streamName) {
-						return _streamList[i];
-					}
-				}
-				return null;
-			};
-
-			// ==========================================
-			// =              Step control              =
-			// ==========================================
-			$scope.steps = [
-				// >> Select data source
-				{
-					title: "Select Data Source",
-					ready: function() {
-						return $scope.streamReady;
-					},
-					init: function() {
-						if(create) $scope.policy.tags.dataSource = $scope.policy.tags.dataSource || Site.current().dataSrcList[0].tags.dataSource;
-					},
-					nextable: function() {
-						return common.getValueByPath($scope.policy, "tags.dataSource");
-					},
-				},
-
-				// >> Select stream
-				{
-					title: "Select Stream",
-					ready: function() {
-						return $scope.streamReady;
-					},
-					init: function() {
-						$scope.policy.__.streamName = $scope.policy.__.streamName ||
-							common.array.find($scope.policy.tags.dataSource, _streamList, "tags.dataSource").tags.streamName;
-					},
-					nextable: function() {
-						var _streamName = common.getValueByPath($scope.policy, "__.streamName");
-						if(!_streamName) return false;
-
-						// Detect stream in current data source list
-						return !!common.array.find(_streamName, $scope.dataSources[$scope.policy.tags.dataSource], "tags.streamName");
-					},
-				},
-
-				// >> Define Alert Policy
-				{
-					title: "Define Alert Policy",
-					init: function() {
-						// Normal mode will fetch meta list
-						if(!$scope.policy.__.advanced) {
-							var _stream = _findStream($scope.policy.tags.dataSource, $scope.policy.__.streamName);
-							$scope._stream = _stream;
-
-							if(!_stream.metas) {
-								_stream.metas = Entities.queryEntities("AlertStreamSchemaService", {dataSource: $scope.policy.tags.dataSource, streamName: $scope.policy.__.streamName});
-								_stream.metas._promise.then(function() {
-									_stream.metas.sort(function(a, b) {
-										if(a.tags.attrName < b.tags.attrName) {
-											return -1;
-										} else if(a.tags.attrName > b.tags.attrName) {
-											return 1;
-										}
-										return 0;
-									});
-								});
-							}
-						}
-					},
-					ready: function() {
-						if(!$scope.policy.__.advanced) {
-							return $scope._stream.metas._promise.$$state.status === 1;
-						}
-						return true;
-					},
-					nextable: function() {
-						if($scope.policy.__.advanced) {
-							// Check stream source
-							$scope._stream = null;
-							$.each($scope.dataSources[$scope.policy.tags.dataSource], function(i, stream) {
-								if(($scope.policy.__._expression || "").indexOf(stream.tags.streamName) !== -1) {
-									$scope._stream = stream;
-									return false;
-								}
-							});
-							return $scope._stream;
-						} else {
-							// Window
-							if($scope.policy.__.windowConfig) {
-								var _winMatch = true;
-								var _winConds = $scope.getWindow().fields;
-								$.each(_winConds, function(i, cond) {
-									if(!(cond.val || "").match(cond.regex)) {
-										_winMatch = false;
-										return false;
-									}
-								});
-								if(!_winMatch) return false;
-
-								// Aggregation
-								if($scope.policy.__.groupAgg) {
-									if(!$scope.policy.__.groupAggPath ||
-										!$scope.policy.__.groupCondOp ||
-										!$scope.policy.__.groupCondVal) {
-										return false;
-									}
-								}
-							}
-						}
-						return true;
-					},
-				},
-
-				// >> Configuration & Notification
-				{
-					title: "Configuration & Notification",
-					nextable: function() {
-						return !!$scope.policy.tags.policyId;
-					},
-				}
-			];
-
-			// ==========================================
-			// =              Policy Logic              =
-			// ==========================================
-			_streamList._promise.then(function() {
-				// Initial policy entity
-				if(create) {
-					$scope.policy = {
-						__: {
-							toJSON: jQuery.noop,
-							conditions: {},
-							notification: [],
-							dedupe: {
-								alertDedupIntervalMin: 10,
-								emailDedupIntervalMin: 10,
-							},
-							policy: {},
-							window: "externalTime",
-							group: "",
-							groupAgg: "count",
-							groupAggPath: "timestamp",
-							groupCondOp: ">=",
-							groupCondVal: "2",
-						},
-						desc: "",
-						enabled: true,
-						prefix: "alertdef",
-						remediationDef: "",
-						tags: {
-							policyType: "siddhiCEPEngine",
-						}
-					};
-
-					// If configured data source
-					if($routeParams.dataSrc) {
-						$scope.policy.tags.dataSource = $routeParams.dataSrc;
-						if(common.array.find($routeParams.dataSrc, Site.current().dataSrcList, "tags.dataSource")) {
-							setTimeout(function() {
-								$scope.changeStep(0, 2, false);
-								$scope.$apply();
-							}, 1);
-						}
-					}
-				} else {
-					var _policy = Entities.queryEntity("AlertDefinitionService", $scope.encodedRowkey);
-					_policy._promise.then(function() {
-						if(_policy.length) {
-							$scope.policy = _policy[0];
-							$scope.policy.__ = {
-								toJSON: jQuery.noop,
-							};
-
-							Site.current(Site.find($scope.policy.tags.site));
-						} else {
-							$.dialog({
-								title: "OPS",
-								content: "Policy not found!",
-							}, function() {
-								$location.path("/dam/policyList");
-								$scope.$apply();
-							});
-							return;
-						}
-
-						// === Revert inner data ===
-						// >> De-dupe
-						$scope.policy.__.dedupe = common.parseJSON($scope.policy.dedupeDef, {});
-
-						// >> Notification
-						$scope.policy.__.notification = common.parseJSON($scope.policy.notificationDef, []);
-
-						// >> Policy
-						var _policyUnit = $scope.policy.__.policy = common.parseJSON($scope.policy.policyDef);
-
-						// >> 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 _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);
-
-						if(!_condition) {
-							$scope.policy.__.advanced = true;
-						} else {
-							// > StreamName
-							var _streamName = _cond_stream;
-							var _cond = _cond_query;
-
-							$scope.policy.__.streamName = _streamName;
-
-							//  > Conditions
-							// Loop condition groups
-							if(_cond.trim() !== "" && /^\(.*\)$/.test(_cond)) {
-								var _condGrps = _cond.substring(1, _cond.length - 1).split(/\)\s+and\s+\(/);
-								$.each(_condGrps, function(i, line) {
-									// Loop condition cells
-									var _condCells = line.split(/\s+or\s+/);
-									$.each(_condCells, function(i, cell) {
-										var _opMatch = cell.match(/(\S*)\s*(==|!=|>|<|>=|<=|contains)\s*('(?:[^'\\]|\\.)*'|[\w\d]+)/);
-										if(!common.isEmpty(_opMatch)) {
-											var _key = _opMatch[1];
-											var _op = _opMatch[2];
-											var _val = _opMatch[3];
-											var _conds = $scope.policy.__.conditions[_key] = $scope.policy.__.conditions[_key] || [];
-											var _type = "";
-											if(_val.match(/\'.*\'/)) {
-												_val = _val.slice(1, -1);
-												_type = "string";
-											} else if(_val === "true" || _val === "false") {
-												var _regexMatch = _key.match(/^str:regexp\((\w+),'(.*)'\)/);
-												var _containsMatch = _key.match(/^str:contains\((\w+),'(.*)'\)/);
-												var _mathes = _regexMatch || _containsMatch;
-												if(_mathes) {
-													_key = _mathes[1];
-													_val = _mathes[2];
-													_type = "string";
-													_op = _regexMatch ? "regex" : "contains";
-													_conds = $scope.policy.__.conditions[_key] = $scope.policy.__.conditions[_key] || [];
-												} else {
-													_type = "bool";
-												}
-											} else {
-												_type = "number";
-											}
-											_conds.push($scope._CondUnit(_key, _op, _val, _type));
-										}
-									});
-								});
-							} else if(_cond_query !== "") {
-								$scope.policy.__.advanced = true;
-							}
-						}
-
-						if($scope.policy.__.advanced) {
-							$scope.policy.__._expression = _policyUnit.expression;
-						} else {
-							// > window
-							if(!_cond_window) {
-								$scope.policy.__.window = "externalTime";
-								$scope.policy.__.group = "";
-								$scope.policy.__.groupAgg = "count";
-								$scope.policy.__.groupAggPath = "timestamp";
-								$scope.policy.__.groupCondOp = ">=";
-								$scope.policy.__.groupCondVal = "2";
-							} else {
-								try {
-									$scope.policy.__.windowConfig = true;
-
-									var _winCells = _cond_window.match(/\.(\w+)\((.*)\)/);
-									$scope.policy.__.window = _winCells[1];
-									var _winConds = $scope.getWindow().fields;
-									$.each(_winCells[2].split(","), function(i, val) {
-										_winConds[i].val = val;
-									});
-
-									// Group
-									if(_cond_group) {
-										$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];
-									} else {
-										$scope.policy.__.group = "";
-										$scope.policy.__.groupAgg = "count";
-										$scope.policy.__.groupAggPath = "timestamp";
-										$scope.policy.__.groupCondOp = ">=";
-										$scope.policy.__.groupCondVal = "2";
-									}
-								} catch(err) {
-									$scope.policy.__.window = "externalTime";
-								}
-							}
-						}
-
-						$scope.changeStep(0, 3, false);
-					});
-				}
-
-				// Start step
-				$scope.changeStep(0, 1, false);
-
-				console.log($scope.policy, $scope);
-			});
-
-			// ==========================================
-			// =                Function                =
-			// ==========================================
-			// UI: Highlight select step
-			$scope.stepSelect = function(step) {
-				return step === $scope.step ? "active" : "";
-			};
-
-			// UI: Collapse all
-			$scope.collapse = function(cntr) {
-				var _list = $(cntr).find(".collapse").css("height", "auto");
-				if(_list.hasClass("in")) {
-					_list.removeClass("in");
-				} else {
-					_list.addClass("in");
-				}
-			};
-
-			// Step process. Will fetch target step attribute and return boolean
-			function _check(key, step) {
-				var _step = $scope.steps[step - 1];
-				if(!_step) return;
-
-				var _value = _step[key];
-				if(typeof _value === "function") {
-					return _value();
-				} else if(typeof _value === "boolean") {
-					return _value;
-				}
-				return true;
-			}
-			// Check step is ready. Otherwise will display load animation
-			$scope.stepReady = function(step) {
-				return _check("ready", step);
-			};
-			// Check whether process next step. Otherwise will disable next button
-			$scope.checkNextable = function(step) {
-				return !_check("nextable", step);
-			};
-			// Switch step
-			$scope.changeStep = function(step, targetStep, check) {
-				if(check === false || _check("checkStep", step)) {
-					$scope.step =  targetStep;
-
-					_check("init", targetStep);
-				}
-			};
-
-			// Window
-			$scope.getWindow = function() {
-				if(!$scope.policy || !$scope.policy.__) return null;
-				var _window = common.array.find($scope.policy.__.window, $scope.config.window, "type");
-				return _window;
-			};
-
-			// Aggregation
-			$scope.groupAggPathList = function() {
-				return $.grep(common.getValueByPath($scope, "_stream.metas", []), function(meta) {
-					return $.inArray(meta.attrType, ['long','integer','number']) !== -1;
-				});
-			};
-
-			$scope.updateGroupAgg = function() {
-				$scope.policy.__.groupAggPath = $scope.policy.__.groupAggPath || common.getValueByPath($scope.groupAggPathList()[0], "tags.attrName");
-
-				if($scope.policy.__.groupAgg === 'count') {
-					$scope.policy.__.groupAggPath = 'timestamp';
-				}
-			};
-
-			// Resolver
-			$scope.resolverTypeahead = function(value, resolver) {
-				var _resolverList = Entities.query("stream/attributeresolve", {
-					site: Site.current().name,
-					resolver: resolver,
-					query: value
-				});
-				return _resolverList._promise.then(function() {
-					return _resolverList;
-				});
-			};
-
-			// Used for input box when pressing enter
-			$scope.conditionPress = function(event, key, operation, value, type) {
-				if(event.which == 13) {
-					setTimeout(function() {
-						$(event.currentTarget).closest(".input-group").find("button").click();
-					}, 1);
-				}
-			};
-			// Check whether has condition
-			$scope.hasCondition = function(key, type) {
-				var _list = common.getValueByPath($scope.policy.__.conditions, key, []);
-				if(_list.length === 0) return false;
-
-				if(type === "bool") {
-					return !_list[0].ignored();
-				}
-				return true;
-			};
-			// Condition unit definition
-			$scope._CondUnit = function(key, op, value, type) {
-				var _obj = {
-					key: key,
-					op: op,
-					val: value,
-					type: type,
-					ignored: function() {
-						if(this.type === "bool" && this.val === "none") {
-							return true;
-						}
-						return false;
-					},
-					getVal: function() {
-						return this.type === "string" ? "'" + this.val + "'" : this.val;
-					},
-					toString: function() {
-						return this.op + " " + this.getVal();
-					},
-					toCondString: function() {
-						var _op = this.op === "=" ? "==" : this.op;
-						if(_op === "regex") {
-							return "str:regexp(" + this.key + "," + this.getVal() + ")==true";
-						} else if(_op === "contains") {
-							return "str:contains(" + this.key + "," + this.getVal() + ")==true";
-						} else {
-							return this.key + " " + _op + " " + this.getVal();
-						}
-					},
-				};
-				return _obj;
-			};
-			// Add condition for policy
-			$scope.addCondition = function(key, op, value, type) {
-				if(value === "" || value === undefined) return false;
-
-				var _condList = $scope.policy.__.conditions[key] = $scope.policy.__.conditions[key] || [];
-				_condList.push($scope._CondUnit(key, op, value, type));
-				return true;
-			};
-			// Convert condition list to description string
-			$scope.parseConditionDesc = function(key) {
-				return $.map($scope.policy.__.conditions[key] || [], function(cond) {
-					if(!cond.ignored()) return "[" + cond.toString() + "]";
-				}).join(" or ");
-			};
-
-			// To query
-			$scope.toQuery = function() {
-				if(!$scope.policy.__) return "";
-
-				if($scope.policy.__.advanced) return $scope.policy.__._expression;
-
-				// > Query
-				var _query = $.map(common.getValueByPath($scope.policy, "__.conditions", {}), function(list, key) {
-					var _conds = $.map(list, function(cond) {
-						if(!cond.ignored()) return cond.toCondString();
-					});
-					if(_conds.length) {
-						return "(" + _conds.join(" or ") + ")";
-					}
-				}).join(" and ");
-				if(_query) {
-					_query = "[" + _query + "]";
-				}
-
-				// > Window
-				var _window = $scope.getWindow();
-				var _windowStr = "";
-				if($scope.policy.__.windowConfig) {
-					_windowStr = $.map(_window.fields, function(field) {
-						return field.val;
-					}).join(",");
-					_windowStr = "#window." + _window.type + "(" + _windowStr + ")";
-
-					// > Group
-					if($scope.policy.__.group) {
-						_windowStr += common.template(" select ${group}, ${groupAgg}(${groupAggPath}) as aggValue group by ${group} having aggValue ${groupCondOp} ${groupCondVal}", {
-							group: $scope.policy.__.group,
-							groupAgg: $scope.policy.__.groupAgg,
-							groupAggPath: $scope.policy.__.groupAggPath,
-							groupCondOp: $scope.policy.__.groupCondOp,
-							groupCondVal: $scope.policy.__.groupCondVal,
-						});
-					} else {
-						_windowStr += common.template(" select ${groupAgg}(${groupAggPath}) as aggValue having aggValue ${groupCondOp} ${groupCondVal}", {
-							groupAgg: $scope.policy.__.groupAgg,
-							groupAggPath: $scope.policy.__.groupAggPath,
-							groupCondOp: $scope.policy.__.groupCondOp,
-							groupCondVal: $scope.policy.__.groupCondVal,
-						});
-					}
-				} else {
-					_windowStr = " select *";
-				}
-
-				return common.template("from ${stream}${query}${window} insert into outputStream;", {
-					stream: $scope.policy.__.streamName,
-					query: _query,
-					window: _windowStr,
-				});
-			};
-
-			// ==========================================
-			// =             Update Policy              =
-			// ==========================================
-			// dedupeDef notificationDef policyDef
-			$scope.finishPolicy = function() {
-				$scope.lock = true;
-
-				// dedupeDef
-				$scope.policy.dedupeDef = JSON.stringify($scope.policy.__.dedupe);
-
-				// notificationDef
-				$scope.policy.__.notification = $scope.policy.__.notification || [];
-				var _notificationUnit = $scope.policy.__.notification[0];
-				if(_notificationUnit) {
-					_notificationUnit.flavor = "email";
-					_notificationUnit.id = "email_1";
-					_notificationUnit.tplFileName = "";
-				}
-				$scope.policy.notificationDef = JSON.stringify($scope.policy.__.notification);
-
-				// policyDef
-				$scope.policy.__._dedupTags = $scope.policy.__._dedupTags || {};
-				$scope.policy.__.policy = {
-					expression: $scope.toQuery(),
-					type: "siddhiCEPEngine"
-				};
-				$scope.policy.policyDef = JSON.stringify($scope.policy.__.policy);
-
-				// alertExecutorId
-				if($scope._stream.alertExecutor) {
-					$scope.policy.tags.alertExecutorId = $scope._stream.alertExecutor.tags.alertExecutorId;
-				} else {
-					$scope.lock = false;
-					$.dialog({
-						title: "OPS!",
-						content: "Alert Executor not defined! Please check 'AlertExecutorService'!"
-					});
-					return;
-				}
-
-				// site
-				$scope.policy.tags.site = $scope.policy.tags.site || Site.current().name;
-
-				// Update function
-				function _updatePolicy() {
-					Entities.updateEntity("AlertDefinitionService", $scope.policy)._promise.success(function(data) {
-						$scope.create = create = false;
-						$scope.encodedRowkey = data.obj[0];
-
-						$.dialog({
-							title: "Success",
-							content: (create ? "Create" : "Update") + " success!",
-						}, function() {
-							if(data.success) {
-								Site.url(Site.find($scope.policy.tags.site), "/dam/policyList");
-							} else {
-								$.dialog({
-									title: "OPS",
-									content: (create ? "Create" : "Update") + "failed!" + JSON.stringify(data),
-								});
-							}
-						});
-					}).error(function(data) {
-						$.dialog({
-							title: "OPS",
-							content: (create ? "Create" : "Update") + "failed!" + JSON.stringify(data),
-						});
-					}).then(function() {
-						$scope.lock = false;
-					});
-				}
-
-				// Check if already exist
-				if($scope.create) {
-					var _checkList = Entities.queryEntities("AlertDefinitionService", {
-						alertExecutorId: $scope.policy.tags.alertExecutorId,
-						policyId: $scope.policy.tags.policyId,
-						policyType: "siddhiCEPEngine",
-						dataSource: $scope.policy.tags.dataSource,
-					});
-					_checkList._promise.then(function() {
-						if(_checkList.length) {
-							$.dialog({
-								title: "Override Confirm",
-								content: "Already exists PolicyID '" + $scope.policy.tags.policyId + "'. Do you want to override?",
-								confirm: true
-							}, function(ret) {
-								if(ret) {
-									_updatePolicy();
-								} else {
-									$scope.lock = false;
-									$scope.$apply();
-								}
-							});
-						} else {
-							_updatePolicy();
-						}
-					});
-				} else {
-					_updatePolicy();
-				}
-			};
-		});
-	}
-
-	damControllers.controller('policyCreateCtrl', function(globalContent, Site, damContent, $scope, $routeParams, $location, $q, Entities) {
-		policyCtrl(true, globalContent, Site, damContent, $scope, $routeParams, $location, $q, Entities);
-	});
-	damControllers.controller('policyEditCtrl', function(globalContent, Site, damContent, $scope, $routeParams, $location, $q, Entities) {
-		globalContent.lockSite = true;
-		policyCtrl(false, globalContent, Site, damContent, $scope, $routeParams, $location, $q, Entities);
-	});
-})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/ctrl/sensitivityController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/ctrl/sensitivityController.js b/eagle-webservice/src/main/webapp/public/js/ctrl/sensitivityController.js
deleted file mode 100755
index 0dd5ea5..0000000
--- a/eagle-webservice/src/main/webapp/public/js/ctrl/sensitivityController.js
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-// =============================================================
-// =                    Sensitivity Summary                    =
-// =============================================================
-damControllers.controller('sensitivitySummaryCtrl', function(globalContent, Site, damContent, $scope, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.pageTitle = "Data Classification";
-	globalContent.pageSubTitle = Site.current().name;
-
-	$scope._sensitivitySource = null;
-	$scope._sensitivityLock = false;
-	$scope._sensitivityImportType = "By Text";
-	$scope._sensitivityFile = "";
-	$scope._sensitivityData = "";
-	$scope._sensitivityError = "";
-	$scope.sensitivityList = [];
-
-	// TODO: Only support Hive & HDFS
-	if(common.array.find("hdfsAuditLog", Site.current().dataSrcList, "tags.dataSource")) {
-		$scope.sensitivityList.push(
-			{name: "HDFS", service: "FileSensitivityService", keys: ["filedir", "sensitivityType"]}
-		);
-	}
-	if(common.array.find("hiveQueryLog", Site.current().dataSrcList, "tags.dataSource")) {
-		$scope.sensitivityList.push(
-			{name: "Hive", service: "HiveResourceSensitivityService", keys: ["hiveResource", "sensitivityType"]}
-		);
-	}
-
-	function _refreshStatistic(entity) {
-		if(entity) {
-				entity.statisitc = Entities.queryGroup(entity.service, {site: Site.current().name}, "@site", "count");
-		} else {
-			$.each($scope.sensitivityList, function(i, entity) {
-				entity.statisitc = Entities.queryGroup(entity.service, {site: Site.current().name}, "@site", "count");
-			});
-		}
-	}
-	_refreshStatistic();
-
-	// Import sensitivity data
-	$scope.showImportEditor = function(entity) {
-		$scope._sensitivitySource = entity;
-
-		$("#sensitivityMDL").modal('show');
-		setTimeout(function() {
-			$("#sensitivityData").focus();
-		}, 500);
-	};
-
-	$scope.confirmImport = function() {
-		if(!$scope._sensitivitySource) return;
-
-		$scope._sensitivityLock = true;
-
-		// Post data
-		switch($scope._sensitivityImportType) {
-		case "By Text":
-		// > By Text
-			Entities.updateEntity($scope._sensitivitySource.service, 
-				common.parseJSON($scope._sensitivityData, null),
-				 {timestamp: false})._promise.success(function(data) {
-				if(!Entities.dialog(data)) {
-					$("#sensitivityMDL").modal('hide');
-					$scope._sensitivityData = "";
-	
-					_refreshStatistic($scope._sensitivitySource);
-				}
-			}).finally(function() {
-				$scope._sensitivityLock = false;
-			});
-			break;
-
-		case "By File":
-		// > By File
-			var formData = new FormData();
-			formData.append("file", $("#sensitivityFile")[0].files[0]);
-			formData.append("site", Site.current().name);
-
-			$.ajax({
-				url : app.getURL("updateEntity", {serviceName: $scope._sensitivitySource.service}),
-				data : formData,
-				cache : false,
-				contentType : false,
-				processData : false,
-				type : 'POST',
-			}).done(function(data) {
-				if(!Entities.dialog(data)) {
-					$("#sensitivityMDL").modal('hide');
-					$scope._sensitivityFile = "";
-
-					_refreshStatistic($scope._sensitivitySource);
-				}
-			}).always(function() {
-				$scope._sensitivityLock = false;
-				$scope.$apply();
-			});
-		}
-	};
-
-	$scope.importCheck = function() {
-		if($scope._sensitivityLock) return false;
-		$scope._sensitivityError = "";
-
-		switch($scope._sensitivityImportType) {
-		case "By Text":
-			if(!$scope._sensitivityData) return false;
-
-			var _list = common.parseJSON($scope._sensitivityData, null);
-			if(!_list) {
-				$scope._sensitivityError = "Can't parse json";
-			} else if(!$.isArray(_list)) {
-				$scope._sensitivityError = "Must be array";
-			} else if(_list.length === 0) {
-				$scope._sensitivityError = "Please provide at least one sensitivity item";
-			}
-			break;
-		case "By File":
-			if(!$scope._sensitivityFile) return false;
-			break;
-		}
-		return !$scope._sensitivityError;
-	};
-
-	// Manage sensitivity data
-	$scope.showManagementEditor = function(entity) {
-		$scope._sensitivitySource = entity;
-		$("#sensitivityListMDL").modal('show');
-
-		entity.list = Entities.queryEntities(entity.service, {site: Site.current().name});
-	};
-
-	$scope.deleteItem = function(item) {
-		$.dialog({
-			title: "Delete Confirm",
-			content: "Do you want to delete '" + item.tags[$scope._sensitivitySource.keys[0]] + "'?",
-			buttons: [
-				{name: "Delete", class: "btn btn-danger", value: true},
-				{name: "Cancel", class: "btn btn-default", value: false},
-			]
-		}, function(ret) {
-			if(!ret) return;
-
-			common.array.remove(item, $scope._sensitivitySource.list);
-			Entities.deleteEntity($scope._sensitivitySource.service, item)._promise.then(function() {
-				_refreshStatistic($scope._sensitivitySource);
-			});
-
-
-			$scope.$apply();
-		});
-	};
-
-	$scope.deleteAll = function(entity) {
-		$.dialog({
-			title: "Delete Confirm",
-			content: "<span class='text-red fa fa-exclamation-triangle pull-left' style='font-size: 50px;'></span>" +
-					"<p>You are <strong class='text-red'>DELETING</strong> all the sensitivity data from '" + entity.name + "'!</p>" +
-					"<p>Proceed to delete?</p>",
-			buttons: [
-				{name: "Delete", class: "btn btn-danger", value: true},
-				{name: "Cancel", class: "btn btn-default", value: false},
-			]
-		}, function(ret) {
-			if(!ret) return;
-
-			Entities.deleteEntities(entity.service, {
-				site: Site.current().name
-			})._promise.then(function() {
-				_refreshStatistic(entity);
-			});
-
-			entity.list.splice(0);
-			$scope.$apply();
-		});
-	};
-});
-
-// =============================================================
-// =                        Sensitivity                        =
-// =============================================================
-damControllers.controller('sensitivityCtrl', function(globalContent, Site, damContent, $scope, $q, $routeParams, $location, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.pageTitle = "Data Classification";
-	globalContent.pageSubTitle = Site.current().name;
-
-	$scope.sensitivityList = [];
-	$scope.type = $routeParams.type;
-	$scope.ajaxId = Math.random();
-
-	// TODO: Only support Hive & HDFS
-	if(common.array.find("hdfsAuditLog", Site.current().dataSrcList, "tags.dataSource")) {
-		$scope.sensitivityList.push(
-			{name: "HDFS"}
-		);
-	}
-	if(common.array.find("hiveQueryLog", Site.current().dataSrcList, "tags.dataSource")) {
-		$scope.sensitivityList.push(
-			{name: "Hive"}
-		);
-	}
-
-	// Update search
-	$scope.$watch("type", function(value) {
-		$location.search("type", value);
-	});
-});
-
-// =============================================================
-// =                     Sensitivity: HDFS                     =
-// =============================================================
-damControllers.controller('sensitivityHDFSCtrl', function(globalContent, Site, damContent, $scope, $location, $q, Entities) {
-	$scope.path = $location.search().path || "/";
-	$scope.pathUnitList = [];
-
-	$scope.items = [];
-
-	/*$scope.$parent.$on("tab-change", function(event, pane) {
-		$location.search("path", pane.title === "HDFS" ? $scope.path : null);
-	});*/
-
-	// Mark sensitivity
-	$scope._oriItem = {};
-	$scope._markItem = {};
-
-	$scope.markSensitivity = function(item) {
-		$scope._oriItem = item;
-		$scope._markItem = {
-			prefix: "fileSensitivity",
-			tags: {
-				site: Site.current().name,
-				filedir: item.resource
-			},
-			sensitivityType: ""
-		};
-		$("#sensitivityHdfsMDL").modal();
-		setTimeout(function() {
-			$("#hdfsSensitiveType").focus();
-		}, 500);
-	};
-	$scope.confirmUpateSensitivity = function() {
-		$scope._oriItem.sensitiveType = $scope._markItem.sensitivityType;
-		var _promise = Entities.updateEntity("FileSensitivityService", $scope._markItem, {timestamp: false})._promise.success(function(data) {
-			Entities.dialog(data);
-		});
-		$("#sensitivityHdfsMDL").modal('hide');
-	};
-	$scope.unmarkSensitivity = function(item) {
-		$.dialog({
-			title: "Unmark Confirm",
-			content: "Do you want to remove the sensitivity mark on '" + item.resource + "'?",
-			confirm: true
-		}, function(ret) {
-			if(!ret) return;
-
-			Entities.deleteEntities("FileSensitivityService", {
-				site: Site.current().name,
-				filedir: item.resource
-			});
-
-			item.sensitiveType = null;
-			$scope.$apply();
-		});
-	};
-
-	// Path
-	function _refreshPathUnitList(_path) {
-		var _start,_current, _unitList = [];
-		var _path = _path + (_path.match(/\/$/) ? "" : "/");
-		for(_current = _start = 0 ; _current < _path.length ; _current += 1) {
-			if(_path[_current] === "/") {
-				_unitList.push({
-					name: _path.substring(_start, _current + (_current === 0 ? 1 : 0)),
-					path: _path.substring(0, _current === 0 ? 1 : _current),
-				});
-				_start = _current + 1;
-			}
-		}
-		$scope.pathUnitList = _unitList;
-	};
-
-	// Item
-	$scope.updateItems = function(path) {
-		if(path) $scope.path = path;
-
-		$scope.items = Entities.query("hdfsResource", {site: Site.current().name, path: $scope.path});
-		$scope.items._promise.success(function(data) {
-			var $dlg = Entities.dialog(data, function() {
-				if($scope.path !== "/") $scope.updateItems("/");
-			});
-		});
-		_refreshPathUnitList($scope.path);
-
-		//$location.search("path", $scope.path);
-	};
-
-	$scope.getFileName = function(item) {
-		return (item.resource + "").replace(/^.*\//, "");
-	};
-
-	$scope.updateItems($scope.path);
-});
-
-// =============================================================
-// =                     Sensitivity: Hive                     =
-// =============================================================
-damControllers.controller('sensitivityHiveCtrl', function(globalContent, Site, damContent, $scope, $q, Entities) {
-	$scope.table = null;
-
-	$scope.databases = Entities.query("hiveResource/databases", {site: Site.current().name});
-	$scope.loadTables = function(database) {
-		if(database.tables) return;
-		database.tables = Entities.query("hiveResource/tables", {site: Site.current().name, database: database.database});
-	};
-
-	$scope.loadColumns = function(database, table) {
-		$scope.table = table;
-
-		if(table.columns) return;
-		table.columns = Entities.query("hiveResource/columns", {site: Site.current().name, database: database.database, table: table.table});
-	};
-
-	// Mark sensitivity
-	$scope._oriItem = {};
-	$scope._markItem = {};
-
-	$scope.markSensitivity = function(item, event) {
-		if(event) event.stopPropagation();
-
-		$scope._oriItem = item;
-		$scope._markItem = {
-			prefix: "hiveResourceSensitivity",
-			tags: {
-				site: Site.current().name,
-				hiveResource: item.resource
-			},
-			sensitivityType: ""
-		};
-		$("#sensitivityHiveMDL").modal();
-		setTimeout(function() {
-			$("#hiveSensitiveType").focus();
-		}, 500);
-	};
-	$scope.confirmUpateSensitivity = function() {
-		$scope._oriItem.sensitiveType = $scope._markItem.sensitivityType;
-		var _promise = Entities.updateEntity("HiveResourceSensitivityService", $scope._markItem, {timestamp: false})._promise.success(function(data) {
-			Entities.dialog(data);
-		});
-		$("#sensitivityHiveMDL").modal('hide');
-	};
-	$scope.unmarkSensitivity = function(item, event) {
-		if(event) event.stopPropagation();
-
-		$.dialog({
-			title: "Unmark Confirm",
-			content: "Do you want to remove the sensitivity mark on '" + item.resource + "'?",
-			confirm: true
-		}, function(ret) {
-			if(!ret) return;
-
-			Entities.deleteEntities("HiveResourceSensitivityService", {
-				site: Site.current().name,
-				hiveResource: item.resource
-			});
-
-			item.sensitiveType = null;
-			$scope.$apply();
-		});
-	};
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/ctrl/siteController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/ctrl/siteController.js b/eagle-webservice/src/main/webapp/public/js/ctrl/siteController.js
deleted file mode 100755
index a7228bd..0000000
--- a/eagle-webservice/src/main/webapp/public/js/ctrl/siteController.js
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-// =============================================================
-// =                         Site List                         =
-// =============================================================
-damControllers.controller('siteListCtrl', function(globalContent, Site, damContent, $scope, $q, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.hideSite = true;
-
-	$scope._siteEntity;
-	$scope._siteEntityLock;
-
-	$scope._dataSrcEntity;
-	$scope._dataSrcEntityLock;
-
-	$scope.dataSrcList = Entities.queryGroup("AlertStreamService", '@dataSource=~".*"', "@dataSource", "count");
-
-	// Policy statistic
-	$scope.policyStatistic = Entities.queryGroup("AlertDefinitionService", '@dataSource=~".*"', "@site,@dataSource", "count");
-	$scope.getPolicyCount = function(site, dataSource) {
-		for(var i = 0 ; i < $scope.policyStatistic.length ; i += 1) {
-			var _cur = $scope.policyStatistic[i];
-			if(_cur.key[0] === site && _cur.key[1] === dataSource) {
-				return _cur.value[0];
-			}
-		}
-		return 0;
-	};
-
-	// Alert statistic
-	$scope.alertStatistic = Entities.queryGroup("AlertService", {_duration: 1000 * 60 * 60 * 24 * 30}, "@site,@dataSource", "count");
-	$scope.getAlertCount = function(site, dataSource) {
-		for(var i = 0 ; i < $scope.alertStatistic.length ; i += 1) {
-			var _cur = $scope.alertStatistic[i];
-			if(_cur.key[0] === site && _cur.key[1] === dataSource) {
-				return _cur.value[0];
-			}
-		}
-		return 0;
-	};
-
-	// =========================================== Site ===========================================
-	$scope.showSiteEditor = function(site) {
-		$("#siteMDL").modal("show");
-		setTimeout(function() {
-			$("#siteName").focus();
-		}, 500);
-
-		$scope._siteEntity = {
-			dataSrcList: {}
-		};
-		$.each($scope.dataSrcList, function(i, item) {
-			$scope._siteEntity.dataSrcList[item.key[0]] = {
-				name: item.key[0],
-				enabled: false
-			};
-		});
-
-		if(site) {
-			$scope._siteEntity.srcSite = site;
-			$scope._siteEntity.name = site.name;
-
-			$.each(site.dataSrcList, function(i, dataSrc) {
-				$scope._siteEntity.dataSrcList[dataSrc.tags.dataSource].enabled = dataSrc.enabled === undefined ? true : dataSrc.enabled;
-			});
-		}
-	};
-	$scope.checkUpdateSite = function() {
-		if(!$scope._siteEntity || !$scope._siteEntity.dataSrcList) return false;
-
-		var _hasDataSrc = !!common.array.find(true, common.map.toArray($scope._siteEntity.dataSrcList), "enabled");
-		return $scope._siteEntity.name && _hasDataSrc && !$scope._siteEntityLock;
-	};
-	$scope.confirmUpateSite = function() {
-		var promiseList = [];
-		$scope._siteEntityLock = true;
-
-		if($scope._siteEntity.srcSite) {
-			var promiseList = [];
-			$.each($scope._siteEntity.dataSrcList, function(name, dataSrc) {
-				var _entity = {
-					enabled: dataSrc.enabled,
-					tags: {
-						site: $scope._siteEntity.name,
-						dataSource: name,
-					},
-				};
-
-				if(dataSrc.enabled) {
-					promiseList.push(Entities.updateEntity("AlertDataSourceService", _entity)._promise);
-				} else {
-					var _dataSrc = common.array.find(name, $scope._siteEntity.srcSite.dataSrcList, "tags.dataSource");
-					if(_dataSrc) {
-						_dataSrc.enabled = false;
-						promiseList.push(Entities.updateEntity("AlertDataSourceService", _entity)._promise);
-					}
-				}
-			});
-		} else {
-			$.each($scope._siteEntity.dataSrcList, function(name, dataSrc) {
-				if(!dataSrc.enabled) return;
-
-				var _entity = {
-					enabled: true,
-					tags: {
-						site: $scope._siteEntity.name,
-						dataSource: name,
-					},
-				};
-				promiseList.push(Entities.updateEntity("AlertDataSourceService", _entity)._promise);
-			});
-		}
-		
-		$q.all(promiseList).then(function() {
-			$("#siteMDL").modal("hide")
-			.on("hidden.bs.modal", function() {
-				$("#siteMDL").off("hidden.bs.modal");
-				Site.refresh();
-			});
-		}).finally(function() {
-			$scope._siteEntityLock = false;
-		});
-	};
-
-	$scope.deleteSite = function(site) {
-		$.dialog({
-			title: "Delete Confirm",
-			content: "<span class='text-red fa fa-exclamation-triangle pull-left' style='font-size: 50px;'></span>" +
-					"<p>You are <strong class='text-red'>DELETING</strong> the site '<strong>" + site.name + "</strong>'!</p>" +
-					"<p>Proceed to delete?</p>",
-			buttons: [
-				{name: "Delete", class: "btn btn-danger", value: true},
-				{name: "Cancel", class: "btn btn-default", value: false},
-			]
-		}, function(ret) {
-			if(!ret) return;
-
-			Entities.deleteEntities("AlertDataSourceService", {
-				site: site.name
-			})._promise.then(function() {
-				Site.refresh();
-			});
-		});
-	};
-
-	// ======================================= Data Source ========================================
-	$scope.showDataSourceEditor = function(dataSrc) {
-		$("#dataSrcMDL").modal("show");
-		setTimeout(function() {
-			$("#dataSrcConfig").focus();
-		}, 500);
-
-		$scope._dataSrcEntity = dataSrc;
-	};
-
-	$scope.confirmUpateDataSource = function() {
-		$scope._dataSrcEntityLock = true;
-		Entities.updateEntity("AlertDataSourceService", $scope._dataSrcEntity)._promise.then(function() {
-			$("#dataSrcMDL").modal("hide");
-		}).finally(function() {
-			$scope._dataSrcEntityLock = false;
-		});
-	};
-
-	$scope.confirmDeleteDataSource = function() {
-		console.log($scope._dataSrcEntity);
-		$("#dataSrcMDL").modal("hide")
-		.on('hidden.bs.modal', function (e) {
-			$("#dataSrcMDL").off('hidden.bs.modal');
-
-			var _additionalContent = Site.find($scope._dataSrcEntity.tags.site).dataSrcList.length > 1 ? "" : "<p class='text-muted' style='margin-left: 60px;'>(This site has only one source. Delete will remove site either.)</p>";
-
-			$.dialog({
-				title: "Delete Confirm",
-				content: "<span class='text-red fa fa-exclamation-triangle pull-left' style='font-size: 50px;'></span>" +
-						"<p>You are <strong class='text-red'>DELETING</strong> the data source '<strong>" + $scope._dataSrcEntity.tags.dataSource + "</strong>' of '" + $scope._dataSrcEntity.tags.site + "'!</p>" +
-						"<p>Proceed to delete?</p>" + _additionalContent,
-				buttons: [
-					{name: "Delete", class: "btn btn-danger", value: true},
-					{name: "Cancel", class: "btn btn-default", value: false},
-				]
-			}, function(ret) {
-				if(!ret) return;
-
-				Entities.deleteEntity("AlertDataSourceService", $scope._dataSrcEntity)._promise.then(function() {
-					Site.refresh();
-				});
-			});
-		});
-	};
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/ctrl/streamController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/ctrl/streamController.js b/eagle-webservice/src/main/webapp/public/js/ctrl/streamController.js
deleted file mode 100755
index 858a7a4..0000000
--- a/eagle-webservice/src/main/webapp/public/js/ctrl/streamController.js
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-// =============================================================
-// =                        Stream List                        =
-// =============================================================
-damControllers.controller('streamListCtrl', function(globalContent, damContent, $scope, $route, $routeParams, $q, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.hideSite = true;
-
-	$scope.streams = {};
-	$scope._streamEntity;
-	$scope._streamEntityLock = false;
-
-	// =========================================== List ===========================================
-	var _streamList = Entities.queryEntities("AlertStreamService", '@streamName=~".*"');
-	var _streamSchemaList = Entities.queryEntities("AlertStreamSchemaService", '@streamName=~".*"');
-	$scope.streamList = _streamList;
-	$scope.streamSchemaList = _streamSchemaList;
-
-	_streamList._promise.then(function() {
-		$.each(_streamList, function(i, stream) {
-			stream.metaList = [];
-			$scope.streams[stream.tags.dataSource + "_" + stream.tags.streamName] = stream;
-		});
-	});
-
-	$q.all([_streamList._promise, _streamSchemaList._promise]).then(function(res) {
-		$.each(_streamSchemaList, function(i, meta) {
-			var _stream = $scope.streams[meta.tags.dataSource + "_" + meta.tags.streamName];
-			if(_stream) {
-				_stream.metaList.push(meta);
-			} else {
-				console.warn("[Meta] Stream not match:", meta.tags.dataSource + "_" + meta.tags.streamName);
-			}
-		});
-	});
-
-	// =========================================== Edit ===========================================
-	$scope.showStreamEditor = function(stream) {
-		$("#streamMDL").modal("show");
-		setTimeout(function() {
-			$("#dataSource").focus();
-		}, 500);
-
-		$scope._streamEntity = {
-			dataSource: "",
-			streamName: "",
-			description: "",
-			metaList: [],
-		};
-		if(stream) {
-			$scope._streamEntity.srcStream = stream;
-			$scope._streamEntity.dataSource = stream.tags.dataSource;
-			$scope._streamEntity.streamName = stream.tags.streamName;
-			$scope._streamEntity.desc = stream.desc;
-
-			$scope._streamEntity.metaList = $.map(stream.metaList, function(meta) {
-				return {
-					srcMeta: meta,
-					attrName: meta.tags.attrName,
-					attrDisplayName: meta.attrDisplayName,
-					attrType: meta.attrType,
-					attrDescription: meta.attrDescription,
-				};
-			});
-		}
-	};
-
-	$scope.deleteMeta = function(meta) {
-		$.dialog({
-			title: "Delete confirm",
-			content: "<p>You are <strong class='text-red'>DELETING</strong> the meta '<strong>" + meta.attrName + "</strong>'!</p>" +
-					"<p>Proceed to delete?</p>",
-			buttons: [
-				{name: "Delete", class: "btn btn-danger", value: true},
-				{name: "Cancel", class: "btn btn-default", value: false},
-			]
-		}, function(ret) {
-			if(!ret) return;
-
-			common.array.remove(meta, $scope._streamEntity.metaList);
-			$scope.$apply();
-		});
-	};
-
-	$scope.checkUpdateStream = function() {
-		if(!$scope._streamEntity || $scope._streamEntityLock) return false;
-
-		var _pass = true;
-
-		if(!$scope._streamEntity.dataSource) _pass = false;
-		if(!$scope._streamEntity.streamName) _pass = false;
-
-		$.each($scope._streamEntity.metaList, function(i, meta) {
-			if(!meta.attrName || !meta.attrType) {
-				_pass = false;
-				return false;
-			}
-		});
-
-		return _pass;
-	};
-
-	$scope.confirmDeleteStream = function() {
-		$.dialog({
-			title: "Delete Confirm",
-			content: "<span class='text-red fa fa-exclamation-triangle pull-left' style='font-size: 50px;'></span>" +
-					"<p>You are <strong class='text-red'>DELETING</strong> the stream '<strong>" + $scope._streamEntity.streamName + "</strong>'!</p>" +
-					"<p>Proceed to delete?</p>",
-			buttons: [
-				{name: "Delete", class: "btn btn-danger", value: true},
-				{name: "Cancel", class: "btn btn-default", value: false},
-			]
-		}, function(ret) {
-			if(!ret) return;
-
-			var _promiseStream = Entities.deleteEntities("AlertStreamService", {
-				dataSource: $scope._streamEntity.dataSource,
-				streamName: $scope._streamEntity.streamName,
-			})._promise;
-			var _promiseStreamSchema = Entities.deleteEntities("AlertStreamSchemaService", {
-				dataSource: $scope._streamEntity.dataSource,
-				streamName: $scope._streamEntity.streamName,
-			})._promise;
-
-			$q.all(_promiseStream, _promiseStreamSchema).then(function() {
-				$("#streamMDL").modal("hide");
-
-				setTimeout(function() {
-					$route.reload();
-				}, 500);
-			});
-		});
-	};
-
-	$scope.confirmUpateStream = function() {
-		$scope._streamEntityLock = true;
-
-		// Stream entity
-		var _entity = {
-			prefix: "alertStream",
-			tags: {
-				dataSource: $scope._streamEntity.dataSource,
-				streamName: $scope._streamEntity.streamName,
-			},
-			desc: $scope._streamEntity.desc
-		};
-
-		// Merge original stream
-		if($scope._streamEntity.srcStream) {
-			$.extend(_entity, $scope._streamEntity.srcStream);
-		}
-
-		// Meta entities
-		var _metaList = $.map($scope._streamEntity.metaList, function(meta) {
-			return {
-				prefix: "alertStreamSchema",
-				attrType: meta.attrType,
-				attrDisplayName: meta.attrDisplayName,
-				attrDescription: meta.attrDescription,
-				tags: {
-					dataSource: _entity.tags.dataSource,
-					streamName: _entity.tags.streamName,
-					attrName: meta.attrName,
-				},
-			};
-		});
-
-		Entities.updateEntity("AlertStreamService", _entity)._promise.then(function() {
-			Entities.deleteEntities("AlertStreamSchemaService", {
-				dataSource: _entity.tags.dataSource,
-				streamName: _entity.tags.streamName,
-			})._promise.then(function() {
-				Entities.updateEntity("AlertStreamSchemaService", _metaList)._promise.finally(function() {
-					Site.refresh();
-				});
-			}).finally(function() {
-				$("#streamMDL").modal("hide");
-				$scope._streamEntityLock = false;
-
-				setTimeout(function() {
-					$route.reload();
-				}, 500);
-			});
-		}, function() {
-			$scope._streamEntityLock = false;
-		});
-	};
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/src/main/webapp/public/js/ctrl/userProfileController.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/public/js/ctrl/userProfileController.js b/eagle-webservice/src/main/webapp/public/js/ctrl/userProfileController.js
deleted file mode 100755
index 73bec7b..0000000
--- a/eagle-webservice/src/main/webapp/public/js/ctrl/userProfileController.js
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-// =============================================================
-// =                     User Profile List                     =
-// =============================================================
-damControllers.controller('userProfileListCtrl', function(globalContent, Site, damContent, $scope, $interval, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.pageSubTitle = Site.current().name;
-
-	$scope.common = common;
-	$scope.algorithms = [];
-
-	// ======================================== Algorithms ========================================
-	$scope.algorithmEntity = {};
-	Entities.queryEntities("AlertDefinitionService", {site: Site.current().name, dataSource: "userProfile"})._promise.then(function(data) {
-		$scope.algorithmEntity = common.getValueByPath(data, "data.obj[0]");
-		$scope.algorithmEntity.policy = common.parseJSON($scope.algorithmEntity.policyDef);
-	});
-
-	// ======================================= User profile =======================================
-	$scope.profileList = Entities.queryEntities("MLModelService", {site: Site.current().name}, ["user", "algorithm", "content", "version"]);
-	$scope.profileList._promise.then(function() {
-		var _algorithms = {};
-		var _users = {};
-
-		// Map user
-		$.each($scope.profileList, function(i, unit) {
-			_algorithms[unit.tags.algorithm] = unit.tags.algorithm;
-			var _user = _users[unit.tags.user] = _users[unit.tags.user] || {user: unit.tags.user};
-			_user[unit.tags.algorithm] = {
-				version: unit.version
-			};
-
-			// DE
-			if(unit.tags.algorithm === "DE") {
-				var _statistics = common.parseJSON(unit.content);
-				_statistics = common.getValueByPath(_statistics, "statistics", []);
-				_user[unit.tags.algorithm].topCommands = $.map(common.array.top(_statistics, "mean"), function(command) {
-					return command.commandName;
-				});
-			}
-		});
-
-		// Map algorithms
-		$scope.algorithms = $.map(_algorithms, function(algorithm) {
-			return algorithm;
-		}).sort();
-
-		$scope.profileList.splice(0);
-		$scope.profileList.push.apply($scope.profileList, common.map.toArray(_users));
-	});
-
-	// =========================================== Task ===========================================
-	$scope.tasks = [];
-	function _loadTasks() {
-		var _tasks = Entities.queryEntities("ScheduleTaskService", {
-			site: Site.current().name,
-			_pageSize: 100,
-			_duration: 1000 * 60 * 60 * 24 * 14,
-			__ETD: 1000 * 60 * 60 * 24
-		});
-		_tasks._promise.then(function() {
-			$scope.tasks.splice(0);
-			$scope.tasks.push.apply($scope.tasks, _tasks);
-
-			// Duration
-			$.each($scope.tasks, function(i, data) {
-				if(data.timestamp && data.updateTime) {
-					var _ms = (new moment(data.updateTime)).diff(new moment(data.timestamp));
-					var _d = moment.duration(_ms);
-					data._duration = Math.floor(_d.asHours()) + moment.utc(_ms).format(":mm:ss");
-					data.duration = _ms;
-				} else {
-					data._duration = "--";
-				}
-			});
-		});
-	}
-
-	$scope.runningTaskCount = function () {
-		return common.array.count($scope.tasks, "INITIALIZED", "status") + 
-				common.array.count($scope.tasks, "PENDING", "status") +
-				common.array.count($scope.tasks, "EXECUTING", "status");
-	};
-
-	// Create task
-	$scope.updateTask = function() {
-		$.dialog({
-			title: "Confirm",
-			content: "Do you want to update now?",
-			confirm: true
-		}, function(ret) {
-			if(!ret) return;
-
-			var _entity = {
-				status: "INITIALIZED",
-				detail: "Newly created command",
-				tags: {
-					site: Site.current().name,
-					type: "USER_PROFILE_TRAINING"
-				},
-				timestamp: +new Date()
-			};
-			Entities.updateEntity("ScheduleTaskService", _entity, {timestamp: false})._promise.success(function(data) {
-				if(!Entities.dialog(data)) {
-					_loadTasks();
-				}
-			});
-		});
-	};
-
-	// Show detail
-	$scope.showTaskDetail = function(task) {
-		var _content = $("<pre>").text(task.detail);
-
-		var $mdl = $.dialog({
-			title: "Detail",
-			content: _content
-		});
-
-		// TODO: Remove task
-		_content.click(function(e) {
-			if(!e.ctrlKey) return;
-
-			$.dialog({
-				title: "Confirm",
-				content: "Remove this task?",
-				confirm: true
-			}, function(ret) {
-				if(!ret) return;
-
-				$mdl.modal('hide');
-				Entities.deleteEntity("ScheduleTaskService", task)._promise.then(function(data) {
-					_loadTasks();
-				});
-			});
-		});
-	};
-
-	_loadTasks();
-	var _loadInterval = $interval(_loadTasks, app.time.refreshInterval);
-	$scope.$on('$destroy',function(){
-		$interval.cancel(_loadInterval);
-	});
-});
-
-// =============================================================
-// =                    User Profile Detail                    =
-// =============================================================
-damControllers.controller('userProfileDetailCtrl', function(globalContent, Site, damContent, $scope, $routeParams, Entities) {
-	globalContent.setConfig(damContent.config);
-	globalContent.pageTitle = "User Profile";
-	globalContent.pageSubTitle = Site.current().name;
-	globalContent.navPath = ["User Profile", "Detail"];
-
-	$scope.user = $routeParams.user;
-
-	// User profile
-	$scope.profiles = {};
-	$scope.profileList = Entities.queryEntities("MLModelService", {site: Site.current().name, user: $scope.user});
-	$scope.profileList._promise.then(function() {
-		$.each($scope.profileList, function(i, unit) {
-			unit._content = common.parseJSON(unit.content);
-			$scope.profiles[unit.tags.algorithm] = unit;
-		});
-
-		// DE
-		if($scope.profiles.DE) {
-			$scope.profiles.DE._chart = {};
-
-			$scope.profiles.DE.estimates = {};
-			$.each($scope.profiles.DE._content, function(key, value) {
-				if(key !== "statistics") {
-					$scope.profiles.DE.estimates[key] = value;
-				}
-			});
-
-			var _meanList = [];
-			var _stddevList = [];
-			var _categoryList = [];
-
-			$.each($scope.profiles.DE._content.statistics, function(i, unit) {
-				_meanList[i] = unit.mean;
-				_stddevList[i] = unit.stddev;
-
-				_categoryList[i] = unit.commandName;
-			});
-			$scope.profiles.DE._chart.series = [
-				{
-					name: "mean",
-					data: _meanList
-				},
-				{
-					name: "stddev",
-					data: _stddevList
-				},
-				{
-					type: "category",
-					data: _categoryList
-				},
-			];
-
-			// Percentage table list
-			$scope.profiles.DE.meanList = [];
-			var _total = common.array.sum($scope.profiles.DE._content.statistics, "mean");
-			$.each($scope.profiles.DE._content.statistics, function(i, unit) {
-				$scope.profiles.DE.meanList.push({
-					command: unit.commandName,
-					percentage: unit.mean / _total
-				});
-			});
-		}
-
-		// EigenDecomposition
-		if($scope.profiles.EigenDecomposition && $scope.profiles.EigenDecomposition._content.principalComponents) {
-			$scope.profiles.EigenDecomposition._chart = {
-				series: [],
-			};
-
-			$.each($scope.profiles.EigenDecomposition._content.principalComponents, function(z, grp) {
-				var _line = [];
-				$.each(grp, function(x, y) {
-					_line.push([x,y,z]);
-				});
-
-				$scope.profiles.EigenDecomposition._chart.series.push({
-					data: _line
-				});
-			});
-		}
-	});
-
-	// UI
-	$scope.showRawData = function(content) {
-		$.dialog({
-			title: "Raw Data",
-			content: $("<pre>").text(content)
-		});
-	};
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2c3005c9/eagle-webservice/ui-build.sh
----------------------------------------------------------------------
diff --git a/eagle-webservice/ui-build.sh b/eagle-webservice/ui-build.sh
new file mode 100644
index 0000000..6256327
--- /dev/null
+++ b/eagle-webservice/ui-build.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+echo "=============== Web APP Building Start ==============="
+echo "Environment Check..."
+# Pre-build check
+if [ -z "$(command -v git)" ]
+then
+	echo "git not installed!"
+	exit 1
+fi
+if [ -z "$(command -v npm)" ]
+then
+	echo "npm not installed!"
+	exit 1
+fi
+echo "Environment Check...Pass"
+
+# npm install
+cd src/main/webapp
+echo "npm install..."
+npm install
+
+# grunt build
+echo "grunt building..."
+npm run grunt
+
+echo "================ Web APP Building End ================"
\ No newline at end of file


Mime
View raw message