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
a921eeb5
Commit
a921eeb5
authored
Nov 30, 2015
by
Al Lefebvre
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:hartfordfive/grafana into issue-3374
parents
4a29d459
f3f34e18
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
7 deletions
+93
-7
public/app/core/utils/kbn.js
+59
-1
public/app/features/dashboard/timeSrv.js
+3
-3
public/app/features/dashboard/timepicker/timepicker.ts
+1
-1
public/app/plugins/datasource/cloudwatch/partials/query.editor.html
+1
-1
public/test/core/utils/kbn_specs.js
+21
-0
public/test/specs/time_srv_specs.js
+8
-1
No files found.
public/app/core/utils/kbn.js
View file @
a921eeb5
...
@@ -341,6 +341,8 @@ function($, _) {
...
@@ -341,6 +341,8 @@ function($, _) {
// Currencies
// Currencies
kbn
.
valueFormats
.
currencyUSD
=
kbn
.
formatBuilders
.
currency
(
'$'
);
kbn
.
valueFormats
.
currencyUSD
=
kbn
.
formatBuilders
.
currency
(
'$'
);
kbn
.
valueFormats
.
currencyGBP
=
kbn
.
formatBuilders
.
currency
(
'£'
);
kbn
.
valueFormats
.
currencyGBP
=
kbn
.
formatBuilders
.
currency
(
'£'
);
kbn
.
valueFormats
.
currencyEUR
=
kbn
.
formatBuilders
.
currency
(
'€'
);
kbn
.
valueFormats
.
currencyJPY
=
kbn
.
formatBuilders
.
currency
(
'¥'
);
// Data
// Data
kbn
.
valueFormats
.
bits
=
kbn
.
formatBuilders
.
binarySIPrefix
(
'b'
);
kbn
.
valueFormats
.
bits
=
kbn
.
formatBuilders
.
binarySIPrefix
(
'b'
);
...
@@ -430,7 +432,7 @@ function($, _) {
...
@@ -430,7 +432,7 @@ function($, _) {
kbn
.
valueFormats
.
s
=
function
(
size
,
decimals
,
scaledDecimals
)
{
kbn
.
valueFormats
.
s
=
function
(
size
,
decimals
,
scaledDecimals
)
{
if
(
size
===
null
)
{
return
""
;
}
if
(
size
===
null
)
{
return
""
;
}
if
(
Math
.
abs
(
size
)
<
60
0
)
{
if
(
Math
.
abs
(
size
)
<
60
)
{
return
kbn
.
toFixed
(
size
,
decimals
)
+
" s"
;
return
kbn
.
toFixed
(
size
,
decimals
)
+
" s"
;
}
}
// Less than 1 hour, devide in minutes
// Less than 1 hour, devide in minutes
...
@@ -487,6 +489,57 @@ function($, _) {
...
@@ -487,6 +489,57 @@ function($, _) {
}
}
};
};
kbn
.
valueFormats
.
m
=
function
(
size
,
decimals
,
scaledDecimals
)
{
if
(
size
===
null
)
{
return
""
;
}
if
(
Math
.
abs
(
size
)
<
60
)
{
return
kbn
.
toFixed
(
size
,
decimals
)
+
" min"
;
}
else
if
(
Math
.
abs
(
size
)
<
1440
)
{
return
kbn
.
toFixedScaled
(
size
/
60
,
decimals
,
scaledDecimals
,
2
,
" hour"
);
}
else
if
(
Math
.
abs
(
size
)
<
10080
)
{
return
kbn
.
toFixedScaled
(
size
/
1440
,
decimals
,
scaledDecimals
,
3
,
" day"
);
}
else
if
(
Math
.
abs
(
size
)
<
604800
)
{
return
kbn
.
toFixedScaled
(
size
/
10080
,
decimals
,
scaledDecimals
,
4
,
" week"
);
}
else
{
return
kbn
.
toFixedScaled
(
size
/
5.25948e5
,
decimals
,
scaledDecimals
,
5
,
" year"
);
}
};
kbn
.
valueFormats
.
h
=
function
(
size
,
decimals
,
scaledDecimals
)
{
if
(
size
===
null
)
{
return
""
;
}
if
(
Math
.
abs
(
size
)
<
24
)
{
return
kbn
.
toFixed
(
size
,
decimals
)
+
" hour"
;
}
else
if
(
Math
.
abs
(
size
)
<
168
)
{
return
kbn
.
toFixedScaled
(
size
/
24
,
decimals
,
scaledDecimals
,
2
,
" day"
);
}
else
if
(
Math
.
abs
(
size
)
<
8760
)
{
return
kbn
.
toFixedScaled
(
size
/
168
,
decimals
,
scaledDecimals
,
3
,
" week"
);
}
else
{
return
kbn
.
toFixedScaled
(
size
/
8760
,
decimals
,
scaledDecimals
,
4
,
" year"
);
}
};
kbn
.
valueFormats
.
d
=
function
(
size
,
decimals
,
scaledDecimals
)
{
if
(
size
===
null
)
{
return
""
;
}
if
(
Math
.
abs
(
size
)
<
7
)
{
return
kbn
.
toFixed
(
size
,
decimals
)
+
" day"
;
}
else
if
(
Math
.
abs
(
size
)
<
365
)
{
return
kbn
.
toFixedScaled
(
size
/
7
,
decimals
,
scaledDecimals
,
2
,
" week"
);
}
else
{
return
kbn
.
toFixedScaled
(
size
/
365
,
decimals
,
scaledDecimals
,
3
,
" year"
);
}
};
///// FORMAT MENU /////
///// FORMAT MENU /////
kbn
.
getUnitFormats
=
function
()
{
kbn
.
getUnitFormats
=
function
()
{
...
@@ -508,6 +561,8 @@ function($, _) {
...
@@ -508,6 +561,8 @@ function($, _) {
submenu
:
[
submenu
:
[
{
text
:
'Dollars ($)'
,
value
:
'currencyUSD'
},
{
text
:
'Dollars ($)'
,
value
:
'currencyUSD'
},
{
text
:
'Pounds (£)'
,
value
:
'currencyGBP'
},
{
text
:
'Pounds (£)'
,
value
:
'currencyGBP'
},
{
text
:
'Euro (€)'
,
value
:
'currencyEUR'
},
{
text
:
'Yen (¥)'
,
value
:
'currencyJPY'
},
]
]
},
},
{
{
...
@@ -518,6 +573,9 @@ function($, _) {
...
@@ -518,6 +573,9 @@ function($, _) {
{
text
:
'microseconds (µs)'
,
value
:
'µs'
},
{
text
:
'microseconds (µs)'
,
value
:
'µs'
},
{
text
:
'milliseconds (ms)'
,
value
:
'ms'
},
{
text
:
'milliseconds (ms)'
,
value
:
'ms'
},
{
text
:
'seconds (s)'
,
value
:
's'
},
{
text
:
'seconds (s)'
,
value
:
's'
},
{
text
:
'minutes (m)'
,
value
:
'm'
},
{
text
:
'hours (h)'
,
value
:
'h'
},
{
text
:
'days (d)'
,
value
:
'd'
},
]
]
},
},
{
{
...
...
public/app/features/dashboard/timeSrv.js
View file @
a921eeb5
...
@@ -90,11 +90,11 @@ define([
...
@@ -90,11 +90,11 @@ define([
timer
.
cancel
(
this
.
refresh_timer
);
timer
.
cancel
(
this
.
refresh_timer
);
};
};
this
.
setTime
=
function
(
time
)
{
this
.
setTime
=
function
(
time
,
enableRefresh
)
{
_
.
extend
(
this
.
time
,
time
);
_
.
extend
(
this
.
time
,
time
);
// disable refresh if
we have an absolute time
// disable refresh if
zoom in or zoom out
if
(
moment
.
isMoment
(
time
.
to
))
{
if
(
!
enableRefresh
&&
moment
.
isMoment
(
time
.
to
))
{
this
.
old_refresh
=
this
.
dashboard
.
refresh
||
this
.
old_refresh
;
this
.
old_refresh
=
this
.
dashboard
.
refresh
||
this
.
old_refresh
;
this
.
setAutoRefresh
(
false
);
this
.
setAutoRefresh
(
false
);
}
}
...
...
public/app/features/dashboard/timepicker/timepicker.ts
View file @
a921eeb5
...
@@ -115,7 +115,7 @@ export class TimePickerCtrl {
...
@@ -115,7 +115,7 @@ export class TimePickerCtrl {
this
.
timeSrv
.
setAutoRefresh
(
this
.
refresh
.
value
);
this
.
timeSrv
.
setAutoRefresh
(
this
.
refresh
.
value
);
}
}
this
.
timeSrv
.
setTime
(
this
.
timeRaw
);
this
.
timeSrv
.
setTime
(
this
.
timeRaw
,
true
);
this
.
$rootScope
.
appEvent
(
'hide-dash-editor'
);
this
.
$rootScope
.
appEvent
(
'hide-dash-editor'
);
}
}
...
...
public/app/plugins/datasource/cloudwatch/partials/query.editor.html
View file @
a921eeb5
...
@@ -73,7 +73,7 @@
...
@@ -73,7 +73,7 @@
<ul
class=
"tight-form-list"
role=
"menu"
>
<ul
class=
"tight-form-list"
role=
"menu"
>
<li
class=
"tight-form-item query-keyword tight-form-align"
style=
"width: 100px"
>
<li
class=
"tight-form-item query-keyword tight-form-align"
style=
"width: 100px"
>
Alias
Alias
<tip>
{{metric}} {{stat}} {{namespace}} {{region}} {{
<dimension
name
>
}}
</tip>
<tip>
{{metric}} {{stat}} {{namespace}} {{region}} {{
DIMENSION_NAME
}}
</tip>
</li>
</li>
<li>
<li>
<input
type=
"text"
class=
"input-xlarge tight-form-input"
ng-model=
"target.alias"
spellcheck=
'false'
ng-model-onblur
ng-change=
"refreshMetricData()"
>
<input
type=
"text"
class=
"input-xlarge tight-form-input"
ng-model=
"target.alias"
spellcheck=
'false'
ng-model-onblur
ng-change=
"refreshMetricData()"
>
...
...
public/test/core/utils/kbn_specs.js
View file @
a921eeb5
...
@@ -68,6 +68,27 @@ define([
...
@@ -68,6 +68,27 @@ define([
describeValueFormat
(
'wps'
,
789000000
,
1000000
,
-
1
,
'789M wps'
);
describeValueFormat
(
'wps'
,
789000000
,
1000000
,
-
1
,
'789M wps'
);
describeValueFormat
(
'iops'
,
11000000000
,
1000000000
,
-
1
,
'11B iops'
);
describeValueFormat
(
'iops'
,
11000000000
,
1000000000
,
-
1
,
'11B iops'
);
describeValueFormat
(
's'
,
24
,
1
,
0
,
'24 s'
);
describeValueFormat
(
's'
,
246
,
1
,
0
,
'4.1 min'
);
describeValueFormat
(
's'
,
24567
,
100
,
0
,
'6.82 hour'
);
describeValueFormat
(
's'
,
24567890
,
10000
,
0
,
'40.62 week'
);
describeValueFormat
(
's'
,
24567890000
,
1000000
,
0
,
'778.53 year'
);
describeValueFormat
(
'm'
,
24
,
1
,
0
,
'24 min'
);
describeValueFormat
(
'm'
,
246
,
10
,
0
,
'4.1 hour'
);
describeValueFormat
(
'm'
,
6545
,
10
,
0
,
'4.55 day'
);
describeValueFormat
(
'm'
,
24567
,
100
,
0
,
'2.44 week'
);
describeValueFormat
(
'm'
,
24567892
,
10000
,
0
,
'46.7 year'
);
describeValueFormat
(
'h'
,
21
,
1
,
0
,
'21 hour'
);
describeValueFormat
(
'h'
,
145
,
1
,
0
,
'6.04 day'
);
describeValueFormat
(
'h'
,
1234
,
100
,
0
,
'7.3 week'
);
describeValueFormat
(
'h'
,
9458
,
1000
,
0
,
'1.08 year'
);
describeValueFormat
(
'd'
,
3
,
1
,
0
,
'3 day'
);
describeValueFormat
(
'd'
,
245
,
100
,
0
,
'35 week'
);
describeValueFormat
(
'd'
,
2456
,
10
,
0
,
'6.73 year'
);
describe
(
'kbn.toFixed and negative decimals'
,
function
()
{
describe
(
'kbn.toFixed and negative decimals'
,
function
()
{
it
(
'should treat as zero decimals'
,
function
()
{
it
(
'should treat as zero decimals'
,
function
()
{
var
str
=
kbn
.
toFixed
(
186.123
,
-
2
);
var
str
=
kbn
.
toFixed
(
186.123
,
-
2
);
...
...
public/test/specs/time_srv_specs.js
View file @
a921eeb5
...
@@ -78,13 +78,20 @@ define([
...
@@ -78,13 +78,20 @@ define([
});
});
describe
(
'setTime'
,
function
()
{
describe
(
'setTime'
,
function
()
{
it
(
'should return disable refresh
for absolute times
'
,
function
()
{
it
(
'should return disable refresh
if refresh is disabled for any range
'
,
function
()
{
_dashboard
.
refresh
=
false
;
_dashboard
.
refresh
=
false
;
ctx
.
service
.
setTime
({
from
:
'2011-01-01'
,
to
:
'2015-01-01'
});
ctx
.
service
.
setTime
({
from
:
'2011-01-01'
,
to
:
'2015-01-01'
});
expect
(
_dashboard
.
refresh
).
to
.
be
(
false
);
expect
(
_dashboard
.
refresh
).
to
.
be
(
false
);
});
});
it
(
'should restore refresh for absolute time range'
,
function
()
{
_dashboard
.
refresh
=
'30s'
;
ctx
.
service
.
setTime
({
from
:
'2011-01-01'
,
to
:
'2015-01-01'
});
expect
(
_dashboard
.
refresh
).
to
.
be
(
'30s'
);
});
it
(
'should restore refresh after relative time range is set'
,
function
()
{
it
(
'should restore refresh after relative time range is set'
,
function
()
{
_dashboard
.
refresh
=
'10s'
;
_dashboard
.
refresh
=
'10s'
;
ctx
.
service
.
setTime
({
from
:
moment
([
2011
,
1
,
1
]),
to
:
moment
([
2015
,
1
,
1
])});
ctx
.
service
.
setTime
({
from
:
moment
([
2011
,
1
,
1
]),
to
:
moment
([
2015
,
1
,
1
])});
...
...
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