Browse Source

Added different time period override to singlestat panel, added option to hide panel time override info, Closes #171

Torkel Ödegaard 11 years ago
parent
commit
bee501da4a

+ 4 - 0
src/app/features/panel/panelHelper.js

@@ -54,6 +54,10 @@ function (angular, _, kbn, $) {
 
 
         scope.rangeUnparsed = scope.range;
         scope.rangeUnparsed = scope.range;
       }
       }
+
+      if (scope.panel.hideTimeOverride) {
+        scope.panelMeta.timeInfo = '';
+      }
     };
     };
 
 
     this.issueMetricQuery = function(scope, datasource) {
     this.issueMetricQuery = function(scope, datasource) {

+ 1 - 0
src/app/features/panel/panelMenu.js

@@ -13,6 +13,7 @@ function (angular, $, _) {
           '<span class="panel-title drag-handle pointer">' +
           '<span class="panel-title drag-handle pointer">' +
             '<span class="panel-title-text drag-handle">{{panel.title | interpolateTemplateVars}}</span>' +
             '<span class="panel-title-text drag-handle">{{panel.title | interpolateTemplateVars}}</span>' +
             '<span class="panel-links-icon"></span>' +
             '<span class="panel-links-icon"></span>' +
+            '<span class="panel-time-info" ng-show="panelMeta.timeInfo"><i class="fa fa-clock-o"></i> {{panelMeta.timeInfo}}</span>' +
           '</span>';
           '</span>';
 
 
       function createMenuTemplate($scope) {
       function createMenuTemplate($scope) {

+ 1 - 1
src/app/features/panel/panelSrv.js

@@ -89,7 +89,7 @@ function (angular, _, config) {
       };
       };
 
 
       $scope.getCurrentDatasource = function() {
       $scope.getCurrentDatasource = function() {
-       if ($scope.datasource) {
+        if ($scope.datasource) {
           return $q.when($scope.datasource);
           return $q.when($scope.datasource);
         }
         }
 
 

+ 18 - 2
src/app/features/panel/partials/panelTime.html

@@ -5,7 +5,7 @@
 				<li class="tight-form-item tight-form-item-icon">
 				<li class="tight-form-item tight-form-item-icon">
 					<i class="fa fa-clock-o"></i>
 					<i class="fa fa-clock-o"></i>
 				</li>
 				</li>
-				<li class="tight-form-item" style="width: 148px">
+				<li class="tight-form-item" style="width: 178px">
 					<strong>Override relative time</strong>
 					<strong>Override relative time</strong>
 				</li>
 				</li>
 				<li class="tight-form-item" style="width: 50px">
 				<li class="tight-form-item" style="width: 50px">
@@ -24,7 +24,7 @@
 				<li class="tight-form-item tight-form-item-icon">
 				<li class="tight-form-item tight-form-item-icon">
 					<i class="fa fa-clock-o"></i>
 					<i class="fa fa-clock-o"></i>
 				</li>
 				</li>
-				<li class="tight-form-item" style="width: 148px">
+				<li class="tight-form-item" style="width: 178px">
 					<strong>Add time shift</strong>
 					<strong>Add time shift</strong>
 				</li>
 				</li>
 				<li class="tight-form-item" style="width: 50px">
 				<li class="tight-form-item" style="width: 50px">
@@ -38,6 +38,22 @@
 			</ul>
 			</ul>
 			<div class="clearfix"></div>
 			<div class="clearfix"></div>
 		</div>
 		</div>
+		<div class="tight-form">
+			<ul class="tight-form-list">
+				<li class="tight-form-item tight-form-item-icon">
+					<i class="fa fa-clock-o"></i>
+				</li>
+				<li class="tight-form-item" style="width: 178px">
+					<strong>Hide time override info</strong>
+				</li>
+				<li class="tight-form-item last">
+					<input class="cr1" id="panel.hideTimeOverride" type="checkbox"
+					ng-model="panel.hideTimeOverride" ng-checked="panel.hideTimeOverride" ng-change="get_data()">
+					<label for="panel.hideTimeOverride" class="cr1"></label>
+				</li>
+			</ul>
+			<div class="clearfix"></div>
+		</div>
 	</div>
 	</div>
 </div>
 </div>
 
 

+ 3 - 3
src/app/panels/graph/module.html

@@ -3,9 +3,9 @@
 	<div class="graph-wrapper" ng-class="{'graph-legend-rightside': panel.legend.rightSide}">
 	<div class="graph-wrapper" ng-class="{'graph-legend-rightside': panel.legend.rightSide}">
 		<div class="graph-canvas-wrapper">
 		<div class="graph-canvas-wrapper">
 
 
-			<span class="graph-time-info" ng-if="panelMeta.timeInfo">
-				<i class="fa fa-clock-o"></i> {{panelMeta.timeInfo}}
-		  </span>
+			<!-- <span class="graph&#45;time&#45;info" ng&#45;if="panelMeta.timeInfo"> -->
+			<!-- 	<i class="fa fa&#45;clock&#45;o"></i> {{panelMeta.timeInfo}} -->
+		  <!-- </span> -->
 
 
 			<div ng-if="datapointsWarning" class="datapoints-warning">
 			<div ng-if="datapointsWarning" class="datapoints-warning">
 				<span class="small" ng-show="!datapointsCount">
 				<span class="small" ng-show="!datapointsCount">

+ 0 - 10
src/css/less/graph.less

@@ -141,7 +141,6 @@
     vertical-align: top;
     vertical-align: top;
     position: relative;
     position: relative;
     left: 4px;
     left: 4px;
-    top: -25px;
   }
   }
 
 
   .graph-legend {
   .graph-legend {
@@ -268,13 +267,4 @@
   font-size: 12px;
   font-size: 12px;
 }
 }
 
 
-.graph-time-info {
-  font-weight: bold;
-  float: right;
-  margin-right: 15px;
-  color: @blue;
-  font-size: 85%;
-  position: relative;
-  top: -20px;
-}
 
 

+ 10 - 0
src/css/less/panel.less

@@ -169,4 +169,14 @@
   }
   }
 }
 }
 
 
+.panel-time-info {
+  font-weight: bold;
+  float: right;
+  margin-right: 15px;
+  color: @blue;
+  font-size: 85%;
+  position: absolute;
+  top: 0;
+  right: 0;
+}