Quellcode durchsuchen

Made dashcontrol es index configurable

Rashid Khan vor 13 Jahren
Ursprung
Commit
a8570135ee
3 geänderte Dateien mit 10 neuen und 5 gelöschten Zeilen
  1. 5 2
      panels/dashcontrol/editor.html
  2. 4 3
      panels/dashcontrol/module.js
  3. 1 0
      panels/table/module.html

+ 5 - 2
panels/dashcontrol/editor.html

@@ -25,8 +25,11 @@
     <div class="span2">
       <label class="small"> Elasticsearch </label><input type="checkbox" ng-model="panel.load.elasticsearch" ng-checked="panel.load.elasticsearch">
     </div>
-    <div class="span4" ng-show="panel.load.elasticsearch">
-      <label class="small"> Elasticsearch list size</label><input class="input-small" type="number" ng-model="panel.elasticsearch_size">
+    <div class="span3" ng-show="panel.load.elasticsearch">
+      <label class="small">ES list size</label><input class="input-mini" type="number" ng-model="panel.elasticsearch_size">
+    </div>
+    <div class="span3" ng-show="panel.load.elasticsearch">
+      <label class="small">ES store index</label><input class="input-small" type="text" ng-model="panel.elasticsearch_saveto">
     </div>
   </div>
 </div>

+ 4 - 3
panels/dashcontrol/module.js

@@ -18,6 +18,7 @@ angular.module('kibana.dashcontrol', [])
       local: true,
     },
     elasticsearch_size: 20,
+    elasticsearch_saveto: 'kibana-int'
   }
   _.defaults($scope.panel,_d);
 
@@ -61,7 +62,7 @@ angular.module('kibana.dashcontrol', [])
   $scope.save_elasticsearch = function() {
     var save = _.clone($scope.dashboards)
     save.title = $scope.elasticsearch.title;
-    var result = $scope.ejs.Document('kibana-int','dashboard',save.title).source({
+    var result = $scope.ejs.Document($scope.panel.elasticsearch_saveto,'dashboard',save.title).source({
       user: 'guest',
       group: 'guest',
       title: save.title,
@@ -75,7 +76,7 @@ angular.module('kibana.dashcontrol', [])
   }
 
   $scope.delete_elasticsearch = function(dashboard) {
-    var result = $scope.ejs.Document('kibana-int','dashboard',dashboard._id).doDelete();
+    var result = $scope.ejs.Document($scope.panel.elasticsearch_saveto,'dashboard',dashboard._id).doDelete();
     result.then(function(result) {
       $scope.alert('Dashboard Deleted','','success',5000)
       $scope.elasticsearch.dashboards = _.without($scope.elasticsearch.dashboards,dashboard)
@@ -84,7 +85,7 @@ angular.module('kibana.dashcontrol', [])
 
   $scope.elasticsearch_dblist = function(query) {
     if($scope.panel.load.elasticsearch) {
-      var request = $scope.ejs.Request().indices('kibana-int').types('dashboard');
+      var request = $scope.ejs.Request().indices($scope.panel.elasticsearch_saveto).types('dashboard');
       var results = request.query(
         $scope.ejs.QueryStringQuery(query || '*')
         ).size($scope.panel.elasticsearch_size).doSearch();

+ 1 - 0
panels/table/module.html

@@ -13,6 +13,7 @@
         <i ng-click="panel.offset = (panel.offset + panel.size);get_data();" ng-show="hits > (panel.offset + data.length)" class='icon-arrow-right pointer'></i>
       </div>
     </div>
+    <div class="small" ng-show="panel.fields.length == 0">No columns configured. You may want to add a <strong>fields panel</strong>, or click the edit button in the top right of this panel to add some columns</div>
     <table class="table table-condensed table-striped" ng-style="panel.style">
       <thead>
         <th style="white-space:nowrap" ng-repeat="field in panel.fields">