Explorar el Código

[search] Provide finer grain interval for real time timelines

Romain Rigaux hace 10 años
padre
commit
6eef4a0

+ 7 - 3
apps/search/src/search/api.py

@@ -101,8 +101,12 @@ def _guess_range_facet(widget_type, solr_api, collection, facet_field, propertie
           mktime(start_ts.timetuple())
       ) / SLOTS
 
-      if difference < 1:
+      if difference < 2:
         gap = '+1SECONDS'
+      elif difference < 5:
+        gap = '+5SECONDS'        
+      elif difference < 30:
+        gap = '+30SECONDS' 
       elif difference < 100:
         gap = '+1MINUTES'
       elif difference < 60 * 5:
@@ -149,8 +153,8 @@ def _guess_range_facet(widget_type, solr_api, collection, facet_field, propertie
     pass
 
 def _round_date_range(tm):
-  start = tm - timedelta(minutes=tm.minute, seconds=tm.second, microseconds=tm.microsecond)
-  end = start + timedelta(minutes=60)
+  start = tm - timedelta(seconds=tm.second, microseconds=tm.microsecond)
+  end = start + timedelta(seconds=60)
   return start, end
 
 def _round_number_range(n):

+ 8 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -216,6 +216,14 @@ ko.bindingHandlers.daterangepicker = {
       value: "+1SECONDS",
       label: "1s"
     },
+    {
+      value: "+5SECONDS",
+      label: "5s"
+    },
+    {
+      value: "+30SECONDS",
+      label: "30s"
+    },
     {
       value: "+1MINUTES",
       label: "1m"