Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
d1169b4b
Commit
d1169b4b
authored
Mar 13, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more time intervals, fixed bug in goal pie
parent
391ab7b5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
15 deletions
+39
-15
common/lib/shared.js
+35
-13
panels/pie/module.js
+2
-2
panels/timepicker/module.js
+2
-0
No files found.
common/lib/shared.js
View file @
d1169b4b
...
@@ -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
+
)([
Mwdhms
y
])
/
);
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
;;
...
...
panels/pie/module.js
View file @
d1169b4b
...
@@ -165,10 +165,9 @@ angular.module('kibana.pie', [])
...
@@ -165,10 +165,9 @@ 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
);
var
results
=
request
.
doSearch
();
var
results
=
request
.
doSearch
();
results
.
then
(
function
(
results
)
{
results
.
then
(
function
(
results
)
{
...
@@ -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>"
+
...
...
panels/timepicker/module.js
View file @
d1169b4b
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment