Commit d1169b4b by Rashid Khan

Added more time intervals, fixed bug in goal pie

parent 391ab7b5
...@@ -159,18 +159,39 @@ function get_bar_count(from,to,interval) { ...@@ -159,18 +159,39 @@ function get_bar_count(from,to,interval) {
function round_interval (interval) { function round_interval (interval) {
switch (true) { switch (true) {
case (interval <= 500): return 100; // 0.5s
case (interval <= 5000): return 1000; case (interval <= 500): return 100; // 0.1s
case (interval <= 7500): return 5000; // 5s
case (interval <= 15000): return 10000; case (interval <= 5000): return 1000; // 1s
case (interval <= 45000): return 30000; // 7.5s
case (interval <= 180000): return 60000; case (interval <= 7500): return 5000; // 5s
case (interval <= 450000): return 300000; // 15s
case (interval <= 1200000): return 600000; case (interval <= 15000): return 10000; // 10s
case (interval <= 2700000): return 1800000; // 45s
case (interval <= 7200000): return 3600000; case (interval <= 45000): return 30000; // 30s
case (interval <= 21600000): return 10800000; // 3m
default: return 43200000; case (interval <= 180000): return 60000; // 1m
// 9m
case (interval <= 450000): return 300000; // 5m
// 20m
case (interval <= 1200000): return 600000; // 10m
// 45m
case (interval <= 2700000): return 1800000; // 30m
// 2h
case (interval <= 7200000): return 3600000; // 1h
// 6h
case (interval <= 21600000): return 10800000; // 3h
// 24h
case (interval <= 86400000): return 43200000; // 12h
// 48h
case (interval <= 172800000): return 86400000; // 24h
// 1w
case (interval <= 604800000): return 86400000; // 24h
// 3w
case (interval <= 1814400000): return 604800000; // 1w
// 2y
case (interval < 3628800000): return 2592000000; // 30d
default: return 31536000000; // 1y
} }
} }
...@@ -261,8 +282,9 @@ function is_int(value) { ...@@ -261,8 +282,9 @@ function is_int(value) {
} }
function interval_to_seconds(string) { function interval_to_seconds(string) {
var matches = string.match(/(\d+)([Mwdhms])/); var matches = string.match(/(\d+)([Mwdhmsy])/);
switch (matches[2]) { switch (matches[2]) {
case 'y': return matches[1]*31536000;;
case 'M': return matches[1]*2592000;; case 'M': return matches[1]*2592000;;
case 'w': return matches[1]*604800;; case 'w': return matches[1]*604800;;
case 'd': return matches[1]*86400;; case 'd': return matches[1]*86400;;
......
...@@ -165,7 +165,6 @@ angular.module('kibana.pie', []) ...@@ -165,7 +165,6 @@ angular.module('kibana.pie', [])
.to($scope.time.to) .to($scope.time.to)
.cache(false)) .cache(false))
.size(0) .size(0)
.doSearch();
$scope.populate_modal(request); $scope.populate_modal(request);
...@@ -185,6 +184,7 @@ angular.module('kibana.pie', []) ...@@ -185,6 +184,7 @@ angular.module('kibana.pie', [])
// I really don't like this function, too much dom manip. Break out into directive? // I really don't like this function, too much dom manip. Break out into directive?
$scope.populate_modal = function(request) { $scope.populate_modal = function(request) {
console.log(request)
$scope.modal = { $scope.modal = {
title: "Inspector", title: "Inspector",
body : "<h5>Last Elasticsearch Query</h5><pre>"+ body : "<h5>Last Elasticsearch Query</h5><pre>"+
......
...@@ -140,11 +140,13 @@ angular.module('kibana.timepicker', []) ...@@ -140,11 +140,13 @@ angular.module('kibana.timepicker', [])
$scope.time_check = function(){ $scope.time_check = function(){
// If time picker is defined (on initialization)
if(!(_.isUndefined($scope.timepicker))) { if(!(_.isUndefined($scope.timepicker))) {
var from = $scope.panel.mode === 'relative' ? time_ago($scope.panel.timespan) : var from = $scope.panel.mode === 'relative' ? time_ago($scope.panel.timespan) :
new Date(Date.parse($scope.timepicker.from.date + " " + $scope.timepicker.from.time)) new Date(Date.parse($scope.timepicker.from.date + " " + $scope.timepicker.from.time))
var to = $scope.panel.mode !== 'absolute' ? new Date() : var to = $scope.panel.mode !== 'absolute' ? new Date() :
new Date(Date.parse($scope.timepicker.to.date + " " + $scope.timepicker.to.time)) new Date(Date.parse($scope.timepicker.to.date + " " + $scope.timepicker.to.time))
// Otherwise
} else { } else {
var from = $scope.panel.mode === 'relative' ? time_ago($scope.panel.timespan) : var from = $scope.panel.mode === 'relative' ? time_ago($scope.panel.timespan) :
$scope.time.from; $scope.time.from;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment