Forráskód Böngészése

Merge pull request #3304 from utkarshcmu/info

Added metadata info panel
Carl Bergquist 10 éve
szülő
commit
2b58b6b5d7

+ 6 - 1
public/app/features/dashboard/dashboardCtrl.js

@@ -2,8 +2,9 @@ define([
   'angular',
   'jquery',
   'app/core/config',
+  'moment',
 ],
-function (angular, $, config) {
+function (angular, $, config, moment) {
   "use strict";
 
   var module = angular.module('grafana.controllers');
@@ -149,6 +150,10 @@ function (angular, $, config) {
       });
     };
 
+    $scope.formatDate = function(date) {
+      return moment(date).format('MMM Do YYYY, h:mm:ss a');
+    };
+
   });
 
 });

+ 31 - 1
public/app/features/dashboard/partials/settings.html

@@ -5,7 +5,7 @@
 	</div>
 
 	<div ng-model="editor.index" bs-tabs style="text-transform:capitalize;">
-		<div ng-repeat="tab in ['General', 'Rows', 'Links', 'Time picker']" data-title="{{tab}}">
+		<div ng-repeat="tab in ['General', 'Rows', 'Links', 'Time picker', 'Metadata']" data-title="{{tab}}">
 		</div>
 	</div>
 
@@ -114,6 +114,36 @@
 		<gf-time-picker-settings dashboard="dashboard"></gf-time-picker-settings>
 	</div>
 
+  <div ng-if="editor.index == 4">
+    <div class="editor-row">
+      <div class="tight-form-section">
+        <h5>Info</h5>
+        <div class="tight-form">
+          <ul class="tight-form-list">
+            <li class="tight-form-item" style="width: 120px">
+              Last updated at:
+            </li>
+            <li class="tight-form-item" style="width: 180px">
+              {{formatDate(dashboardMeta.updated)}}
+            </li>
+          </ul>
+          <div class="clearfix"></div>
+        </div>
+        <div class="tight-form last">
+          <ul class="tight-form-list">
+            <li class="tight-form-item" style="width: 120px">
+              Created at:
+            </li>
+            <li class="tight-form-item" style="width: 180px">
+              {{formatDate(dashboardMeta.created)}}
+           </li>
+          </ul>
+          <div class="clearfix"></div>
+        </div>
+      </div>
+    </div>
+  </div>
+
 </div>
 
 <div class="clearfix"></div>