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
87f52229
Commit
87f52229
authored
May 17, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typescript: fixed issue with tslint in testsW
parent
d261f33c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
22 deletions
+23
-22
public/app/features/panel/metrics_ds_selector.ts
+2
-2
public/test/core/utils/rangeutil_specs.ts
+19
-19
tsconfig.json
+2
-1
No files found.
public/app/features/panel/metrics_ds_selector.ts
View file @
87f52229
...
...
@@ -13,7 +13,7 @@ var template = `
<i class="icon-gf icon-gf-datasources"></i>
</label>
<label class="gf-form-label">
Panel data s
ource
Data S
ource
</label>
<metric-segment segment="ctrl.dsSegment"
...
...
@@ -22,7 +22,7 @@ var template = `
</div>
<div class="gf-form gf-form--offset-1">
<button class="btn btn-
inverse
gf-form-btn" ng-click="ctrl.addDataQuery()" ng-hide="ctrl.current.meta.mixed">
<button class="btn btn-
secondary
gf-form-btn" ng-click="ctrl.addDataQuery()" ng-hide="ctrl.current.meta.mixed">
<i class="fa fa-plus"></i>
Add query
</button>
...
...
public/test/core/utils/rangeutil_specs.ts
View file @
87f52229
import
{
describe
,
beforeEach
,
it
,
sinon
,
expect
}
from
'test/lib/common'
import
{
describe
,
beforeEach
,
it
,
sinon
,
expect
}
from
'test/lib/common'
;
import
*
as
rangeUtil
from
'app/core/utils/rangeutil'
;
import
_
from
'lodash'
;
...
...
@@ -9,33 +9,33 @@ describe("rangeUtil", () => {
describe
(
"Can get range grouped list of ranges"
,
()
=>
{
it
(
'when custom settings should return default range list'
,
()
=>
{
var
groups
=
rangeUtil
.
getRelativeTimesList
({
time_options
:
[]},
'Last 5 minutes'
);
expect
(
_
.
keys
(
groups
).
length
).
to
.
be
(
4
)
expect
(
groups
[
3
][
0
].
active
).
to
.
be
(
true
)
expect
(
_
.
keys
(
groups
).
length
).
to
.
be
(
4
)
;
expect
(
groups
[
3
][
0
].
active
).
to
.
be
(
true
)
;
});
});
describe
(
"Can get range text described"
,
()
=>
{
it
(
'should handle simple old expression with only amount and unit'
,
()
=>
{
var
info
=
rangeUtil
.
describeTextRange
(
'5m'
);
expect
(
info
.
display
).
to
.
be
(
'Last 5 minutes'
)
expect
(
info
.
display
).
to
.
be
(
'Last 5 minutes'
)
;
});
it
(
'should have singular when amount is 1'
,
()
=>
{
var
info
=
rangeUtil
.
describeTextRange
(
'1h'
);
expect
(
info
.
display
).
to
.
be
(
'Last 1 hour'
)
expect
(
info
.
display
).
to
.
be
(
'Last 1 hour'
)
;
});
it
(
'should handle non default amount'
,
()
=>
{
var
info
=
rangeUtil
.
describeTextRange
(
'13h'
);
expect
(
info
.
display
).
to
.
be
(
'Last 13 hours'
)
expect
(
info
.
from
).
to
.
be
(
'now-13h'
)
expect
(
info
.
display
).
to
.
be
(
'Last 13 hours'
)
;
expect
(
info
.
from
).
to
.
be
(
'now-13h'
)
;
});
it
(
'should handle non default future amount'
,
()
=>
{
var
info
=
rangeUtil
.
describeTextRange
(
'+3h'
);
expect
(
info
.
display
).
to
.
be
(
'Next 3 hours'
)
expect
(
info
.
from
).
to
.
be
(
'now'
)
expect
(
info
.
to
).
to
.
be
(
'now+3h'
)
expect
(
info
.
display
).
to
.
be
(
'Next 3 hours'
)
;
expect
(
info
.
from
).
to
.
be
(
'now'
)
;
expect
(
info
.
to
).
to
.
be
(
'now+3h'
)
;
});
it
(
'should handle now/d'
,
()
=>
{
...
...
@@ -52,47 +52,47 @@ describe("rangeUtil", () => {
describe
(
"Can get date range described"
,
()
=>
{
it
(
'Date range with simple ranges'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now-1h'
,
to
:
'now'
});
expect
(
text
).
to
.
be
(
'Last 1 hour'
)
expect
(
text
).
to
.
be
(
'Last 1 hour'
)
;
});
it
(
'Date range with rounding ranges'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now/d+6h'
,
to
:
'now'
});
expect
(
text
).
to
.
be
(
'now/d+6h to now'
)
expect
(
text
).
to
.
be
(
'now/d+6h to now'
)
;
});
it
(
'Date range with absolute to now'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
moment
([
2014
,
10
,
10
,
2
,
3
,
4
]),
to
:
'now'
});
expect
(
text
).
to
.
be
(
'Nov 10, 2014 02:03:04 to a few seconds ago'
)
expect
(
text
).
to
.
be
(
'Nov 10, 2014 02:03:04 to a few seconds ago'
)
;
});
it
(
'Date range with absolute to relative'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
moment
([
2014
,
10
,
10
,
2
,
3
,
4
]),
to
:
'now-1d'
});
expect
(
text
).
to
.
be
(
'Nov 10, 2014 02:03:04 to a day ago'
)
expect
(
text
).
to
.
be
(
'Nov 10, 2014 02:03:04 to a day ago'
)
;
});
it
(
'Date range with relative to absolute'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now-7d'
,
to
:
moment
([
2014
,
10
,
10
,
2
,
3
,
4
])});
expect
(
text
).
to
.
be
(
'7 days ago to Nov 10, 2014 02:03:04'
)
expect
(
text
).
to
.
be
(
'7 days ago to Nov 10, 2014 02:03:04'
)
;
});
it
(
'Date range with non matching default ranges'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now-13h'
,
to
:
'now'
});
expect
(
text
).
to
.
be
(
'Last 13 hours'
)
expect
(
text
).
to
.
be
(
'Last 13 hours'
)
;
});
it
(
'Date range with from and to both are in now-* format'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now-6h'
,
to
:
'now-3h'
});
expect
(
text
).
to
.
be
(
'now-6h to now-3h'
)
expect
(
text
).
to
.
be
(
'now-6h to now-3h'
)
;
});
it
(
'Date range with from and to both are either in now-* or now/* format'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now/d+6h'
,
to
:
'now-3h'
});
expect
(
text
).
to
.
be
(
'now/d+6h to now-3h'
)
expect
(
text
).
to
.
be
(
'now/d+6h to now-3h'
)
;
});
it
(
'Date range with from and to both are either in now-* or now+* format'
,
()
=>
{
var
text
=
rangeUtil
.
describeTimeRange
({
from
:
'now-6h'
,
to
:
'now+1h'
});
expect
(
text
).
to
.
be
(
'now-6h to now+1h'
)
expect
(
text
).
to
.
be
(
'now-6h to now+1h'
)
;
});
});
...
...
tsconfig.json
View file @
87f52229
...
...
@@ -17,7 +17,8 @@
"moduleResolution"
:
"classic"
},
"include"
:
[
"public/app/**/*.ts"
"public/app/**/*.ts"
,
"public/test/**/*.ts"
],
"exclude"
:
[
"public/vendor/**/*"
,
...
...
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