Explorar el Código

moved slice to filter, should be faster

Rashid Khan hace 12 años
padre
commit
cc5da00bd0
Se han modificado 2 ficheros con 7 adiciones y 1 borrados
  1. 6 0
      js/filters.js
  2. 1 1
      panels/table/module.html

+ 6 - 0
js/filters.js

@@ -20,4 +20,10 @@ angular.module('kibana.filters', [])
     });
     return ret;
   };
+}).filter('slice', function() {
+  return function(arr, start, end) {
+    if(!_.isUndefined(arr)) {
+      return arr.slice(start, end);
+    }
+  };
 });

+ 1 - 1
panels/table/module.html

@@ -34,7 +34,7 @@
         </th>
       
       </thead>
-      <tbody ng-repeat="row in data.slice(panel.offset,panel.offset+panel.size)" ng-class-odd="'odd'">
+      <tbody ng-repeat="row in data | slice:panel.offset:panel.offset+panel.size" ng-class-odd="'odd'">
         <tr ng-click="toggle_details(row)" class="pointer">
           <td ng-repeat="field in panel.fields" ng-bind-html-unsafe="(row.highlight[field]||row._source[field]) | highlight"></td>
         </tr>