eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qingwz...@apache.org
Subject eagle git commit: [EAGLE-1049] Support metric filter in the metric preview page
Date Tue, 20 Jun 2017 08:38:10 GMT
Repository: eagle
Updated Branches:
  refs/heads/master 737cf467f -> dd61a490e


[EAGLE-1049] Support metric filter in the metric preview page

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

Support metric filter in the metric preview page

Author: zombieJ <smith3816@gmail.com>

Closes #953 from zombieJ/EAGLE-1049.


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

Branch: refs/heads/master
Commit: dd61a490ebbbbc5c30dbb457aee72bf4a5fc225d
Parents: 737cf46
Author: zombieJ <smith3816@gmail.com>
Authored: Tue Jun 20 16:38:01 2017 +0800
Committer: Zhao, Qingwen <qingwzhao@apache.org>
Committed: Tue Jun 20 16:38:01 2017 +0800

----------------------------------------------------------------------
 .../main/webapp/app/dev/partials/metric/preview.html  |  3 +++
 .../main/webapp/app/dev/public/js/ctrls/metricCtrl.js | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/dd61a490/eagle-server/src/main/webapp/app/dev/partials/metric/preview.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/metric/preview.html b/eagle-server/src/main/webapp/app/dev/partials/metric/preview.html
index 0410dba..9957c3b 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/metric/preview.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/metric/preview.html
@@ -21,6 +21,9 @@
 		<div class="box box-primary">
 			<div class="box-header with-border">
 				<h3 class="box-title">Configure</h3>
+				<div class="box-tools pull-right">
+					<input class="form-control input-sm" type="text" placeholder="Metric Filter" ng-model="metricFilter"
ng-change="updateMetricFilter()" />
+				</div>
 			</div>
 			<div class="box-body">
 				<div class="form-group">

http://git-wip-us.apache.org/repos/asf/eagle/blob/dd61a490/eagle-server/src/main/webapp/app/dev/public/js/ctrls/metricCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/metricCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/metricCtrl.js
index 8edd8fd..bb50de9 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/metricCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/metricCtrl.js
@@ -30,6 +30,7 @@
 		$scope.series = [];
 		$scope.loading = false;
 
+		$scope.metricFilter = '';
 		$scope.site = $wrapState.param.site || Site.list[0].siteId;
 		$scope.metricName = $wrapState.param.metric;
 		$scope.groups = $wrapState.param.groups;
@@ -39,18 +40,27 @@
 
 		$scope.commonOption = {};
 
-		$scope.metricList = [$scope.metricName];
+		$scope.originMetricList = $scope.metricList = [$scope.metricName];
 		CompatibleEntity.groups({
 			query: 'MetricSchemaService',
 			groups: 'metricName',
 			fields: 'count',
 			limit: 9999,
 		})._promise.then(function (res) {
-			$scope.metricList = $.map(res.data.obj, function (obj) {
+			$scope.originMetricList = $.map(res.data.obj, function (obj) {
 				return obj.key[0];
 			}).sort();
+			$scope.updateMetricFilter();
 		});
 
+		$scope.updateMetricFilter = function () {
+			var filter = $scope.metricFilter.toUpperCase();
+
+			$scope.metricList = $.grep($scope.originMetricList, function (name) {
+				return name.toUpperCase().indexOf(filter) !== -1;
+			});
+		};
+
 		$scope.loadSeries = function() {
 			$scope.currentMetricName = $scope.metricName;
 


Mime
View raw message