Просмотр исходного кода

Fixed sort order of numeric fields

Rashid Khan 12 лет назад
Родитель
Сommit
9ed8265c1e
5 измененных файлов с 14 добавлено и 5 удалено
  1. 8 3
      common/lib/shared.js
  2. 3 0
      js/app.js
  3. 1 1
      panels/fields/editor.html
  4. 1 0
      panels/map/module.js
  5. 1 1
      panels/table/module.js

+ 8 - 3
common/lib/shared.js

@@ -270,10 +270,15 @@ function flatten_json(object,root,array) {
     var obj = object[index]
     var rootname = root.length == 0 ? index : root + '.' + index;
     if(typeof obj == 'object' ) {
-      if(_.isArray(obj))
-        array[rootname] = typeof obj === 'undefined' ? null : obj.join(',');
-      else
+      if(_.isArray(obj)) {
+        if(obj.length === 1 && _.isNumber(obj[0])) {
+          array[rootname] = parseFloat(obj[0]);
+        } else {
+          array[rootname] = typeof obj === 'undefined' ? null : obj.join(',');
+        }
+      } else {
         flatten_json(obj,rootname,array)
+      }
     } else {
       array[rootname] = typeof obj === 'undefined' ? null : obj;
     }

+ 3 - 0
js/app.js

@@ -54,6 +54,9 @@ labjs.wait(function(){
         .when('/dashboard/:type/:id', {
           templateUrl: 'partials/dashboard.html'
         })
+        .when('/dashboard/:type/:id/:params', {
+          templateUrl: 'partials/dashboard.html'
+        })
         .otherwise({
           redirectTo: 'dashboard'
         });

+ 1 - 1
panels/fields/editor.html

@@ -6,5 +6,5 @@
       <select class="input-small" ng-model="panel.arrange" ng-options="f for f in ['horizontal','vertical']"></select></span>
     </div>
     <div class="span3"><h6>Font Size</h6> 
-      <select class="input-small" ng-model="panel.style['font-size']" ng-options="f for f in ['6pt','7pt','8pt','10pt','12pt','14pt','16pt','18pt','20pt','24pt','28pt','32pt','36pt','42pt','48pt','52pt','60pt','72pt']"></select></span>
+      <select class="input-small" ng-model="panel.style['font-size']" ng-options="f for f in ['6pt','7pt','8pt','9pt','10pt','12pt','14pt','16pt','18pt','20pt','24pt','28pt','32pt','36pt','42pt','48pt','52pt','60pt','72pt']"></select></span>
   </div>

+ 1 - 0
panels/map/module.js

@@ -10,6 +10,7 @@ angular.module('kibana.map', [])
     exclude : [],
     spyable : true,
     group   : "default",
+    index_limit : 0
   }
   _.defaults($scope.panel,_d)
 

+ 1 - 1
panels/table/module.js

@@ -128,7 +128,7 @@ angular.module('kibana.table', [])
         $scope.data = _.sortBy($scope.data, function(v){
           return v[$scope.panel.sort[0]]
         });
-
+        
         // Reverse if needed
         if($scope.panel.sort[1] == 'desc')
           $scope.data.reverse();