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
0b4552a8
Commit
0b4552a8
authored
Dec 04, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(timerange): fix handling of invalid dates in from/to url parameters, fixes #3345
parent
2345b41a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
public/app/features/dashboard/timeSrv.js
+4
-2
public/test/mocks/dashboard-mock.js
+1
-1
public/test/specs/time_srv_specs.js
+8
-0
No files found.
public/app/features/dashboard/timeSrv.js
View file @
0b4552a8
...
@@ -21,6 +21,7 @@ define([
...
@@ -21,6 +21,7 @@ define([
this
.
_initTimeFromUrl
();
this
.
_initTimeFromUrl
();
this
.
_parseTime
();
this
.
_parseTime
();
console
.
log
(
dashboard
.
time
);
if
(
this
.
dashboard
.
refresh
)
{
if
(
this
.
dashboard
.
refresh
)
{
this
.
setAutoRefresh
(
this
.
dashboard
.
refresh
);
this
.
setAutoRefresh
(
this
.
dashboard
.
refresh
);
...
@@ -47,8 +48,9 @@ define([
...
@@ -47,8 +48,9 @@ define([
if
(
value
.
length
===
15
)
{
if
(
value
.
length
===
15
)
{
return
moment
.
utc
(
value
,
'YYYYMMDDTHHmmss'
);
return
moment
.
utc
(
value
,
'YYYYMMDDTHHmmss'
);
}
}
var
epoch
=
parseInt
(
value
);
if
(
!
_
.
isNaN
(
epoch
))
{
if
(
!
isNaN
(
value
))
{
var
epoch
=
parseInt
(
value
);
return
moment
(
epoch
);
return
moment
(
epoch
);
}
}
...
...
public/test/mocks/dashboard-mock.js
View file @
0b4552a8
...
@@ -15,7 +15,7 @@ define([],
...
@@ -15,7 +15,7 @@ define([],
rows
:
[],
rows
:
[],
pulldowns
:
[
{
type
:
'templating'
},
{
type
:
'annotations'
}
],
pulldowns
:
[
{
type
:
'templating'
},
{
type
:
'annotations'
}
],
nav
:
[
{
type
:
'timepicker'
}
],
nav
:
[
{
type
:
'timepicker'
}
],
time
:
{
from
:
'
1
h'
,
to
:
'now'
},
time
:
{
from
:
'
now-6
h'
,
to
:
'now'
},
templating
:
{
templating
:
{
list
:
[]
list
:
[]
},
},
...
...
public/test/specs/time_srv_specs.js
View file @
0b4552a8
...
@@ -75,6 +75,14 @@ define([
...
@@ -75,6 +75,14 @@ define([
expect
(
time
.
to
.
valueOf
()).
to
.
equal
(
1410337665699
);
expect
(
time
.
to
.
valueOf
()).
to
.
equal
(
1410337665699
);
});
});
it
(
'should handle bad dates'
,
function
()
{
ctx
.
$routeParams
.
from
=
'20151126T00010%3C%2Fp%3E%3Cspan%20class'
;
ctx
.
$routeParams
.
to
=
'now'
;
_dashboard
.
time
.
from
=
'now-6h'
;
ctx
.
service
.
init
(
_dashboard
);
expect
(
ctx
.
service
.
time
.
from
).
to
.
equal
(
'now-6h'
);
expect
(
ctx
.
service
.
time
.
to
).
to
.
equal
(
'now'
);
});
});
});
describe
(
'setTime'
,
function
()
{
describe
(
'setTime'
,
function
()
{
...
...
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