eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject incubator-eagle git commit: EAGLE-195 policy metric display with interval of 5 min or customized interval Provide daily & hourly & Every 5 minutes interval for policy metric display
Date Mon, 14 Mar 2016 02:06:54 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 124de31aa -> 91b195650


EAGLE-195 policy metric display with interval of 5 min or customized interval
Provide daily & hourly & Every 5 minutes interval for policy metric display

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

Author: @zombiej
Reviewer: @haoch

Closes #121


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

Branch: refs/heads/master
Commit: 91b195650a6fc796aba5c91c85408925bdf0a61b
Parents: 124de31
Author: jiljiang <jiljiang@ebay.com>
Authored: Mon Mar 14 10:06:46 2016 +0800
Committer: jiljiang <jiljiang@ebay.com>
Committed: Mon Mar 14 10:06:46 2016 +0800

----------------------------------------------------------------------
 .../src/main/webapp/app/public/css/main.css     |  15 +-
 .../app/public/feature/common/controller.js     |  67 ++++++--
 .../feature/common/page/policyDetail.html       | 164 +++++++++----------
 .../src/main/webapp/app/public/js/app.js        |   1 +
 .../webapp/app/public/js/components/nvd3.js     |  56 ++++++-
 .../webapp/app/public/js/components/tabs.js     |  24 ++-
 6 files changed, 206 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/91b19565/eagle-webservice/src/main/webapp/app/public/css/main.css
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/css/main.css b/eagle-webservice/src/main/webapp/app/public/css/main.css
index 1af0c8b..b61ca8f 100644
--- a/eagle-webservice/src/main/webapp/app/public/css/main.css
+++ b/eagle-webservice/src/main/webapp/app/public/css/main.css
@@ -27,6 +27,10 @@ body.no-sidebar .content-wrapper {
 	transition: none;
 }
 
+body.no-sidebar .main-footer {
+	margin-left: 0;
+}
+
 /* Navigation */
 .navbar-nav > .user-menu > .dropdown-menu > li.user-header .img-circle {
 	display: inline-block;
@@ -539,9 +543,6 @@ body .tab-content>.tab-pane.active {
 	overflow-x: visible;
 	overflow-y: visible;
 }
-body .tab-content>.tab-pane.ng-animate {
-	transition: 0s;
-}
 
 body .modal-body .nav-pills > li > a,
 body .box-body .nav-pills > li > a {
@@ -563,12 +564,20 @@ body .modal-body .nav-stacked > li:last-child {
 }
 
 /* Navigation Tab */
+.nav-tabs-custom {
+	position: relative;
+}
+
 .nav-tabs-custom .box-tools {
 	position: absolute;
 	right: 15px;
 	top: 8px;
 }
 
+.nav-tabs-custom .box-tools .strong {
+	font-weight: bolder;
+}
+
 /* Customize */
 #content {
 	position: relative;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/91b19565/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
index c41e8d4..9cbef65 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
@@ -159,17 +159,29 @@
 			}
 
 			// Visualization
-			var _endTime = app.time.now().hour(23).minute(59).second(59).millisecond(0);
-			var _startTime = _endTime.clone().subtract(1, "month").hour(0).minute(0).second(0).millisecond(0);
-			var _cond = {
-				application: policy.tags.application,
-				policyId: policy.tags.policyId,
-				_startTime: _startTime,
-				_endTime: _endTime
-			};
+			var _intervalType = 0;
+			var _intervalList = [
+				["Daily", 1440, function() {
+					var _endTime = app.time.now().hour(23).minute(59).second(59).millisecond(0);
+					var _startTime = _endTime.clone().subtract(1, "month").hour(0).minute(0).second(0).millisecond(0);
+					return [_startTime, _endTime];
+				}],
+				["Hourly", 60, function() {
+					var _endTime = app.time.now().minute(59).second(59).millisecond(0);
+					var _startTime = _endTime.clone().subtract(48, "hour").minute(0).second(0).millisecond(0);
+					return [_startTime, _endTime];
+				}],
+				["Every 5 minutes", 5, function() {
+					var _endTime = app.time.now().second(59).millisecond(0);
+					var _minute = Math.floor(_endTime.minute() / 5) * 5;
+					var _startTime = _endTime.clone().minute(_minute).subtract(5 * 30, "minute").second(0).millisecond(0);
+					_endTime.minute(_minute + 4);
+					return [_startTime, _endTime];
+				}]
+			];
 
-			function _loadSeries(seriesName, metricName) {
-				var list = Entities.querySeries("GenericMetricService", $.extend({_metricName: metricName},
_cond), "@cluster", "sum(value)", 60 * 24);
+			function _loadSeries(seriesName, metricName, condition) {
+				var list = Entities.querySeries("GenericMetricService", $.extend({_metricName: metricName},
condition), "@cluster", "sum(value)", _intervalList[_intervalType][1]);
 				var seriesList = nvd3.convert.eagle([list]);
 				if(!$scope[seriesName]) $scope[seriesName] = seriesList;
 				list._promise.then(function() {
@@ -178,17 +190,28 @@
 			}
 
 			function refreshSeries() {
+				var _timeRange = _intervalList[_intervalType][2]();
+				var _startTime = _timeRange[0];
+				var _endTime = _timeRange[1];
+				var _cond = {
+					application: policy.tags.application,
+					policyId: policy.tags.policyId,
+					_startTime: _startTime,
+					_endTime: _endTime
+				};
+				console.log("Range:", common.format.date(_startTime, "datetime"), common.format.date(_endTime,
"datetime"));
+
 				// > eagle.policy.eval.count
-				_loadSeries("policyEvalSeries", "eagle.policy.eval.count");
+				_loadSeries("policyEvalSeries", "eagle.policy.eval.count", _cond);
 
 				// > eagle.policy.eval.fail.count
-				_loadSeries("policyEvalFailSeries", "eagle.policy.eval.fail.count");
+				_loadSeries("policyEvalFailSeries", "eagle.policy.eval.fail.count", _cond);
 
 				// > eagle.alert.count
-				_loadSeries("alertSeries", "eagle.alert.count");
+				_loadSeries("alertSeries", "eagle.alert.count", _cond);
 
 				// > eagle.alert.fail.count
-				_loadSeries("alertFailSeries", "eagle.alert.fail.count");
+				_loadSeries("alertFailSeries", "eagle.alert.fail.count", _cond);
 			}
 
 			// Alert list
@@ -203,6 +226,22 @@
 
 			refreshSeries();
 			seriesRefreshInterval = $interval(refreshSeries, 60000);
+
+			// Menu
+			$scope.visualizationMenu = [
+				{icon: "clock-o", title: "Interval", list:
+					$.map(_intervalList, function(item, index) {
+						var _item = {icon: "clock-o", title: item[0], func: function() {
+							_intervalType = index;
+							refreshSeries();
+						}};
+						Object.defineProperty(_item, 'strong', {
+							get: function() {return _intervalType === index;}
+						});
+						return _item;
+					})
+				}
+			];
 		});
 
 		// Function

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/91b19565/eagle-webservice/src/main/webapp/app/public/feature/common/page/policyDetail.html
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/common/page/policyDetail.html
b/eagle-webservice/src/main/webapp/app/public/feature/common/page/policyDetail.html
index 0c2bb72..506aeab 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/common/page/policyDetail.html
+++ b/eagle-webservice/src/main/webapp/app/public/feature/common/page/policyDetail.html
@@ -66,107 +66,91 @@
 	</div>
 </div>
 
-<div class="nav-tabs-custom">
-	<ul class="nav nav-tabs">
-		<li class="active">
-			<a href="[data-id='visualization']" data-toggle="tab">Visualization</a>
-		</li>
-		<li>
-			<a href="[data-id='statistics']" data-toggle="tab">Statistics</a>
-		</li>
-		<li>
-			<a href="[data-id='alerts']" data-toggle="tab">Alerts</a>
-		</li>
-	</ul>
-	<div class="tab-content">
-		<div class="tab-pane active" data-id="visualization">
-			<div class="row">
-				<div class="col-xs-6">
-					<div nvd3="policyEvalSeries" data-title="Policy Eval Count" data-config="chartConfig"
class="nvd3-chart-cntr"></div>
-				</div>
-				<div class="col-xs-6">
-					<div nvd3="policyEvalFailSeries" data-title="Policy Eval Fail Count" data-config="chartConfig"
class="nvd3-chart-cntr"></div>
-				</div>
-				<div class="col-xs-6">
-					<div nvd3="alertSeries" data-title="Alert Count" data-config="chartConfig" class="nvd3-chart-cntr"></div>
-				</div>
-				<div class="col-xs-6">
-					<div nvd3="alertFailSeries" data-title="Alert Fail Count" data-config="chartConfig"
class="nvd3-chart-cntr"></div>
-				</div>
+<div tabs>
+	<pane data-title="Visualization" menu="visualizationMenu">
+		<div class="row">
+			<div class="col-xs-6">
+				<div nvd3="policyEvalSeries" data-title="Policy Eval Count" data-config="chartConfig"
class="nvd3-chart-cntr"></div>
+			</div>
+			<div class="col-xs-6">
+				<div nvd3="policyEvalFailSeries" data-title="Policy Eval Fail Count" data-config="chartConfig"
class="nvd3-chart-cntr"></div>
+			</div>
+			<div class="col-xs-6">
+				<div nvd3="alertSeries" data-title="Alert Count" data-config="chartConfig" class="nvd3-chart-cntr"></div>
+			</div>
+			<div class="col-xs-6">
+				<div nvd3="alertFailSeries" data-title="Alert Fail Count" data-config="chartConfig"
class="nvd3-chart-cntr"></div>
 			</div>
 		</div>
-
-		<div class="tab-pane" data-id="statistics">
-			<div class="row">
-				<div class="col-xs-3">
-					<div class="info-box bg-aqua">
-						<span class="info-box-icon"><i class="fa fa-bookmark-o"></i></span>
-						<div class="info-box-content">
-							<span class="info-box-text">Policy Eval Count</span>
-							<span class="info-box-number">{{common.array.sum(policyEvalSeries, "1")}} <small>(Monthly)</small></span>
-							<span class="info-box-number">{{policyEvalSeries[policyEvalSeries.length - 1][1]}}
<small>(Daily)</small></span>
-						</div>
+	</pane>
+	<pane data-title="Statistics">
+		<div class="row">
+			<div class="col-xs-3">
+				<div class="info-box bg-aqua">
+					<span class="info-box-icon"><i class="fa fa-bookmark-o"></i></span>
+					<div class="info-box-content">
+						<span class="info-box-text">Policy Eval Count</span>
+						<span class="info-box-number">{{common.array.sum(policyEvalSeries, "1")}} <small>(Monthly)</small></span>
+						<span class="info-box-number">{{policyEvalSeries[policyEvalSeries.length - 1][1]}}
<small>(Daily)</small></span>
 					</div>
 				</div>
-				<div class="col-xs-3">
-					<div class="info-box bg-red">
-						<span class="info-box-icon"><i class="fa fa-bookmark-o"></i></span>
-						<div class="info-box-content">
-							<span class="info-box-text">Policy Eval Fail Count</span>
-							<span class="info-box-number">{{common.array.sum(policyEvalFailSeries, "1")}}
<small>(Monthly)</small></span>
-							<span class="info-box-number">{{policyEvalFailSeries[policyEvalFailSeries.length
- 1][1]}} <small>(Daily)</small></span>
-						</div>
+			</div>
+			<div class="col-xs-3">
+				<div class="info-box bg-red">
+					<span class="info-box-icon"><i class="fa fa-bookmark-o"></i></span>
+					<div class="info-box-content">
+						<span class="info-box-text">Policy Eval Fail Count</span>
+						<span class="info-box-number">{{common.array.sum(policyEvalFailSeries, "1")}}
<small>(Monthly)</small></span>
+						<span class="info-box-number">{{policyEvalFailSeries[policyEvalFailSeries.length
- 1][1]}} <small>(Daily)</small></span>
 					</div>
 				</div>
-				<div class="col-xs-3">
-					<div class="info-box bg-aqua">
-						<span class="info-box-icon"><i class="fa fa-bookmark-o"></i></span>
-						<div class="info-box-content">
-							<span class="info-box-text">Alert Count</span>
-							<span class="info-box-number">{{common.array.sum(alertSeries, "1")}} <small>(Monthly)</small></span>
-							<span class="info-box-number">{{alertSeries[alertSeries.length - 1][1]}} <small>(Daily)</small></span>
-						</div>
+			</div>
+			<div class="col-xs-3">
+				<div class="info-box bg-aqua">
+					<span class="info-box-icon"><i class="fa fa-bookmark-o"></i></span>
+					<div class="info-box-content">
+						<span class="info-box-text">Alert Count</span>
+						<span class="info-box-number">{{common.array.sum(alertSeries, "1")}} <small>(Monthly)</small></span>
+						<span class="info-box-number">{{alertSeries[alertSeries.length - 1][1]}} <small>(Daily)</small></span>
 					</div>
 				</div>
-				<div class="col-xs-3">
-					<div class="info-box bg-red">
-						<span class="info-box-icon"><i class="fa fa-bookmark-o"></i></span>
-						<div class="info-box-content">
-							<span class="info-box-text">Alert Fail Count</span>
-							<span class="info-box-number">{{common.array.sum(alertFailSeries, "1")}} <small>(Monthly)</small></span>
-							<span class="info-box-number">{{alertFailSeries[alertFailSeries.length - 1][1]}}
<small>(Daily)</small></span>
-						</div>
+			</div>
+			<div class="col-xs-3">
+				<div class="info-box bg-red">
+					<span class="info-box-icon"><i class="fa fa-bookmark-o"></i></span>
+					<div class="info-box-content">
+						<span class="info-box-text">Alert Fail Count</span>
+						<span class="info-box-number">{{common.array.sum(alertFailSeries, "1")}} <small>(Monthly)</small></span>
+						<span class="info-box-number">{{alertFailSeries[alertFailSeries.length - 1][1]}}
<small>(Daily)</small></span>
 					</div>
 				</div>
 			</div>
 		</div>
-
-		<div class="tab-pane" data-id="alerts">
-			<div sorttable source="alertList" sort="-timestamp">
-				<table class="table table-bordered" ng-non-bindable>
-					<thead>
-						<tr>
-							<th width="170" sortpath="timestamp">Alert Time</th>
-							<th width="170" sortpath="alertContext.properties.timestamp">Message Time</th>
-							<th width="60" sortpath="alertContext.properties.user">User</th>
-							<th width="150" sortpath="alertContext.properties.host">Host</th>
-							<th sortpath="alertContext.properties.emailMessage">Description</th>
-							<th width="50"> </th>
-						</tr>
-					</thead>
-					<tbody>
-						<tr ng-class="{info : item.__new}">
-							<td>{{common.format.date(item.timestamp)}}</td>
-							<td>{{common.format.date(item.alertContext.properties.timestamp)}}</td>
-							<td>{{item.alertContext.properties.user}}</td>
-							<td>{{item.alertContext.properties.host}}</td>
-							<td>{{item.alertContext.properties.alertMessage}}</td>
-							<td><a href="#/common/alertDetail/{{item.encodedRowkey}}">Detail</a></td>
-						</tr>
-					</tbody>
-				</table>
-			</div>
+	</pane>
+	<pane data-title="Alerts">
+		<div sorttable source="alertList" sort="-timestamp">
+			<table class="table table-bordered" ng-non-bindable>
+				<thead>
+				<tr>
+					<th width="170" sortpath="timestamp">Alert Time</th>
+					<th width="170" sortpath="alertContext.properties.timestamp">Message Time</th>
+					<th width="60" sortpath="alertContext.properties.user">User</th>
+					<th width="150" sortpath="alertContext.properties.host">Host</th>
+					<th sortpath="alertContext.properties.emailMessage">Description</th>
+					<th width="50"> </th>
+				</tr>
+				</thead>
+				<tbody>
+				<tr ng-class="{info : item.__new}">
+					<td>{{common.format.date(item.timestamp)}}</td>
+					<td>{{common.format.date(item.alertContext.properties.timestamp)}}</td>
+					<td>{{item.alertContext.properties.user}}</td>
+					<td>{{item.alertContext.properties.host}}</td>
+					<td>{{item.alertContext.properties.alertMessage}}</td>
+					<td><a href="#/common/alertDetail/{{item.encodedRowkey}}">Detail</a></td>
+				</tr>
+				</tbody>
+			</table>
 		</div>
-
-	</div>
+	</pane>
 </div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/91b19565/eagle-webservice/src/main/webapp/app/public/js/app.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/app.js b/eagle-webservice/src/main/webapp/app/public/js/app.js
index 0ef5d93..a31219b 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/app.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/app.js
@@ -370,6 +370,7 @@ var app = {};
 
 		// Animation
 		$animateProvider.classNameFilter(/^((?!(fa-spin)).)*$/);
+		$animateProvider.classNameFilter(/^((?!(tab-pane)).)*$/);
 	});
 
 	eagleApp.filter('parseJSON', function () {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/91b19565/eagle-webservice/src/main/webapp/app/public/js/components/nvd3.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/components/nvd3.js b/eagle-webservice/src/main/webapp/app/public/js/components/nvd3.js
index cc2f335..24c71d1 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/components/nvd3.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/components/nvd3.js
@@ -76,7 +76,7 @@ eagleComponents.service('nvd3', function() {
 	// Resize with refresh
 	function chartResize() {
 		$.each(nvd3.charts, function(i, chart) {
-			if(chart) chart.update();
+			if(chart) chart.nvd3Update();
 		});
 	}
 	$(window).on("resize.components.nvd3", chartResize);
@@ -237,6 +237,24 @@ eagleComponents.directive('nvd3', function(nvd3) {
 						case "time":
 							if(_chartType !== 'column') {
 								_chart[axis + "Scale"](d3.time.scale());
+								(function () {
+									var measureSeries = null;
+									$.each($scope.nvd3 || [], function(i, series) {
+										var _len = (series.values || []).length;
+										if(_len === 0) return;
+										if(measureSeries === null || measureSeries.values.length < _len) measureSeries
= series;
+									});
+
+									var width = $element.width() - 35;// Use default nvd3 margin. Hard code.
+									if(!measureSeries || width <= 0) return;
+									var count = Math.floor(width / 80);
+									var countDes = Math.floor(measureSeries.values.length / count);
+									var tickValues = [];
+									for(var loc = 0 ; loc < measureSeries.values.length ; loc += countDes) {
+										tickValues.push(measureSeries.values[loc].x);
+									}
+									_chart[axis + "Axis"].tickValues(tickValues);
+								})();
 							}
 							_axis.tickFormat(function(d) {
 								return _tickMultiFormat(app.time.offset(d).toDate(true));
@@ -261,12 +279,18 @@ eagleComponents.directive('nvd3', function(nvd3) {
 					nvd3.charts[_preIndex] = _chart;
 				}
 
+				// Use customize update function to update the view
+				_chart.nvd3Update = function() {
+					if(_config.xType === "time") _defineLabelType("x", _config.xType);
+					_chart.update();
+				};
+
 				updateData();
 			}
 
 			// Update chart data
 			function updateData() {
-				var _min, _max;
+				var _min = null, _max = null;
 
 				// Copy series to prevent Angular loop watching
 				var _data = $.map($scope.nvd3 || [], function(series, i) {
@@ -279,8 +303,8 @@ eagleComponents.directive('nvd3', function(nvd3) {
 				if(($scope.chart || _config.chart) !== "pie") {
 					$.each(_data, function(i, series) {
 						$.each(series.values, function(j, unit) {
-							if(_min === undefined || unit.y < _min) _min = unit.y;
-							if(_max === undefined || unit.y > _max) _max = unit.y;
+							if(_min === null || unit.y < _min) _min = unit.y;
+							if(_max === null || unit.y > _max) _max = unit.y;
 						});
 					});
 
@@ -297,6 +321,8 @@ eagleComponents.directive('nvd3', function(nvd3) {
 				d3.select(_chartCntr)						//Select the <svg> element you want to render the chart
in.
 					.datum(_data)							//Populate the <svg> element with chart data...
 					.call(_chart);							//Finally, render the chart!
+
+				setTimeout(_chart.nvd3Update, 10);
 			}
 
 			// ================================================================
@@ -305,10 +331,26 @@ eagleComponents.directive('nvd3', function(nvd3) {
 			// Ignore initial checking
 			$timeout(function() {
 				if ($scope.watching !== "false") {
-					$scope.$watch("nvd3", function(newValue, oldValue) {
-						//noinspection JSValidateTypes
-						if (newValue === oldValue) return;
+					$scope.$watch(function() {
+						if(!$scope.nvd3) return [];
+
+						var _hashList = $.map($scope.nvd3, function(series) {
+							if(!series.values) return 0;
+							var unit = {
+								x: 0,
+								y: 0
+							};
+
+							$.each(series.values, function(j, item) {
+								unit.x += item.x;
+								unit.y += item.y;
+							});
+
+							return unit;
+						});
 
+						return _hashList;
+					}, function() {
 						updateData();
 					}, true);
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/91b19565/eagle-webservice/src/main/webapp/app/public/js/components/tabs.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/components/tabs.js b/eagle-webservice/src/main/webapp/app/public/js/components/tabs.js
index 675c984..2a74a30 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/components/tabs.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/components/tabs.js
@@ -44,6 +44,7 @@ eagleComponents.directive('tabs', function() {
 
 			$scope.paneList = [];
 			$scope.selectedPane = null;
+			$scope.inPane = null;
 			$scope.activePane = null;
 
 			// ================== Function ==================
@@ -58,13 +59,22 @@ eagleComponents.directive('tabs', function() {
 
 				$scope.activePane = $scope.selectedPane || pane;
 				$scope.selectedPane = pane;
+				$scope.inPane = null;
 
 				if(transTimer) $timeout.cancel(transTimer);
 				transTimer = $timeout(function() {
 					$scope.activePane = $scope.selectedPane;
+					$scope.inPane = $scope.selectedPane;
 				}, transDuration);
 			};
 
+			$scope.getMenuList = function() {
+				if($scope.selectedPane && $scope.selectedPane.menuList) {
+					return $scope.selectedPane.menuList;
+				}
+				return $scope.menuList;
+			};
+
 			// =================== Linker ===================
 			function _linkerProperties(pane) {
 				Object.defineProperties(pane, {
@@ -80,7 +90,7 @@ eagleComponents.directive('tabs', function() {
 					},
 					in: {
 						get: function () {
-							return $scope.selectedPane === this;
+							return $scope.inPane === this;
 						}
 					}
 				});
@@ -102,8 +112,7 @@ eagleComponents.directive('tabs', function() {
 				common.array.remove(pane, $scope.paneList);
 
 				if($scope.selectedPane === pane) {
-					$scope.selectedPane = $scope.paneList[0];
-					$scope.activePane = $scope.paneList[0];
+					$scope.selectedPane = $scope.activePane = $scope.inPane = $scope.paneList[0];
 				}
 			};
 
@@ -145,8 +154,8 @@ eagleComponents.directive('tabs', function() {
 		template :
 			'<div class="nav-tabs-custom">' +
 				// Menu
-				'<div class="box-tools pull-right" ng-if="menuList && menuList.length">'
+
-					'<div ng-repeat="menu in menuList track by $index" class="inline">' +
+				'<div class="box-tools pull-right" ng-if="getMenuList() && getMenuList().length">'
+
+					'<div ng-repeat="menu in getMenuList() track by $index" class="inline">' +
 						// Button
 						'<button class="btn btn-box-tool" ng-click="menu.func($event)" ng-if="!menu.list"'
+
 							' uib-tooltip="{{menu.title}}" tooltip-enable="menu.title" tooltip-append-to-body="true">'
+
@@ -161,7 +170,7 @@ eagleComponents.directive('tabs', function() {
 							'</button>' +
 							'<ul class="dropdown-menu left" role="menu">' +
 								'<li ng-repeat="item in menu.list track by $index" ng-class="{danger: item.danger,
disabled: item.disabled}">' +
-									'<a ng-click="!item.disabled && item.func($event)">' +
+									'<a ng-click="!item.disabled && item.func($event)" ng-class="{strong:
item.strong}">' +
 										'<span class="fa fa-{{item.icon}}"></span> {{item.title}}' +
 									'</a>' +
 								'</li>' +
@@ -196,7 +205,8 @@ eagleComponents.directive('tabs', function() {
 		transclude : true,
 		scope : {
 			title : '@',
-			data: '=?data'
+			data: '=?data',
+			menuList: "=?menu"
 		},
 		link : function(scope, element, attrs, tabsController) {
 			tabsController.addPane(scope);


Mime
View raw message