Procházet zdrojové kódy

switch field input to text input if no fields list exists

Rashid Khan před 12 roky
rodič
revize
a608b80970

+ 5 - 2
panels/derivequeries/module.html

@@ -13,8 +13,11 @@
           <td width="97%" style="padding-right:20px">
             <input type="text" style="width:100%" ng-model="panel.query">
           </td>
-          <td>
-            <select class="input-small" ng-model="panel.field" ng-options="f for f in fields"></select>
+          <td ng-show="panel.fields.length > 0">
+            <select class="input-small" ng-model="panel.field" ng-options="f for f in panel.fields"></select>
+          </td>
+          <td ng-show="panel.fields.length == 0">
+            <input class="input-small" ng-model="panel.field" type="text"/>
           </td>
           <td style="margin-left:20px" width="1%">
             <button style="margin-top:0px" type="submit" class="btn btn-info" ng-click="get_data()"><i class="icon-search"></i></button>

+ 2 - 3
panels/derivequeries/module.js

@@ -30,6 +30,7 @@ angular.module('kibana.derivequeries', [])
     query   : "*",
     group   : "default",
     field   : '_type',
+    fields  : [],
     spyable : true,
     size    : 5,
     exclude : []
@@ -38,9 +39,7 @@ angular.module('kibana.derivequeries', [])
 
   $scope.init = function() {
     eventBus.register($scope,'fields', function(event, fields) {
-      $scope.panel.sort = _.clone(fields.sort);
-      $scope.fields     = fields.all,
-      $scope.active     = _.clone(fields.active);
+      $scope.panel.fields = fields.all;
     });
     eventBus.register($scope,'time', function(event,time){set_time(time)});
     eventBus.register($scope,'query', function(event, query) {