Browse Source

Added failover index setting

Rashid Khan 13 years ago
parent
commit
18c7083548
2 changed files with 15 additions and 5 deletions
  1. 11 4
      panels/timepicker/editor.html
  2. 4 1
      panels/timepicker/module.js

+ 11 - 4
panels/timepicker/editor.html

@@ -5,18 +5,25 @@
     </div>
     <div class="span3">
       <h6>Time Field</h6>
-      <input type="text" class="input-small" ng-model="panel.timefield" ng-change="get_data()">
+      <input type="text" class="input-small" ng-model="panel.timefield">
     </div>
-    <div class="span6">
+  </div>
+  <div class="row-fluid">    
+    <h5>Index Settings</h5>
+    <div class="span5">
       <h6>Index pattern <small>Absolutes in double quotes</small></h6>
-      <input type="text" class="input-large" ng-model="panel.index" ng-change="get_data()">
+      <input type="text" class="input-medium" ng-model="panel.index">
+    </div>
+    <div class="span5">
+      <h6>Failover Index <small>If none match the pattern</small></h6>
+      <input type="text" class="input-medium" ng-model="panel.defaultindex">
     </div>
   </div>
   <div class="row-fluid">
     <h5>Relative mode <small>settings</small></h5>  
     <div class="span8">
       <h6>Relative time options <small>comma seperated</small></h6>
-      <input type="text" array-join class="input-large" ng-model="panel.time_options" ng-change="get_data()">
+      <input type="text" array-join class="input-large" ng-model="panel.time_options">
     </div>
     <div class="span3">
       <h6>Default timespan</h6>

+ 4 - 1
panels/timepicker/module.js

@@ -35,6 +35,7 @@ angular.module('kibana.timepicker', [])
     timespan      : '15m',
     timefield     : '@timestamp',
     index         : '"logstash-"yyyy.mm.dd',
+    defaultindex  : "NOINDEX",
     group         : "default",
     refresh       : {
       enable  : false, 
@@ -195,7 +196,9 @@ angular.module('kibana.timepicker', [])
     });
 
     return all_indices().then(function(p) {
-      return _.intersection(p,possible);
+      var indices = _.intersection(p,possible);
+      console.log(indices)
+      return indices.length == 0 ? [$scope.panel.defaultindex] : indices;
     })
   };