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
37d212c7
Commit
37d212c7
authored
Sep 30, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spencer/interval-issues' into intervals
parents
186dba8d
3048538a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
src/app/components/kbn.js
+15
-5
src/app/panels/histogram/interval.js
+5
-6
No files found.
src/app/components/kbn.js
View file @
37d212c7
...
...
@@ -209,7 +209,7 @@ function($, _) {
kbn
.
interval_regex
=
/
(\d
+
(?:\.\d
+
)?)([
Mwdhmsy
])
/
;
// histogram & trends
var
intervals_in_seconds
=
{
kbn
.
intervals_in_seconds
=
{
y
:
31536000
,
M
:
2592000
,
w
:
604800
,
...
...
@@ -219,17 +219,27 @@ function($, _) {
s
:
1
};
kbn
.
interval_to_ms
=
function
(
string
)
{
kbn
.
describe_interval
=
function
(
string
)
{
var
matches
=
string
.
match
(
kbn
.
interval_regex
);
if
(
!
matches
||
!
_
.
has
(
intervals_in_seconds
,
matches
[
2
]))
{
if
(
!
matches
||
!
_
.
has
(
kbn
.
intervals_in_seconds
,
matches
[
2
]))
{
throw
new
Error
(
'Invalid interval string, expexcting a number followed by one of "Mwdhmsy"'
);
}
else
{
return
intervals_in_seconds
[
matches
[
2
]]
*
matches
[
1
]
*
1000
;
return
{
sec
:
kbn
.
intervals_in_seconds
[
matches
[
2
]],
type
:
matches
[
2
],
count
:
parseInt
(
matches
[
1
],
10
)
};
}
};
kbn
.
interval_to_ms
=
function
(
string
)
{
var
info
=
kbn
.
describe_interval
(
string
);
return
info
.
sec
*
1000
*
info
.
count
;
};
kbn
.
interval_to_seconds
=
function
(
string
)
{
return
kbn
.
interval_to_ms
(
string
)
/
1000
;
var
info
=
kbn
.
describe_interval
(
string
);
return
info
.
sec
*
info
.
count
;
};
// This should go away, moment.js can do this
...
...
src/app/panels/histogram/interval.js
View file @
37d212c7
...
...
@@ -10,11 +10,10 @@ function (kbn) {
*/
function
Interval
(
interval_string
)
{
this
.
string
=
interval_string
;
this
.
ms
=
kbn
.
interval_to_ms
(
interval_string
);
var
matches
=
interval_string
.
match
(
kbn
.
interval_regex
);
this
.
count
=
parseInt
(
matches
[
1
],
10
)
;
this
.
type
=
matches
[
2
]
;
var
info
=
kbn
.
describe_interval
(
interval_string
);
this
.
type
=
info
.
type
;
this
.
ms
=
info
.
sec
*
1000
*
info
.
count
;
// does the length of the interval change based on the current time?
if
(
this
.
type
===
'y'
||
this
.
type
===
'M'
)
{
...
...
@@ -31,10 +30,10 @@ function (kbn) {
return
this
.
string
;
},
after
:
function
(
current_ms
)
{
return
this
.
get
(
current_ms
,
this
.
count
);
return
this
.
get
(
current_ms
,
1
);
},
before
:
function
(
current_ms
)
{
return
this
.
get
(
current_ms
,
-
this
.
count
);
return
this
.
get
(
current_ms
,
-
1
);
},
get_complex
:
function
(
current
,
delta
)
{
this
.
date
.
setTime
(
current
);
...
...
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