Kaynağa Gözat

Closes #62, there is now a New button in the open / search dashboard view.

Torkel Ödegaard 12 yıl önce
ebeveyn
işleme
0032f934c9

+ 9 - 6
src/app/controllers/search.js

@@ -51,12 +51,6 @@ function (angular, _, config, $) {
       });
     };
 
-    $scope.toggleImport = function ($event) {
-      $event.stopPropagation();
-
-      $scope.showImport = !$scope.showImport;
-    };
-
     $scope.elasticsearch_dblist = function(queryStr) {
       $scope.showImport = false;
       $scope.selectedIndex = -1;
@@ -120,6 +114,15 @@ function (angular, _, config, $) {
       });
     };
 
+    $scope.toggleImport = function ($event) {
+      $event.stopPropagation();
+      $scope.showImport = !$scope.showImport;
+    };
+
+    $scope.newDashboard = function() {
+      $location.url('/dashboard/file/empty.json');
+    };
+
   });
 
 

+ 1 - 1
src/app/dashboards/default.json

@@ -1,5 +1,5 @@
 {
-  "title": "New Dashboard",
+  "title": "Welcome to Grafana!",
   "services": {
     "filter": {
       "list": [],

+ 83 - 0
src/app/dashboards/empty.json

@@ -0,0 +1,83 @@
+{
+  "title": "New Dashboard",
+  "services": {
+    "filter": {
+      "list": [],
+      "time": {
+        "from": "now-6h",
+        "to": "now"
+      }
+    }
+  },
+  "rows": [
+    {
+      "title": "Row1",
+      "height": "250px",
+      "editable": true,
+      "collapse": false,
+      "collapsable": true,
+      "panels": [],
+      "notice": false
+    }
+  ],
+  "editable": true,
+  "failover": false,
+  "panel_hints": true,
+  "style": "dark",
+  "pulldowns": [
+    {
+      "type": "filtering",
+      "collapse": false,
+      "notice": false,
+      "enable": false
+    }
+  ],
+  "nav": [
+    {
+      "type": "timepicker",
+      "collapse": false,
+      "notice": false,
+      "enable": true,
+      "status": "Stable",
+      "time_options": [
+        "5m",
+        "15m",
+        "1h",
+        "6h",
+        "12h",
+        "24h",
+        "2d",
+        "7d",
+        "30d"
+      ],
+      "refresh_intervals": [
+        "5s",
+        "10s",
+        "30s",
+        "1m",
+        "5m",
+        "15m",
+        "30m",
+        "1h",
+        "2h",
+        "1d"
+      ],
+      "now": true
+    }
+  ],
+  "loader": {
+    "save_gist": false,
+    "save_elasticsearch": true,
+    "save_local": true,
+    "save_default": true,
+    "save_temp": true,
+    "save_temp_ttl_enable": true,
+    "save_temp_ttl": "30d",
+    "load_gist": false,
+    "load_elasticsearch": true,
+    "load_elasticsearch_size": 20,
+    "load_local": false,
+    "hide": false
+  },
+  "refresh": false
+}

+ 18 - 9
src/app/partials/search.html

@@ -19,12 +19,24 @@
   <ul class="dropdown-menu" id="grafana-search">
     <li ng-if="!showImport">
       <div class="grafana-search-panel">
-        <input  type="text"
-                placeholder="search dashboards, metrics, or graphs"
-                xng-focus="giveSearchFocus"
-                ng-keydown="keyDown($event)"
-                ng-model="elasticsearch.query"
-                ng-change="elasticsearch_dblist(elasticsearch.query)" />
+        <div class="search-field-wrapper">
+          <button class="btn btn-success pull-right" ng-click="toggleImport($event)">
+            <i class="icon-download-alt"></i>
+            Import
+          </button>
+          <button class="btn btn-success pull-right" ng-click="newDashboard()">
+            <i class="icon-th-large"></i>
+            New
+          </button>
+          <span>
+            <input  type="text"
+                    placeholder="search dashboards, metrics, or graphs"
+                    xng-focus="giveSearchFocus"
+                    ng-keydown="keyDown($event)"
+                    ng-model="elasticsearch.query"
+                    ng-change="elasticsearch_dblist(elasticsearch.query)" />
+          </span>
+        </div>
         <h6 ng-hide="search_results.dashboards.length || search_results.metrics.length">No dashboards or metrics matching your query found</h6>
         <table class="table table-condensed table-striped">
           <tr bindonce ng-repeat="row in search_results.metrics"
@@ -52,9 +64,6 @@
       </div>
     </li>
 
-    <li class="pull-right" style="margin: 5px;">
-      <a ng-click="toggleImport($event)">Import</a>
-    </li>
     <!-- ng-show="dashboard.current.loader.load_gist || dashboard.current.loader.load_local" -->
     <li ng-if="showImport" style="margin: 20px;">
       <div class="editor-row">

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
src/css/bootstrap.dark.min.css


Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
src/css/bootstrap.light.min.css


+ 13 - 4
src/vendor/bootstrap/less/grafana.less

@@ -12,10 +12,19 @@
 
 .grafana-search-panel {
   padding: 6px 10px;
-  input {
-    width: 100%;
-    .box-sizing(border-box);
-    padding: 15px;
+
+  .search-field-wrapper {
+    input {
+      width: 100%;
+    }
+    button {
+      margin: 0 2px 0 0;
+    }
+    > span {
+      display: block;
+      overflow: hidden;
+      padding-right: 25px;
+    }
   }
 
   .selected td, tr.selected:nth-child(odd)>td {

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor