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
552a61b6
Commit
552a61b6
authored
Aug 30, 2018
by
Patrick O'Carroll
Committed by
Torkel Ödegaard
Aug 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed var to let in 50 files (#13075)
parent
b494a29e
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
196 additions
and
196 deletions
+196
-196
public/app/core/components/query_part/query_part.ts
+1
-1
public/app/core/directives/misc.ts
+3
-3
public/app/core/directives/rebuild_on_change.ts
+4
-4
public/app/core/directives/tags.ts
+1
-1
public/app/core/partials.ts
+1
-1
public/app/core/profiler.ts
+3
-3
public/app/core/services/backend_srv.ts
+1
-1
public/app/core/services/impression_srv.ts
+2
-2
public/app/core/services/ng_react.ts
+2
-2
public/app/core/time_series2.ts
+10
-10
public/app/core/utils/datemath.ts
+8
-8
public/app/core/utils/kbn.ts
+6
-6
public/app/core/utils/tags.ts
+1
-1
public/app/core/utils/url.ts
+1
-1
public/app/features/alerting/threshold_mapper.ts
+1
-1
public/app/features/annotations/annotations_srv.ts
+1
-1
public/app/features/annotations/event_manager.ts
+1
-1
public/app/features/dashboard/dashboard_migration.ts
+2
-2
public/app/features/dashboard/dashboard_model.ts
+1
-1
public/app/features/panel/metrics_panel_ctrl.ts
+2
-2
public/app/features/panel/panel_ctrl.ts
+2
-2
public/app/features/templating/variable.ts
+4
-4
public/app/plugins/datasource/cloudwatch/datasource.ts
+7
-7
public/app/plugins/datasource/cloudwatch/query_parameter_ctrl.ts
+2
-2
public/app/plugins/datasource/elasticsearch/bucket_agg.ts
+2
-2
public/app/plugins/datasource/elasticsearch/datasource.ts
+9
-9
public/app/plugins/datasource/elasticsearch/elastic_response.ts
+9
-9
public/app/plugins/datasource/elasticsearch/metric_agg.ts
+1
-1
public/app/plugins/datasource/elasticsearch/query_builder.ts
+7
-7
public/app/plugins/datasource/elasticsearch/query_ctrl.ts
+1
-1
public/app/plugins/datasource/graphite/add_graphite_func.ts
+4
-4
public/app/plugins/datasource/graphite/datasource.ts
+9
-9
public/app/plugins/datasource/graphite/func_editor.ts
+5
-5
public/app/plugins/datasource/graphite/gfunc.ts
+3
-3
public/app/plugins/datasource/graphite/graphite_query.ts
+1
-1
public/app/plugins/datasource/graphite/lexer.ts
+13
-13
public/app/plugins/datasource/graphite/parser.ts
+1
-1
public/app/plugins/datasource/graphite/query_ctrl.ts
+2
-2
public/app/plugins/datasource/influxdb/datasource.ts
+6
-6
public/app/plugins/datasource/influxdb/influx_query.ts
+9
-9
public/app/plugins/datasource/influxdb/influx_series.ts
+6
-6
public/app/plugins/datasource/influxdb/query_builder.ts
+6
-6
public/app/plugins/datasource/influxdb/query_ctrl.ts
+3
-3
public/app/plugins/datasource/influxdb/query_part.ts
+2
-2
public/app/plugins/datasource/opentsdb/datasource.ts
+8
-8
public/app/plugins/datasource/prometheus/completer.ts
+4
-4
public/app/plugins/datasource/prometheus/datasource.ts
+3
-3
public/app/plugins/datasource/prometheus/metric_find_query.ts
+2
-2
public/app/plugins/datasource/prometheus/result_transformer.ts
+1
-1
public/app/plugins/panel/graph/threshold_manager.ts
+12
-12
No files found.
public/app/core/components/query_part/query_part.ts
View file @
552a61b6
...
@@ -74,7 +74,7 @@ export class QueryPart {
...
@@ -74,7 +74,7 @@ export class QueryPart {
return
;
return
;
}
}
var
text
=
this
.
def
.
type
+
'('
;
let
text
=
this
.
def
.
type
+
'('
;
text
+=
this
.
params
.
join
(
', '
);
text
+=
this
.
params
.
join
(
', '
);
text
+=
')'
;
text
+=
')'
;
this
.
text
=
text
;
this
.
text
=
text
;
...
...
public/app/core/directives/misc.ts
View file @
552a61b6
...
@@ -9,7 +9,7 @@ function tip($compile) {
...
@@ -9,7 +9,7 @@ function tip($compile) {
return
{
return
{
restrict
:
'E'
,
restrict
:
'E'
,
link
:
function
(
scope
,
elem
,
attrs
)
{
link
:
function
(
scope
,
elem
,
attrs
)
{
var
_t
=
let
_t
=
'<i class="grafana-tip fa fa-'
+
'<i class="grafana-tip fa fa-'
+
(
attrs
.
icon
||
'question-circle'
)
+
(
attrs
.
icon
||
'question-circle'
)
+
'" bs-tooltip="
\'
'
+
'" bs-tooltip="
\'
'
+
...
@@ -125,7 +125,7 @@ function editorCheckbox($compile, $interpolate) {
...
@@ -125,7 +125,7 @@ function editorCheckbox($compile, $interpolate) {
const
tip
=
attrs
.
tip
?
' <tip>'
+
attrs
.
tip
+
'</tip>'
:
''
;
const
tip
=
attrs
.
tip
?
' <tip>'
+
attrs
.
tip
+
'</tip>'
:
''
;
const
label
=
'<label for="'
+
scope
.
$id
+
model
+
'" class="checkbox-label">'
+
text
+
tip
+
'</label>'
;
const
label
=
'<label for="'
+
scope
.
$id
+
model
+
'" class="checkbox-label">'
+
text
+
tip
+
'</label>'
;
var
template
=
let
template
=
'<input class="cr1" id="'
+
'<input class="cr1" id="'
+
scope
.
$id
+
scope
.
$id
+
model
+
model
+
...
@@ -163,7 +163,7 @@ function gfDropdown($parse, $compile, $timeout) {
...
@@ -163,7 +163,7 @@ function gfDropdown($parse, $compile, $timeout) {
continue
;
continue
;
}
}
var
li
=
let
li
=
'<li'
+
'<li'
+
(
item
.
submenu
&&
item
.
submenu
.
length
?
' class="dropdown-submenu"'
:
''
)
+
(
item
.
submenu
&&
item
.
submenu
.
length
?
' class="dropdown-submenu"'
:
''
)
+
'>'
+
'>'
+
...
...
public/app/core/directives/rebuild_on_change.ts
View file @
552a61b6
...
@@ -2,11 +2,11 @@ import $ from 'jquery';
...
@@ -2,11 +2,11 @@ import $ from 'jquery';
import
coreModule
from
'../core_module'
;
import
coreModule
from
'../core_module'
;
function
getBlockNodes
(
nodes
)
{
function
getBlockNodes
(
nodes
)
{
var
node
=
nodes
[
0
];
let
node
=
nodes
[
0
];
const
endNode
=
nodes
[
nodes
.
length
-
1
];
const
endNode
=
nodes
[
nodes
.
length
-
1
];
var
blockNodes
;
let
blockNodes
;
for
(
var
i
=
1
;
node
!==
endNode
&&
(
node
=
node
.
nextSibling
);
i
++
)
{
for
(
let
i
=
1
;
node
!==
endNode
&&
(
node
=
node
.
nextSibling
);
i
++
)
{
if
(
blockNodes
||
nodes
[
i
]
!==
node
)
{
if
(
blockNodes
||
nodes
[
i
]
!==
node
)
{
if
(
!
blockNodes
)
{
if
(
!
blockNodes
)
{
blockNodes
=
$
([].
slice
.
call
(
nodes
,
0
,
i
));
blockNodes
=
$
([].
slice
.
call
(
nodes
,
0
,
i
));
...
@@ -27,7 +27,7 @@ function rebuildOnChange($animate) {
...
@@ -27,7 +27,7 @@ function rebuildOnChange($animate) {
priority
:
600
,
priority
:
600
,
restrict
:
'E'
,
restrict
:
'E'
,
link
:
function
(
scope
,
elem
,
attrs
,
ctrl
,
transclude
)
{
link
:
function
(
scope
,
elem
,
attrs
,
ctrl
,
transclude
)
{
var
block
,
childScope
,
previousElements
;
let
block
,
childScope
,
previousElements
;
function
cleanUp
()
{
function
cleanUp
()
{
if
(
previousElements
)
{
if
(
previousElements
)
{
...
...
public/app/core/directives/tags.ts
View file @
552a61b6
...
@@ -104,7 +104,7 @@ function bootstrapTagsinput() {
...
@@ -104,7 +104,7 @@ function bootstrapTagsinput() {
select
.
tagsinput
(
'removeAll'
);
select
.
tagsinput
(
'removeAll'
);
for
(
var
i
=
0
;
i
<
scope
.
model
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
scope
.
model
.
length
;
i
++
)
{
select
.
tagsinput
(
'add'
,
scope
.
model
[
i
]);
select
.
tagsinput
(
'add'
,
scope
.
model
[
i
]);
}
}
},
},
...
...
public/app/core/partials.ts
View file @
552a61b6
var
templates
=
(
<
any
>
require
).
context
(
'../'
,
true
,
/
\.
html$/
);
let
templates
=
(
<
any
>
require
).
context
(
'../'
,
true
,
/
\.
html$/
);
templates
.
keys
().
forEach
(
function
(
key
)
{
templates
.
keys
().
forEach
(
function
(
key
)
{
templates
(
key
);
templates
(
key
);
});
});
public/app/core/profiler.ts
View file @
552a61b6
...
@@ -69,7 +69,7 @@ export class Profiler {
...
@@ -69,7 +69,7 @@ export class Profiler {
// measure digest performance
// measure digest performance
const
rootDigestStart
=
window
.
performance
.
now
();
const
rootDigestStart
=
window
.
performance
.
now
();
for
(
var
i
=
0
;
i
<
30
;
i
++
)
{
for
(
let
i
=
0
;
i
<
30
;
i
++
)
{
this
.
$rootScope
.
$apply
();
this
.
$rootScope
.
$apply
();
}
}
...
@@ -78,8 +78,8 @@ export class Profiler {
...
@@ -78,8 +78,8 @@ export class Profiler {
}
}
getTotalWatcherCount
()
{
getTotalWatcherCount
()
{
var
count
=
0
;
let
count
=
0
;
var
scopes
=
0
;
let
scopes
=
0
;
const
root
=
$
(
document
.
getElementsByTagName
(
'body'
));
const
root
=
$
(
document
.
getElementsByTagName
(
'body'
));
const
f
=
function
(
element
)
{
const
f
=
function
(
element
)
{
...
...
public/app/core/services/backend_srv.ts
View file @
552a61b6
...
@@ -43,7 +43,7 @@ export class BackendSrv {
...
@@ -43,7 +43,7 @@ export class BackendSrv {
return
;
return
;
}
}
var
data
=
err
.
data
||
{
message
:
'Unexpected error'
};
let
data
=
err
.
data
||
{
message
:
'Unexpected error'
};
if
(
_
.
isString
(
data
))
{
if
(
_
.
isString
(
data
))
{
data
=
{
message
:
data
};
data
=
{
message
:
data
};
}
}
...
...
public/app/core/services/impression_srv.ts
View file @
552a61b6
...
@@ -7,7 +7,7 @@ export class ImpressionSrv {
...
@@ -7,7 +7,7 @@ export class ImpressionSrv {
addDashboardImpression
(
dashboardId
)
{
addDashboardImpression
(
dashboardId
)
{
const
impressionsKey
=
this
.
impressionKey
(
config
);
const
impressionsKey
=
this
.
impressionKey
(
config
);
var
impressions
=
[];
let
impressions
=
[];
if
(
store
.
exists
(
impressionsKey
))
{
if
(
store
.
exists
(
impressionsKey
))
{
impressions
=
JSON
.
parse
(
store
.
get
(
impressionsKey
));
impressions
=
JSON
.
parse
(
store
.
get
(
impressionsKey
));
if
(
!
_
.
isArray
(
impressions
))
{
if
(
!
_
.
isArray
(
impressions
))
{
...
@@ -28,7 +28,7 @@ export class ImpressionSrv {
...
@@ -28,7 +28,7 @@ export class ImpressionSrv {
}
}
getDashboardOpened
()
{
getDashboardOpened
()
{
var
impressions
=
store
.
get
(
this
.
impressionKey
(
config
))
||
'[]'
;
let
impressions
=
store
.
get
(
this
.
impressionKey
(
config
))
||
'[]'
;
impressions
=
JSON
.
parse
(
impressions
);
impressions
=
JSON
.
parse
(
impressions
);
...
...
public/app/core/services/ng_react.ts
View file @
552a61b6
...
@@ -27,7 +27,7 @@ function getReactComponent(name, $injector) {
...
@@ -27,7 +27,7 @@ function getReactComponent(name, $injector) {
}
}
// ensure the specified React component is accessible, and fail fast if it's not
// ensure the specified React component is accessible, and fail fast if it's not
var
reactComponent
;
let
reactComponent
;
try
{
try
{
reactComponent
=
$injector
.
get
(
name
);
reactComponent
=
$injector
.
get
(
name
);
}
catch
(
e
)
{}
}
catch
(
e
)
{}
...
@@ -256,7 +256,7 @@ const reactDirective = function($injector) {
...
@@ -256,7 +256,7 @@ const reactDirective = function($injector) {
// for each of the properties, get their scope value and set it to scope.props
// for each of the properties, get their scope value and set it to scope.props
const
renderMyComponent
=
function
()
{
const
renderMyComponent
=
function
()
{
var
scopeProps
=
{};
let
scopeProps
=
{};
const
config
=
{};
const
config
=
{};
props
.
forEach
(
function
(
prop
)
{
props
.
forEach
(
function
(
prop
)
{
...
...
public/app/core/time_series2.ts
View file @
552a61b6
...
@@ -124,7 +124,7 @@ export default class TimeSeries {
...
@@ -124,7 +124,7 @@ export default class TimeSeries {
delete
this
.
stack
;
delete
this
.
stack
;
delete
this
.
bars
.
show
;
delete
this
.
bars
.
show
;
for
(
var
i
=
0
;
i
<
overrides
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
overrides
.
length
;
i
++
)
{
const
override
=
overrides
[
i
];
const
override
=
overrides
[
i
];
if
(
!
matchSeriesOverride
(
override
.
alias
,
this
.
alias
))
{
if
(
!
matchSeriesOverride
(
override
.
alias
,
this
.
alias
))
{
continue
;
continue
;
...
@@ -211,14 +211,14 @@ export default class TimeSeries {
...
@@ -211,14 +211,14 @@ export default class TimeSeries {
const
ignoreNulls
=
fillStyle
===
'connected'
;
const
ignoreNulls
=
fillStyle
===
'connected'
;
const
nullAsZero
=
fillStyle
===
'null as zero'
;
const
nullAsZero
=
fillStyle
===
'null as zero'
;
var
currentTime
;
let
currentTime
;
var
currentValue
;
let
currentValue
;
var
nonNulls
=
0
;
let
nonNulls
=
0
;
var
previousTime
;
let
previousTime
;
var
previousValue
=
0
;
let
previousValue
=
0
;
var
previousDeltaUp
=
true
;
let
previousDeltaUp
=
true
;
for
(
var
i
=
0
;
i
<
this
.
datapoints
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
datapoints
.
length
;
i
++
)
{
currentValue
=
this
.
datapoints
[
i
][
0
];
currentValue
=
this
.
datapoints
[
i
][
0
];
currentTime
=
this
.
datapoints
[
i
][
1
];
currentTime
=
this
.
datapoints
[
i
][
1
];
...
@@ -328,7 +328,7 @@ export default class TimeSeries {
...
@@ -328,7 +328,7 @@ export default class TimeSeries {
}
}
isMsResolutionNeeded
()
{
isMsResolutionNeeded
()
{
for
(
var
i
=
0
;
i
<
this
.
datapoints
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
datapoints
.
length
;
i
++
)
{
if
(
this
.
datapoints
[
i
][
1
]
!==
null
)
{
if
(
this
.
datapoints
[
i
][
1
]
!==
null
)
{
const
timestamp
=
this
.
datapoints
[
i
][
1
].
toString
();
const
timestamp
=
this
.
datapoints
[
i
][
1
].
toString
();
if
(
timestamp
.
length
===
13
&&
timestamp
%
1000
!==
0
)
{
if
(
timestamp
.
length
===
13
&&
timestamp
%
1000
!==
0
)
{
...
...
public/app/core/utils/datemath.ts
View file @
552a61b6
...
@@ -14,10 +14,10 @@ export function parse(text, roundUp?, timezone?) {
...
@@ -14,10 +14,10 @@ export function parse(text, roundUp?, timezone?) {
return
moment
(
text
);
return
moment
(
text
);
}
}
var
time
;
let
time
;
var
mathString
=
''
;
let
mathString
=
''
;
var
index
;
let
index
;
var
parseString
;
let
parseString
;
if
(
text
.
substring
(
0
,
3
)
===
'now'
)
{
if
(
text
.
substring
(
0
,
3
)
===
'now'
)
{
if
(
timezone
===
'utc'
)
{
if
(
timezone
===
'utc'
)
{
...
@@ -61,14 +61,14 @@ export function isValid(text) {
...
@@ -61,14 +61,14 @@ export function isValid(text) {
export
function
parseDateMath
(
mathString
,
time
,
roundUp
?)
{
export
function
parseDateMath
(
mathString
,
time
,
roundUp
?)
{
const
dateTime
=
time
;
const
dateTime
=
time
;
var
i
=
0
;
let
i
=
0
;
const
len
=
mathString
.
length
;
const
len
=
mathString
.
length
;
while
(
i
<
len
)
{
while
(
i
<
len
)
{
const
c
=
mathString
.
charAt
(
i
++
);
const
c
=
mathString
.
charAt
(
i
++
);
var
type
;
let
type
;
var
num
;
let
num
;
var
unit
;
let
unit
;
if
(
c
===
'/'
)
{
if
(
c
===
'/'
)
{
type
=
0
;
type
=
0
;
...
...
public/app/core/utils/kbn.ts
View file @
552a61b6
...
@@ -169,8 +169,8 @@ kbn.intervals_in_seconds = {
...
@@ -169,8 +169,8 @@ kbn.intervals_in_seconds = {
};
};
kbn.calculateInterval = function(range, resolution, lowLimitInterval) {
kbn.calculateInterval = function(range, resolution, lowLimitInterval) {
var
lowLimitMs = 1; // 1 millisecond default low limit
let
lowLimitMs = 1; // 1 millisecond default low limit
var
intervalMs;
let
intervalMs;
if (lowLimitInterval) {
if (lowLimitInterval) {
if (lowLimitInterval[0] === '>') {
if (lowLimitInterval[0] === '>') {
...
@@ -304,7 +304,7 @@ kbn.formatBuilders.scaledUnits = function(factor, extArray) {
...
@@ -304,7 +304,7 @@ kbn.formatBuilders.scaledUnits = function(factor, extArray) {
return '';
return '';
}
}
var
steps = 0;
let
steps = 0;
const limit = extArray.length;
const limit = extArray.length;
while (Math.abs(size) >= factor) {
while (Math.abs(size) >= factor) {
...
@@ -328,7 +328,7 @@ kbn.formatBuilders.scaledUnits = function(factor, extArray) {
...
@@ -328,7 +328,7 @@ kbn.formatBuilders.scaledUnits = function(factor, extArray) {
// offset is given, it adjusts the starting units at the given prefix; a value
// offset is given, it adjusts the starting units at the given prefix; a value
// of 0 starts at no scale; -3 drops to nano, +2 starts at mega, etc.
// of 0 starts at no scale; -3 drops to nano, +2 starts at mega, etc.
kbn.formatBuilders.decimalSIPrefix = function(unit, offset) {
kbn.formatBuilders.decimalSIPrefix = function(unit, offset) {
var
prefixes = ['n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
let
prefixes = ['n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
prefixes = prefixes.slice(3 + (offset || 0));
prefixes = prefixes.slice(3 + (offset || 0));
const units = prefixes.map(function(p) {
const units = prefixes.map(function(p) {
return ' ' + p + unit;
return ' ' + p + unit;
...
@@ -790,8 +790,8 @@ kbn.toDuration = function(size, decimals, timeScale) {
...
@@ -790,8 +790,8 @@ kbn.toDuration = function(size, decimals, timeScale) {
const strings = [];
const strings = [];
// after first value >= 1 print only $decimals more
// after first value >= 1 print only $decimals more
var
decrementDecimals = false;
let
decrementDecimals = false;
for (
var
i = 0; i < units.length && decimals >= 0; i++) {
for (
let
i = 0; i < units.length && decimals >= 0; i++) {
const interval = kbn.intervals_in_seconds[units[i].short] * 1000;
const interval = kbn.intervals_in_seconds[units[i].short] * 1000;
const value = size / interval;
const value = size / interval;
if (value >= 1 || decrementDecimals) {
if (value >= 1 || decrementDecimals) {
...
...
public/app/core/utils/tags.ts
View file @
552a61b6
...
@@ -75,7 +75,7 @@ export function getTagColorsFromName(name: string): { color: string; borderColor
...
@@ -75,7 +75,7 @@ export function getTagColorsFromName(name: string): { color: string; borderColor
function
djb2
(
str
)
{
function
djb2
(
str
)
{
let
hash
=
5381
;
let
hash
=
5381
;
for
(
var
i
=
0
;
i
<
str
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
str
.
length
;
i
++
)
{
hash
=
(
hash
<<
5
)
+
hash
+
str
.
charCodeAt
(
i
);
/* hash * 33 + c */
hash
=
(
hash
<<
5
)
+
hash
+
str
.
charCodeAt
(
i
);
/* hash * 33 + c */
}
}
return
hash
;
return
hash
;
...
...
public/app/core/utils/url.ts
View file @
552a61b6
...
@@ -20,7 +20,7 @@ export function toUrlParams(a) {
...
@@ -20,7 +20,7 @@ export function toUrlParams(a) {
};
};
const
buildParams
=
function
(
prefix
,
obj
)
{
const
buildParams
=
function
(
prefix
,
obj
)
{
var
i
,
len
,
key
;
let
i
,
len
,
key
;
if
(
prefix
)
{
if
(
prefix
)
{
if
(
isArray
(
obj
))
{
if
(
isArray
(
obj
))
{
...
...
public/app/features/alerting/threshold_mapper.ts
View file @
552a61b6
export
class
ThresholdMapper
{
export
class
ThresholdMapper
{
static
alertToGraphThresholds
(
panel
)
{
static
alertToGraphThresholds
(
panel
)
{
for
(
var
i
=
0
;
i
<
panel
.
alert
.
conditions
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
panel
.
alert
.
conditions
.
length
;
i
++
)
{
const
condition
=
panel
.
alert
.
conditions
[
i
];
const
condition
=
panel
.
alert
.
conditions
[
i
];
if
(
condition
.
type
!==
'query'
)
{
if
(
condition
.
type
!==
'query'
)
{
continue
;
continue
;
...
...
public/app/features/annotations/annotations_srv.ts
View file @
552a61b6
...
@@ -25,7 +25,7 @@ export class AnnotationsSrv {
...
@@ -25,7 +25,7 @@ export class AnnotationsSrv {
.
all
([
this
.
getGlobalAnnotations
(
options
),
this
.
getAlertStates
(
options
)])
.
all
([
this
.
getGlobalAnnotations
(
options
),
this
.
getAlertStates
(
options
)])
.
then
(
results
=>
{
.
then
(
results
=>
{
// combine the annotations and flatten results
// combine the annotations and flatten results
var
annotations
=
_
.
flattenDeep
(
results
[
0
]);
let
annotations
=
_
.
flattenDeep
(
results
[
0
]);
// filter out annotations that do not belong to requesting panel
// filter out annotations that do not belong to requesting panel
annotations
=
_
.
filter
(
annotations
,
item
=>
{
annotations
=
_
.
filter
(
annotations
,
item
=>
{
...
...
public/app/features/annotations/event_manager.ts
View file @
552a61b6
...
@@ -102,7 +102,7 @@ export class EventManager {
...
@@ -102,7 +102,7 @@ export class EventManager {
}
}
}
else
{
}
else
{
// annotations from query
// annotations from query
for
(
var
i
=
0
;
i
<
annotations
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
annotations
.
length
;
i
++
)
{
const
item
=
annotations
[
i
];
const
item
=
annotations
[
i
];
// add properties used by jquery flot events
// add properties used by jquery flot events
...
...
public/app/features/dashboard/dashboard_migration.ts
View file @
552a61b6
...
@@ -18,7 +18,7 @@ export class DashboardMigrator {
...
@@ -18,7 +18,7 @@ export class DashboardMigrator {
}
}
updateSchema
(
old
)
{
updateSchema
(
old
)
{
var
i
,
j
,
k
,
n
;
let
i
,
j
,
k
,
n
;
const
oldVersion
=
this
.
dashboard
.
schemaVersion
;
const
oldVersion
=
this
.
dashboard
.
schemaVersion
;
const
panelUpgrades
=
[];
const
panelUpgrades
=
[];
this
.
dashboard
.
schemaVersion
=
16
;
this
.
dashboard
.
schemaVersion
=
16
;
...
@@ -83,7 +83,7 @@ export class DashboardMigrator {
...
@@ -83,7 +83,7 @@ export class DashboardMigrator {
// schema version 3 changes
// schema version 3 changes
if
(
oldVersion
<
3
)
{
if
(
oldVersion
<
3
)
{
// ensure panel ids
// ensure panel ids
var
maxId
=
this
.
dashboard
.
getNextPanelId
();
let
maxId
=
this
.
dashboard
.
getNextPanelId
();
panelUpgrades
.
push
(
function
(
panel
)
{
panelUpgrades
.
push
(
function
(
panel
)
{
if
(
!
panel
.
id
)
{
if
(
!
panel
.
id
)
{
panel
.
id
=
maxId
;
panel
.
id
=
maxId
;
...
...
public/app/features/dashboard/dashboard_model.ts
View file @
552a61b6
...
@@ -144,7 +144,7 @@ export class DashboardModel {
...
@@ -144,7 +144,7 @@ export class DashboardModel {
});
});
// make clone
// make clone
var
copy
:
any
=
{};
let
copy
:
any
=
{};
for
(
const
property
in
this
)
{
for
(
const
property
in
this
)
{
if
(
DashboardModel
.
nonPersistedProperties
[
property
]
||
!
this
.
hasOwnProperty
(
property
))
{
if
(
DashboardModel
.
nonPersistedProperties
[
property
]
||
!
this
.
hasOwnProperty
(
property
))
{
continue
;
continue
;
...
...
public/app/features/panel/metrics_panel_ctrl.ts
View file @
552a61b6
...
@@ -75,7 +75,7 @@ class MetricsPanelCtrl extends PanelCtrl {
...
@@ -75,7 +75,7 @@ class MetricsPanelCtrl extends PanelCtrl {
// if we have snapshot data use that
// if we have snapshot data use that
if
(
this
.
panel
.
snapshotData
)
{
if
(
this
.
panel
.
snapshotData
)
{
this
.
updateTimeRange
();
this
.
updateTimeRange
();
var
data
=
this
.
panel
.
snapshotData
;
let
data
=
this
.
panel
.
snapshotData
;
// backward compatibility
// backward compatibility
if
(
!
_
.
isArray
(
data
))
{
if
(
!
_
.
isArray
(
data
))
{
data
=
data
.
data
;
data
=
data
.
data
;
...
@@ -155,7 +155,7 @@ class MetricsPanelCtrl extends PanelCtrl {
...
@@ -155,7 +155,7 @@ class MetricsPanelCtrl extends PanelCtrl {
}
}
calculateInterval
()
{
calculateInterval
()
{
var
intervalOverride
=
this
.
panel
.
interval
;
let
intervalOverride
=
this
.
panel
.
interval
;
// if no panel interval check datasource
// if no panel interval check datasource
if
(
intervalOverride
)
{
if
(
intervalOverride
)
{
...
...
public/app/features/panel/panel_ctrl.ts
View file @
552a61b6
...
@@ -317,7 +317,7 @@ export class PanelCtrl {
...
@@ -317,7 +317,7 @@ export class PanelCtrl {
}
}
getInfoContent
(
options
)
{
getInfoContent
(
options
)
{
var
markdown
=
this
.
panel
.
description
;
let
markdown
=
this
.
panel
.
description
;
if
(
options
.
mode
===
'tooltip'
)
{
if
(
options
.
mode
===
'tooltip'
)
{
markdown
=
this
.
error
||
this
.
panel
.
description
;
markdown
=
this
.
error
||
this
.
panel
.
description
;
...
@@ -327,7 +327,7 @@ export class PanelCtrl {
...
@@ -327,7 +327,7 @@ export class PanelCtrl {
const
sanitize
=
this
.
$injector
.
get
(
'$sanitize'
);
const
sanitize
=
this
.
$injector
.
get
(
'$sanitize'
);
const
templateSrv
=
this
.
$injector
.
get
(
'templateSrv'
);
const
templateSrv
=
this
.
$injector
.
get
(
'templateSrv'
);
const
interpolatedMarkdown
=
templateSrv
.
replace
(
markdown
,
this
.
panel
.
scopedVars
);
const
interpolatedMarkdown
=
templateSrv
.
replace
(
markdown
,
this
.
panel
.
scopedVars
);
var
html
=
'<div class="markdown-html">'
;
let
html
=
'<div class="markdown-html">'
;
html
+=
new
Remarkable
().
render
(
interpolatedMarkdown
);
html
+=
new
Remarkable
().
render
(
interpolatedMarkdown
);
...
...
public/app/features/templating/variable.ts
View file @
552a61b6
...
@@ -10,14 +10,14 @@ export interface Variable {
...
@@ -10,14 +10,14 @@ export interface Variable {
getSaveModel
();
getSaveModel
();
}
}
export
var
variableTypes
=
{};
export
let
variableTypes
=
{};
export
{
assignModelProperties
};
export
{
assignModelProperties
};
export
function
containsVariable
(...
args
:
any
[])
{
export
function
containsVariable
(...
args
:
any
[])
{
var
variableName
=
args
[
args
.
length
-
1
];
let
variableName
=
args
[
args
.
length
-
1
];
var
str
=
args
[
0
]
||
''
;
let
str
=
args
[
0
]
||
''
;
for
(
var
i
=
1
;
i
<
args
.
length
-
1
;
i
++
)
{
for
(
let
i
=
1
;
i
<
args
.
length
-
1
;
i
++
)
{
str
+=
' '
+
args
[
i
]
||
''
;
str
+=
' '
+
args
[
i
]
||
''
;
}
}
...
...
public/app/plugins/datasource/cloudwatch/datasource.ts
View file @
552a61b6
...
@@ -85,12 +85,12 @@ export default class CloudWatchDatasource {
...
@@ -85,12 +85,12 @@ export default class CloudWatchDatasource {
const
end
=
this
.
convertToCloudWatchTime
(
options
.
range
.
to
,
true
);
const
end
=
this
.
convertToCloudWatchTime
(
options
.
range
.
to
,
true
);
now
=
Math
.
round
((
now
||
Date
.
now
())
/
1000
);
now
=
Math
.
round
((
now
||
Date
.
now
())
/
1000
);
var
period
;
let
period
;
const
range
=
end
-
start
;
const
range
=
end
-
start
;
const
hourSec
=
60
*
60
;
const
hourSec
=
60
*
60
;
const
daySec
=
hourSec
*
24
;
const
daySec
=
hourSec
*
24
;
var
periodUnit
=
60
;
let
periodUnit
=
60
;
if
(
!
target
.
period
)
{
if
(
!
target
.
period
)
{
if
(
now
-
start
<=
daySec
*
15
)
{
if
(
now
-
start
<=
daySec
*
15
)
{
// until 15 days ago
// until 15 days ago
...
@@ -222,10 +222,10 @@ export default class CloudWatchDatasource {
...
@@ -222,10 +222,10 @@ export default class CloudWatchDatasource {
}
}
metricFindQuery
(
query
)
{
metricFindQuery
(
query
)
{
var
region
;
let
region
;
var
namespace
;
let
namespace
;
var
metricName
;
let
metricName
;
var
filterJson
;
let
filterJson
;
const
regionQuery
=
query
.
match
(
/^regions
\(\)
/
);
const
regionQuery
=
query
.
match
(
/^regions
\(\)
/
);
if
(
regionQuery
)
{
if
(
regionQuery
)
{
...
@@ -291,7 +291,7 @@ export default class CloudWatchDatasource {
...
@@ -291,7 +291,7 @@ export default class CloudWatchDatasource {
return
this
.
templateSrv
.
replace
(
s
);
return
this
.
templateSrv
.
replace
(
s
);
});
});
const
defaultPeriod
=
annotation
.
prefixMatching
?
''
:
'300'
;
const
defaultPeriod
=
annotation
.
prefixMatching
?
''
:
'300'
;
var
period
=
annotation
.
period
||
defaultPeriod
;
let
period
=
annotation
.
period
||
defaultPeriod
;
period
=
parseInt
(
period
,
10
);
period
=
parseInt
(
period
,
10
);
const
parameters
=
{
const
parameters
=
{
prefixMatching
:
annotation
.
prefixMatching
,
prefixMatching
:
annotation
.
prefixMatching
,
...
...
public/app/plugins/datasource/cloudwatch/query_parameter_ctrl.ts
View file @
552a61b6
...
@@ -120,7 +120,7 @@ export class CloudWatchQueryParameterCtrl {
...
@@ -120,7 +120,7 @@ export class CloudWatchQueryParameterCtrl {
}
}
const
target
=
$scope
.
target
;
const
target
=
$scope
.
target
;
var
query
=
$q
.
when
([]);
let
query
=
$q
.
when
([]);
if
(
segment
.
type
===
'key'
||
segment
.
type
===
'plus-button'
)
{
if
(
segment
.
type
===
'key'
||
segment
.
type
===
'plus-button'
)
{
query
=
$scope
.
datasource
.
getDimensionKeys
(
$scope
.
target
.
namespace
,
$scope
.
target
.
region
);
query
=
$scope
.
datasource
.
getDimensionKeys
(
$scope
.
target
.
namespace
,
$scope
.
target
.
region
);
...
@@ -164,7 +164,7 @@ export class CloudWatchQueryParameterCtrl {
...
@@ -164,7 +164,7 @@ export class CloudWatchQueryParameterCtrl {
const
dims
=
{};
const
dims
=
{};
const
length
=
$scope
.
dimSegments
.
length
;
const
length
=
$scope
.
dimSegments
.
length
;
for
(
var
i
=
0
;
i
<
length
-
2
;
i
+=
3
)
{
for
(
let
i
=
0
;
i
<
length
-
2
;
i
+=
3
)
{
const
keySegment
=
$scope
.
dimSegments
[
i
];
const
keySegment
=
$scope
.
dimSegments
[
i
];
const
valueSegment
=
$scope
.
dimSegments
[
i
+
2
];
const
valueSegment
=
$scope
.
dimSegments
[
i
+
2
];
if
(
!
valueSegment
.
fake
)
{
if
(
!
valueSegment
.
fake
)
{
...
...
public/app/plugins/datasource/elasticsearch/bucket_agg.ts
View file @
552a61b6
...
@@ -84,7 +84,7 @@ export class ElasticBucketAggCtrl {
...
@@ -84,7 +84,7 @@ export class ElasticBucketAggCtrl {
$scope
.
isFirst
=
$scope
.
index
===
0
;
$scope
.
isFirst
=
$scope
.
index
===
0
;
$scope
.
bucketAggCount
=
bucketAggs
.
length
;
$scope
.
bucketAggCount
=
bucketAggs
.
length
;
var
settingsLinkText
=
''
;
let
settingsLinkText
=
''
;
const
settings
=
$scope
.
agg
.
settings
||
{};
const
settings
=
$scope
.
agg
.
settings
||
{};
switch
(
$scope
.
agg
.
type
)
{
switch
(
$scope
.
agg
.
type
)
{
...
@@ -199,7 +199,7 @@ export class ElasticBucketAggCtrl {
...
@@ -199,7 +199,7 @@ export class ElasticBucketAggCtrl {
$scope
.
addBucketAgg
=
function
()
{
$scope
.
addBucketAgg
=
function
()
{
// if last is date histogram add it before
// if last is date histogram add it before
const
lastBucket
=
bucketAggs
[
bucketAggs
.
length
-
1
];
const
lastBucket
=
bucketAggs
[
bucketAggs
.
length
-
1
];
var
addIndex
=
bucketAggs
.
length
-
1
;
let
addIndex
=
bucketAggs
.
length
-
1
;
if
(
lastBucket
&&
lastBucket
.
type
===
'date_histogram'
)
{
if
(
lastBucket
&&
lastBucket
.
type
===
'date_histogram'
)
{
addIndex
-=
1
;
addIndex
-=
1
;
...
...
public/app/plugins/datasource/elasticsearch/datasource.ts
View file @
552a61b6
...
@@ -151,9 +151,9 @@ export class ElasticDatasource {
...
@@ -151,9 +151,9 @@ export class ElasticDatasource {
}
}
const
fieldNames
=
fieldName
.
split
(
'.'
);
const
fieldNames
=
fieldName
.
split
(
'.'
);
var
fieldValue
=
source
;
let
fieldValue
=
source
;
for
(
var
i
=
0
;
i
<
fieldNames
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
fieldNames
.
length
;
i
++
)
{
fieldValue
=
fieldValue
[
fieldNames
[
i
]];
fieldValue
=
fieldValue
[
fieldNames
[
i
]];
if
(
!
fieldValue
)
{
if
(
!
fieldValue
)
{
console
.
log
(
'could not find field in annotation: '
,
fieldName
);
console
.
log
(
'could not find field in annotation: '
,
fieldName
);
...
@@ -164,9 +164,9 @@ export class ElasticDatasource {
...
@@ -164,9 +164,9 @@ export class ElasticDatasource {
return
fieldValue
;
return
fieldValue
;
};
};
for
(
var
i
=
0
;
i
<
hits
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
hits
.
length
;
i
++
)
{
const
source
=
hits
[
i
].
_source
;
const
source
=
hits
[
i
].
_source
;
var
time
=
getFieldFromSource
(
source
,
timeField
);
let
time
=
getFieldFromSource
(
source
,
timeField
);
if
(
typeof
hits
[
i
].
fields
!==
'undefined'
)
{
if
(
typeof
hits
[
i
].
fields
!==
'undefined'
)
{
const
fields
=
hits
[
i
].
fields
;
const
fields
=
hits
[
i
].
fields
;
if
(
_
.
isString
(
fields
[
timeField
])
||
_
.
isNumber
(
fields
[
timeField
]))
{
if
(
_
.
isString
(
fields
[
timeField
])
||
_
.
isNumber
(
fields
[
timeField
]))
{
...
@@ -216,7 +216,7 @@ export class ElasticDatasource {
...
@@ -216,7 +216,7 @@ export class ElasticDatasource {
function
(
err
)
{
function
(
err
)
{
console
.
log
(
err
);
console
.
log
(
err
);
if
(
err
.
data
&&
err
.
data
.
error
)
{
if
(
err
.
data
&&
err
.
data
.
error
)
{
var
message
=
angular
.
toJson
(
err
.
data
.
error
);
let
message
=
angular
.
toJson
(
err
.
data
.
error
);
if
(
err
.
data
.
error
.
reason
)
{
if
(
err
.
data
.
error
.
reason
)
{
message
=
err
.
data
.
error
.
reason
;
message
=
err
.
data
.
error
.
reason
;
}
}
...
@@ -241,14 +241,14 @@ export class ElasticDatasource {
...
@@ -241,14 +241,14 @@ export class ElasticDatasource {
}
}
query
(
options
)
{
query
(
options
)
{
var
payload
=
''
;
let
payload
=
''
;
var
target
;
let
target
;
const
sentTargets
=
[];
const
sentTargets
=
[];
// add global adhoc filters to timeFilter
// add global adhoc filters to timeFilter
const
adhocFilters
=
this
.
templateSrv
.
getAdhocFilters
(
this
.
name
);
const
adhocFilters
=
this
.
templateSrv
.
getAdhocFilters
(
this
.
name
);
for
(
var
i
=
0
;
i
<
options
.
targets
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
options
.
targets
.
length
;
i
++
)
{
target
=
options
.
targets
[
i
];
target
=
options
.
targets
[
i
];
if
(
target
.
hide
)
{
if
(
target
.
hide
)
{
continue
;
continue
;
...
@@ -362,7 +362,7 @@ export class ElasticDatasource {
...
@@ -362,7 +362,7 @@ export class ElasticDatasource {
const
range
=
this
.
timeSrv
.
timeRange
();
const
range
=
this
.
timeSrv
.
timeRange
();
const
searchType
=
this
.
esVersion
>=
5
?
'query_then_fetch'
:
'count'
;
const
searchType
=
this
.
esVersion
>=
5
?
'query_then_fetch'
:
'count'
;
const
header
=
this
.
getQueryHeader
(
searchType
,
range
.
from
,
range
.
to
);
const
header
=
this
.
getQueryHeader
(
searchType
,
range
.
from
,
range
.
to
);
var
esQuery
=
angular
.
toJson
(
this
.
queryBuilder
.
getTermsQuery
(
queryDef
));
let
esQuery
=
angular
.
toJson
(
this
.
queryBuilder
.
getTermsQuery
(
queryDef
));
esQuery
=
esQuery
.
replace
(
/
\$
timeFrom/g
,
range
.
from
.
valueOf
());
esQuery
=
esQuery
.
replace
(
/
\$
timeFrom/g
,
range
.
from
.
valueOf
());
esQuery
=
esQuery
.
replace
(
/
\$
timeTo/g
,
range
.
to
.
valueOf
());
esQuery
=
esQuery
.
replace
(
/
\$
timeTo/g
,
range
.
to
.
valueOf
());
...
...
public/app/plugins/datasource/elasticsearch/elastic_response.ts
View file @
552a61b6
...
@@ -9,7 +9,7 @@ export class ElasticResponse {
...
@@ -9,7 +9,7 @@ export class ElasticResponse {
}
}
processMetrics
(
esAgg
,
target
,
seriesList
,
props
)
{
processMetrics
(
esAgg
,
target
,
seriesList
,
props
)
{
var
metric
,
y
,
i
,
newSeries
,
bucket
,
value
;
let
metric
,
y
,
i
,
newSeries
,
bucket
,
value
;
for
(
y
=
0
;
y
<
target
.
metrics
.
length
;
y
++
)
{
for
(
y
=
0
;
y
<
target
.
metrics
.
length
;
y
++
)
{
metric
=
target
.
metrics
[
y
];
metric
=
target
.
metrics
[
y
];
...
@@ -177,7 +177,7 @@ export class ElasticResponse {
...
@@ -177,7 +177,7 @@ export class ElasticResponse {
// This is quite complex
// This is quite complex
// need to recurise down the nested buckets to build series
// need to recurise down the nested buckets to build series
processBuckets
(
aggs
,
target
,
seriesList
,
table
,
props
,
depth
)
{
processBuckets
(
aggs
,
target
,
seriesList
,
table
,
props
,
depth
)
{
var
bucket
,
aggDef
,
esAgg
,
aggId
;
let
bucket
,
aggDef
,
esAgg
,
aggId
;
const
maxDepth
=
target
.
bucketAggs
.
length
-
1
;
const
maxDepth
=
target
.
bucketAggs
.
length
-
1
;
for
(
aggId
in
aggs
)
{
for
(
aggId
in
aggs
)
{
...
@@ -213,7 +213,7 @@ export class ElasticResponse {
...
@@ -213,7 +213,7 @@ export class ElasticResponse {
}
}
private
getMetricName
(
metric
)
{
private
getMetricName
(
metric
)
{
var
metricDef
=
_
.
find
(
queryDef
.
metricAggTypes
,
{
value
:
metric
});
let
metricDef
=
_
.
find
(
queryDef
.
metricAggTypes
,
{
value
:
metric
});
if
(
!
metricDef
)
{
if
(
!
metricDef
)
{
metricDef
=
_
.
find
(
queryDef
.
extendedStats
,
{
value
:
metric
});
metricDef
=
_
.
find
(
queryDef
.
extendedStats
,
{
value
:
metric
});
}
}
...
@@ -222,7 +222,7 @@ export class ElasticResponse {
...
@@ -222,7 +222,7 @@ export class ElasticResponse {
}
}
private
getSeriesName
(
series
,
target
,
metricTypeCount
)
{
private
getSeriesName
(
series
,
target
,
metricTypeCount
)
{
var
metricName
=
this
.
getMetricName
(
series
.
metric
);
let
metricName
=
this
.
getMetricName
(
series
.
metric
);
if
(
target
.
alias
)
{
if
(
target
.
alias
)
{
const
regex
=
/
\{\{([\s\S]
+
?)\}\}
/g
;
const
regex
=
/
\{\{([\s\S]
+
?)\}\}
/g
;
...
@@ -263,7 +263,7 @@ export class ElasticResponse {
...
@@ -263,7 +263,7 @@ export class ElasticResponse {
return
metricName
;
return
metricName
;
}
}
var
name
=
''
;
let
name
=
''
;
for
(
const
propName
in
series
.
props
)
{
for
(
const
propName
in
series
.
props
)
{
name
+=
series
.
props
[
propName
]
+
' '
;
name
+=
series
.
props
[
propName
]
+
' '
;
}
}
...
@@ -278,7 +278,7 @@ export class ElasticResponse {
...
@@ -278,7 +278,7 @@ export class ElasticResponse {
nameSeries
(
seriesList
,
target
)
{
nameSeries
(
seriesList
,
target
)
{
const
metricTypeCount
=
_
.
uniq
(
_
.
map
(
seriesList
,
'metric'
)).
length
;
const
metricTypeCount
=
_
.
uniq
(
_
.
map
(
seriesList
,
'metric'
)).
length
;
for
(
var
i
=
0
;
i
<
seriesList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
seriesList
.
length
;
i
++
)
{
const
series
=
seriesList
[
i
];
const
series
=
seriesList
[
i
];
series
.
target
=
this
.
getSeriesName
(
series
,
target
,
metricTypeCount
);
series
.
target
=
this
.
getSeriesName
(
series
,
target
,
metricTypeCount
);
}
}
...
@@ -292,7 +292,7 @@ export class ElasticResponse {
...
@@ -292,7 +292,7 @@ export class ElasticResponse {
total
:
hits
.
total
,
total
:
hits
.
total
,
filterable
:
true
,
filterable
:
true
,
};
};
var
propName
,
hit
,
doc
,
i
;
let
propName
,
hit
,
doc
,
i
;
for
(
i
=
0
;
i
<
hits
.
hits
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
hits
.
hits
.
length
;
i
++
)
{
hit
=
hits
.
hits
[
i
];
hit
=
hits
.
hits
[
i
];
...
@@ -351,7 +351,7 @@ export class ElasticResponse {
...
@@ -351,7 +351,7 @@ export class ElasticResponse {
getTimeSeries
()
{
getTimeSeries
()
{
const
seriesList
=
[];
const
seriesList
=
[];
for
(
var
i
=
0
;
i
<
this
.
response
.
responses
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
response
.
responses
.
length
;
i
++
)
{
const
response
=
this
.
response
.
responses
[
i
];
const
response
=
this
.
response
.
responses
[
i
];
if
(
response
.
error
)
{
if
(
response
.
error
)
{
throw
this
.
getErrorFromElasticResponse
(
this
.
response
,
response
.
error
);
throw
this
.
getErrorFromElasticResponse
(
this
.
response
,
response
.
error
);
...
@@ -371,7 +371,7 @@ export class ElasticResponse {
...
@@ -371,7 +371,7 @@ export class ElasticResponse {
this
.
trimDatapoints
(
tmpSeriesList
,
target
);
this
.
trimDatapoints
(
tmpSeriesList
,
target
);
this
.
nameSeries
(
tmpSeriesList
,
target
);
this
.
nameSeries
(
tmpSeriesList
,
target
);
for
(
var
y
=
0
;
y
<
tmpSeriesList
.
length
;
y
++
)
{
for
(
let
y
=
0
;
y
<
tmpSeriesList
.
length
;
y
++
)
{
seriesList
.
push
(
tmpSeriesList
[
y
]);
seriesList
.
push
(
tmpSeriesList
[
y
]);
}
}
...
...
public/app/plugins/datasource/elasticsearch/metric_agg.ts
View file @
552a61b6
...
@@ -140,7 +140,7 @@ export class ElasticMetricAggCtrl {
...
@@ -140,7 +140,7 @@ export class ElasticMetricAggCtrl {
$scope
.
updateMovingAvgModelSettings
=
function
()
{
$scope
.
updateMovingAvgModelSettings
=
function
()
{
const
modelSettingsKeys
=
[];
const
modelSettingsKeys
=
[];
const
modelSettings
=
queryDef
.
getMovingAvgSettings
(
$scope
.
agg
.
settings
.
model
,
false
);
const
modelSettings
=
queryDef
.
getMovingAvgSettings
(
$scope
.
agg
.
settings
.
model
,
false
);
for
(
var
i
=
0
;
i
<
modelSettings
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
modelSettings
.
length
;
i
++
)
{
modelSettingsKeys
.
push
(
modelSettings
[
i
].
value
);
modelSettingsKeys
.
push
(
modelSettings
[
i
].
value
);
}
}
...
...
public/app/plugins/datasource/elasticsearch/query_builder.ts
View file @
552a61b6
...
@@ -21,7 +21,7 @@ export class ElasticQueryBuilder {
...
@@ -21,7 +21,7 @@ export class ElasticQueryBuilder {
}
}
buildTermsAgg
(
aggDef
,
queryNode
,
target
)
{
buildTermsAgg
(
aggDef
,
queryNode
,
target
)
{
var
metricRef
,
metric
,
y
;
let
metricRef
,
metric
,
y
;
queryNode
.
terms
=
{
field
:
aggDef
.
field
};
queryNode
.
terms
=
{
field
:
aggDef
.
field
};
if
(
!
aggDef
.
settings
)
{
if
(
!
aggDef
.
settings
)
{
...
@@ -94,9 +94,9 @@ export class ElasticQueryBuilder {
...
@@ -94,9 +94,9 @@ export class ElasticQueryBuilder {
getFiltersAgg
(
aggDef
)
{
getFiltersAgg
(
aggDef
)
{
const
filterObj
=
{};
const
filterObj
=
{};
for
(
var
i
=
0
;
i
<
aggDef
.
settings
.
filters
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
aggDef
.
settings
.
filters
.
length
;
i
++
)
{
const
query
=
aggDef
.
settings
.
filters
[
i
].
query
;
const
query
=
aggDef
.
settings
.
filters
[
i
].
query
;
var
label
=
aggDef
.
settings
.
filters
[
i
].
label
;
let
label
=
aggDef
.
settings
.
filters
[
i
].
label
;
label
=
label
===
''
||
label
===
undefined
?
query
:
label
;
label
=
label
===
''
||
label
===
undefined
?
query
:
label
;
filterObj
[
label
]
=
{
filterObj
[
label
]
=
{
query_string
:
{
query_string
:
{
...
@@ -133,7 +133,7 @@ export class ElasticQueryBuilder {
...
@@ -133,7 +133,7 @@ export class ElasticQueryBuilder {
return
;
return
;
}
}
var
i
,
filter
,
condition
,
queryCondition
;
let
i
,
filter
,
condition
,
queryCondition
;
for
(
i
=
0
;
i
<
adhocFilters
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
adhocFilters
.
length
;
i
++
)
{
filter
=
adhocFilters
[
i
];
filter
=
adhocFilters
[
i
];
...
@@ -181,7 +181,7 @@ export class ElasticQueryBuilder {
...
@@ -181,7 +181,7 @@ export class ElasticQueryBuilder {
target
.
bucketAggs
=
target
.
bucketAggs
||
[{
type
:
'date_histogram'
,
id
:
'2'
,
settings
:
{
interval
:
'auto'
}
}];
target
.
bucketAggs
=
target
.
bucketAggs
||
[{
type
:
'date_histogram'
,
id
:
'2'
,
settings
:
{
interval
:
'auto'
}
}];
target
.
timeField
=
this
.
timeField
;
target
.
timeField
=
this
.
timeField
;
var
i
,
nestedAggs
,
metric
;
let
i
,
nestedAggs
,
metric
;
const
query
=
{
const
query
=
{
size
:
0
,
size
:
0
,
query
:
{
query
:
{
...
@@ -258,7 +258,7 @@ export class ElasticQueryBuilder {
...
@@ -258,7 +258,7 @@ export class ElasticQueryBuilder {
}
}
const
aggField
=
{};
const
aggField
=
{};
var
metricAgg
=
null
;
let
metricAgg
=
null
;
if
(
queryDef
.
isPipelineAgg
(
metric
.
type
))
{
if
(
queryDef
.
isPipelineAgg
(
metric
.
type
))
{
if
(
metric
.
pipelineAgg
&&
/^
\d
*$/
.
test
(
metric
.
pipelineAgg
))
{
if
(
metric
.
pipelineAgg
&&
/^
\d
*$/
.
test
(
metric
.
pipelineAgg
))
{
...
@@ -302,7 +302,7 @@ export class ElasticQueryBuilder {
...
@@ -302,7 +302,7 @@ export class ElasticQueryBuilder {
});
});
}
}
var
size
=
500
;
let
size
=
500
;
if
(
queryDef
.
size
)
{
if
(
queryDef
.
size
)
{
size
=
queryDef
.
size
;
size
=
queryDef
.
size
;
}
}
...
...
public/app/plugins/datasource/elasticsearch/query_ctrl.ts
View file @
552a61b6
...
@@ -43,7 +43,7 @@ export class ElasticQueryCtrl extends QueryCtrl {
...
@@ -43,7 +43,7 @@ export class ElasticQueryCtrl extends QueryCtrl {
const
bucketAggs
=
this
.
target
.
bucketAggs
;
const
bucketAggs
=
this
.
target
.
bucketAggs
;
const
metricAggTypes
=
queryDef
.
getMetricAggTypes
(
this
.
esVersion
);
const
metricAggTypes
=
queryDef
.
getMetricAggTypes
(
this
.
esVersion
);
const
bucketAggTypes
=
queryDef
.
bucketAggTypes
;
const
bucketAggTypes
=
queryDef
.
bucketAggTypes
;
var
text
=
''
;
let
text
=
''
;
if
(
this
.
target
.
query
)
{
if
(
this
.
target
.
query
)
{
text
+=
'Query: '
+
this
.
target
.
query
+
', '
;
text
+=
'Query: '
+
this
.
target
.
query
+
', '
;
...
...
public/app/plugins/datasource/graphite/add_graphite_func.ts
View file @
552a61b6
...
@@ -35,7 +35,7 @@ export function graphiteAddFunc($compile) {
...
@@ -35,7 +35,7 @@ export function graphiteAddFunc($compile) {
minLength
:
1
,
minLength
:
1
,
items
:
10
,
items
:
10
,
updater
:
function
(
value
)
{
updater
:
function
(
value
)
{
var
funcDef
=
ctrl
.
datasource
.
getFuncDef
(
value
);
let
funcDef
=
ctrl
.
datasource
.
getFuncDef
(
value
);
if
(
!
funcDef
)
{
if
(
!
funcDef
)
{
// try find close match
// try find close match
value
=
value
.
toLowerCase
();
value
=
value
.
toLowerCase
();
...
@@ -81,7 +81,7 @@ export function graphiteAddFunc($compile) {
...
@@ -81,7 +81,7 @@ export function graphiteAddFunc($compile) {
$compile
(
elem
.
contents
())(
$scope
);
$compile
(
elem
.
contents
())(
$scope
);
});
});
var
drop
;
let
drop
;
const
cleanUpDrop
=
function
()
{
const
cleanUpDrop
=
function
()
{
if
(
drop
)
{
if
(
drop
)
{
drop
.
destroy
();
drop
.
destroy
();
...
@@ -93,7 +93,7 @@ export function graphiteAddFunc($compile) {
...
@@ -93,7 +93,7 @@ export function graphiteAddFunc($compile) {
.
on
(
'mouseenter'
,
'ul.dropdown-menu li'
,
function
()
{
.
on
(
'mouseenter'
,
'ul.dropdown-menu li'
,
function
()
{
cleanUpDrop
();
cleanUpDrop
();
var
funcDef
;
let
funcDef
;
try
{
try
{
funcDef
=
ctrl
.
datasource
.
getFuncDef
(
$
(
'a'
,
this
).
text
());
funcDef
=
ctrl
.
datasource
.
getFuncDef
(
$
(
'a'
,
this
).
text
());
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -101,7 +101,7 @@ export function graphiteAddFunc($compile) {
...
@@ -101,7 +101,7 @@ export function graphiteAddFunc($compile) {
}
}
if
(
funcDef
&&
funcDef
.
description
)
{
if
(
funcDef
&&
funcDef
.
description
)
{
var
shortDesc
=
funcDef
.
description
;
let
shortDesc
=
funcDef
.
description
;
if
(
shortDesc
.
length
>
500
)
{
if
(
shortDesc
.
length
>
500
)
{
shortDesc
=
shortDesc
.
substring
(
0
,
497
)
+
'...'
;
shortDesc
=
shortDesc
.
substring
(
0
,
497
)
+
'...'
;
}
}
...
...
public/app/plugins/datasource/graphite/datasource.ts
View file @
552a61b6
...
@@ -74,9 +74,9 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
...
@@ -74,9 +74,9 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
if
(
!
result
||
!
result
.
data
)
{
if
(
!
result
||
!
result
.
data
)
{
return
[];
return
[];
}
}
for
(
var
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
const
series
=
result
.
data
[
i
];
const
series
=
result
.
data
[
i
];
for
(
var
y
=
0
;
y
<
series
.
datapoints
.
length
;
y
++
)
{
for
(
let
y
=
0
;
y
<
series
.
datapoints
.
length
;
y
++
)
{
series
.
datapoints
[
y
][
1
]
*=
1000
;
series
.
datapoints
[
y
][
1
]
*=
1000
;
}
}
}
}
...
@@ -109,10 +109,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
...
@@ -109,10 +109,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
return
this
.
query
(
graphiteQuery
).
then
(
function
(
result
)
{
return
this
.
query
(
graphiteQuery
).
then
(
function
(
result
)
{
const
list
=
[];
const
list
=
[];
for
(
var
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
const
target
=
result
.
data
[
i
];
const
target
=
result
.
data
[
i
];
for
(
var
y
=
0
;
y
<
target
.
datapoints
.
length
;
y
++
)
{
for
(
let
y
=
0
;
y
<
target
.
datapoints
.
length
;
y
++
)
{
const
datapoint
=
target
.
datapoints
[
y
];
const
datapoint
=
target
.
datapoints
[
y
];
if
(
!
datapoint
[
0
])
{
if
(
!
datapoint
[
0
])
{
continue
;
continue
;
...
@@ -133,10 +133,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
...
@@ -133,10 +133,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
const
tags
=
templateSrv
.
replace
(
options
.
annotation
.
tags
);
const
tags
=
templateSrv
.
replace
(
options
.
annotation
.
tags
);
return
this
.
events
({
range
:
options
.
rangeRaw
,
tags
:
tags
}).
then
(
results
=>
{
return
this
.
events
({
range
:
options
.
rangeRaw
,
tags
:
tags
}).
then
(
results
=>
{
const
list
=
[];
const
list
=
[];
for
(
var
i
=
0
;
i
<
results
.
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
results
.
data
.
length
;
i
++
)
{
const
e
=
results
.
data
[
i
];
const
e
=
results
.
data
[
i
];
var
tags
=
e
.
tags
;
let
tags
=
e
.
tags
;
if
(
_
.
isString
(
e
.
tags
))
{
if
(
_
.
isString
(
e
.
tags
))
{
tags
=
this
.
parseTags
(
e
.
tags
);
tags
=
this
.
parseTags
(
e
.
tags
);
}
}
...
@@ -157,7 +157,7 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
...
@@ -157,7 +157,7 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
this
.
events
=
function
(
options
)
{
this
.
events
=
function
(
options
)
{
try
{
try
{
var
tags
=
''
;
let
tags
=
''
;
if
(
options
.
tags
)
{
if
(
options
.
tags
)
{
tags
=
'&tags='
+
options
.
tags
;
tags
=
'&tags='
+
options
.
tags
;
}
}
...
@@ -493,10 +493,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
...
@@ -493,10 +493,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
const
graphite_options
=
[
'from'
,
'until'
,
'rawData'
,
'format'
,
'maxDataPoints'
,
'cacheTimeout'
];
const
graphite_options
=
[
'from'
,
'until'
,
'rawData'
,
'format'
,
'maxDataPoints'
,
'cacheTimeout'
];
const
clean_options
=
[],
const
clean_options
=
[],
targets
=
{};
targets
=
{};
var
target
,
targetValue
,
i
;
let
target
,
targetValue
,
i
;
const
regex
=
/
\#([
A-Z
])
/g
;
const
regex
=
/
\#([
A-Z
])
/g
;
const
intervalFormatFixRegex
=
/'
(\d
+
)
m'/gi
;
const
intervalFormatFixRegex
=
/'
(\d
+
)
m'/gi
;
var
hasTargets
=
false
;
let
hasTargets
=
false
;
options
[
'format'
]
=
'json'
;
options
[
'format'
]
=
'json'
;
...
...
public/app/plugins/datasource/graphite/func_editor.ts
View file @
552a61b6
...
@@ -24,9 +24,9 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -24,9 +24,9 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
const
$funcControls
=
$
(
funcControlsTemplate
);
const
$funcControls
=
$
(
funcControlsTemplate
);
const
ctrl
=
$scope
.
ctrl
;
const
ctrl
=
$scope
.
ctrl
;
const
func
=
$scope
.
func
;
const
func
=
$scope
.
func
;
var
scheduledRelink
=
false
;
let
scheduledRelink
=
false
;
var
paramCountAtLink
=
0
;
let
paramCountAtLink
=
0
;
var
cancelBlur
=
null
;
let
cancelBlur
=
null
;
function
clickFuncParam
(
paramIndex
)
{
function
clickFuncParam
(
paramIndex
)
{
/*jshint validthis:true */
/*jshint validthis:true */
...
@@ -133,7 +133,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -133,7 +133,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
function
addTypeahead
(
$input
,
paramIndex
)
{
function
addTypeahead
(
$input
,
paramIndex
)
{
$input
.
attr
(
'data-provide'
,
'typeahead'
);
$input
.
attr
(
'data-provide'
,
'typeahead'
);
var
options
=
paramDef
(
paramIndex
).
options
;
let
options
=
paramDef
(
paramIndex
).
options
;
if
(
paramDef
(
paramIndex
).
type
===
'int'
)
{
if
(
paramDef
(
paramIndex
).
type
===
'int'
)
{
options
=
_
.
map
(
options
,
function
(
val
)
{
options
=
_
.
map
(
options
,
function
(
val
)
{
return
val
.
toString
();
return
val
.
toString
();
...
@@ -190,7 +190,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
...
@@ -190,7 +190,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
return
false
;
return
false
;
}
}
var
paramValue
=
templateSrv
.
highlightVariablesAsHtml
(
func
.
params
[
index
]);
let
paramValue
=
templateSrv
.
highlightVariablesAsHtml
(
func
.
params
[
index
]);
const
last
=
index
>=
func
.
params
.
length
-
1
&&
param
.
optional
&&
!
paramValue
;
const
last
=
index
>=
func
.
params
.
length
-
1
&&
param
.
optional
&&
!
paramValue
;
if
(
last
&&
param
.
multiple
)
{
if
(
last
&&
param
.
multiple
)
{
...
...
public/app/plugins/datasource/graphite/gfunc.ts
View file @
552a61b6
...
@@ -967,7 +967,7 @@ export class FuncInstance {
...
@@ -967,7 +967,7 @@ export class FuncInstance {
const
parameters
=
_
.
map
(
const
parameters
=
_
.
map
(
this
.
params
,
this
.
params
,
function
(
value
,
index
)
{
function
(
value
,
index
)
{
var
paramType
;
let
paramType
;
if
(
index
<
this
.
def
.
params
.
length
)
{
if
(
index
<
this
.
def
.
params
.
length
)
{
paramType
=
this
.
def
.
params
[
index
].
type
;
paramType
=
this
.
def
.
params
[
index
].
type
;
}
else
if
(
_
.
get
(
_
.
last
(
this
.
def
.
params
),
'multiple'
))
{
}
else
if
(
_
.
get
(
_
.
last
(
this
.
def
.
params
),
'multiple'
))
{
...
@@ -1041,7 +1041,7 @@ export class FuncInstance {
...
@@ -1041,7 +1041,7 @@ export class FuncInstance {
return
;
return
;
}
}
var
text
=
this
.
def
.
name
+
'('
;
let
text
=
this
.
def
.
name
+
'('
;
text
+=
this
.
params
.
join
(
', '
);
text
+=
this
.
params
.
join
(
', '
);
text
+=
')'
;
text
+=
')'
;
this
.
text
=
text
;
this
.
text
=
text
;
...
@@ -1086,7 +1086,7 @@ function parseFuncDefs(rawDefs) {
...
@@ -1086,7 +1086,7 @@ function parseFuncDefs(rawDefs) {
return
;
return
;
}
}
var
description
=
funcDef
.
description
;
let
description
=
funcDef
.
description
;
if
(
description
)
{
if
(
description
)
{
// tidy up some pydoc syntax that rst2html can't handle
// tidy up some pydoc syntax that rst2html can't handle
description
=
description
description
=
description
...
...
public/app/plugins/datasource/graphite/graphite_query.ts
View file @
552a61b6
...
@@ -179,7 +179,7 @@ export default class GraphiteQuery {
...
@@ -179,7 +179,7 @@ export default class GraphiteQuery {
delete
targetsByRefId
[
target
.
refId
];
delete
targetsByRefId
[
target
.
refId
];
const
nestedSeriesRefRegex
=
/
\#([
A-Z
])
/g
;
const
nestedSeriesRefRegex
=
/
\#([
A-Z
])
/g
;
var
targetWithNestedQueries
=
target
.
target
;
let
targetWithNestedQueries
=
target
.
target
;
// Use ref count to track circular references
// Use ref count to track circular references
function
countTargetRefs
(
targetsByRefId
,
refId
)
{
function
countTargetRefs
(
targetsByRefId
,
refId
)
{
...
...
public/app/plugins/datasource/graphite/lexer.ts
View file @
552a61b6
...
@@ -900,7 +900,7 @@ const unicodeLetterTable = [
...
@@ -900,7 +900,7 @@ const unicodeLetterTable = [
const
identifierStartTable
=
[];
const
identifierStartTable
=
[];
for
(
var
i
=
0
;
i
<
128
;
i
++
)
{
for
(
let
i
=
0
;
i
<
128
;
i
++
)
{
identifierStartTable
[
i
]
=
identifierStartTable
[
i
]
=
(
i
>=
48
&&
i
<=
57
)
||
// 0-9
(
i
>=
48
&&
i
<=
57
)
||
// 0-9
i
===
36
||
// $
i
===
36
||
// $
...
@@ -941,7 +941,7 @@ Lexer.prototype = {
...
@@ -941,7 +941,7 @@ Lexer.prototype = {
tokenize
:
function
()
{
tokenize
:
function
()
{
const
list
=
[];
const
list
=
[];
var
token
;
let
token
;
while
((
token
=
this
.
next
()))
{
while
((
token
=
this
.
next
()))
{
list
.
push
(
token
);
list
.
push
(
token
);
}
}
...
@@ -964,7 +964,7 @@ Lexer.prototype = {
...
@@ -964,7 +964,7 @@ Lexer.prototype = {
}
}
}
}
var
match
=
this
.
scanStringLiteral
();
let
match
=
this
.
scanStringLiteral
();
if
(
match
)
{
if
(
match
)
{
return
match
;
return
match
;
}
}
...
@@ -1007,9 +1007,9 @@ Lexer.prototype = {
...
@@ -1007,9 +1007,9 @@ Lexer.prototype = {
* (true/false) and NullLiteral (null).
* (true/false) and NullLiteral (null).
*/
*/
scanIdentifier
:
function
()
{
scanIdentifier
:
function
()
{
var
id
=
''
;
let
id
=
''
;
var
index
=
0
;
let
index
=
0
;
var
type
,
char
;
let
type
,
char
;
// Detects any character in the Unicode categories "Uppercase
// Detects any character in the Unicode categories "Uppercase
// letter (Lu)", "Lowercase letter (Ll)", "Titlecase letter
// letter (Lu)", "Lowercase letter (Ll)", "Titlecase letter
...
@@ -1020,7 +1020,7 @@ Lexer.prototype = {
...
@@ -1020,7 +1020,7 @@ Lexer.prototype = {
// Google's Traceur.
// Google's Traceur.
function
isUnicodeLetter
(
code
)
{
function
isUnicodeLetter
(
code
)
{
for
(
var
i
=
0
;
i
<
unicodeLetterTable
.
length
;
)
{
for
(
let
i
=
0
;
i
<
unicodeLetterTable
.
length
;
)
{
if
(
code
<
unicodeLetterTable
[
i
++
])
{
if
(
code
<
unicodeLetterTable
[
i
++
])
{
return
false
;
return
false
;
}
}
...
@@ -1049,7 +1049,7 @@ Lexer.prototype = {
...
@@ -1049,7 +1049,7 @@ Lexer.prototype = {
const
ch2
=
this
.
peek
(
index
+
2
);
const
ch2
=
this
.
peek
(
index
+
2
);
const
ch3
=
this
.
peek
(
index
+
3
);
const
ch3
=
this
.
peek
(
index
+
3
);
const
ch4
=
this
.
peek
(
index
+
4
);
const
ch4
=
this
.
peek
(
index
+
4
);
var
code
;
let
code
;
if
(
isHexDigit
(
ch1
)
&&
isHexDigit
(
ch2
)
&&
isHexDigit
(
ch3
)
&&
isHexDigit
(
ch4
))
{
if
(
isHexDigit
(
ch1
)
&&
isHexDigit
(
ch2
)
&&
isHexDigit
(
ch3
)
&&
isHexDigit
(
ch4
))
{
code
=
parseInt
(
ch1
+
ch2
+
ch3
+
ch4
,
16
);
code
=
parseInt
(
ch1
+
ch2
+
ch3
+
ch4
,
16
);
...
@@ -1168,11 +1168,11 @@ Lexer.prototype = {
...
@@ -1168,11 +1168,11 @@ Lexer.prototype = {
* scanNumericLiteral function in the Esprima parser's source code.
* scanNumericLiteral function in the Esprima parser's source code.
*/
*/
scanNumericLiteral
:
function
():
any
{
scanNumericLiteral
:
function
():
any
{
var
index
=
0
;
let
index
=
0
;
var
value
=
''
;
let
value
=
''
;
const
length
=
this
.
input
.
length
;
const
length
=
this
.
input
.
length
;
var
char
=
this
.
peek
(
index
);
let
char
=
this
.
peek
(
index
);
var
bad
;
let
bad
;
function
isDecimalDigit
(
str
)
{
function
isDecimalDigit
(
str
)
{
return
/^
[
0-9
]
$/
.
test
(
str
);
return
/^
[
0-9
]
$/
.
test
(
str
);
...
@@ -1418,7 +1418,7 @@ Lexer.prototype = {
...
@@ -1418,7 +1418,7 @@ Lexer.prototype = {
return null;
return null;
}
}
var
value = '';
let
value = '';
this.skip();
this.skip();
...
...
public/app/plugins/datasource/graphite/parser.ts
View file @
552a61b6
...
@@ -26,7 +26,7 @@ Parser.prototype = {
...
@@ -26,7 +26,7 @@ Parser.prototype = {
curlyBraceSegment
:
function
()
{
curlyBraceSegment
:
function
()
{
if
(
this
.
match
(
'identifier'
,
'{'
)
||
this
.
match
(
'{'
))
{
if
(
this
.
match
(
'identifier'
,
'{'
)
||
this
.
match
(
'{'
))
{
var
curlySegment
=
''
;
let
curlySegment
=
''
;
while
(
!
this
.
match
(
''
)
&&
!
this
.
match
(
'}'
))
{
while
(
!
this
.
match
(
''
)
&&
!
this
.
match
(
'}'
))
{
curlySegment
+=
this
.
consumeToken
().
value
;
curlySegment
+=
this
.
consumeToken
().
value
;
...
...
public/app/plugins/datasource/graphite/query_ctrl.ts
View file @
552a61b6
...
@@ -106,7 +106,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
...
@@ -106,7 +106,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
}
}
getAltSegments
(
index
,
prefix
)
{
getAltSegments
(
index
,
prefix
)
{
var
query
=
prefix
&&
prefix
.
length
>
0
?
'*'
+
prefix
+
'*'
:
'*'
;
let
query
=
prefix
&&
prefix
.
length
>
0
?
'*'
+
prefix
+
'*'
:
'*'
;
if
(
index
>
0
)
{
if
(
index
>
0
)
{
query
=
this
.
queryModel
.
getSegmentPathUpTo
(
index
)
+
'.'
+
query
;
query
=
this
.
queryModel
.
getSegmentPathUpTo
(
index
)
+
'.'
+
query
;
}
}
...
@@ -291,7 +291,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
...
@@ -291,7 +291,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
return
;
return
;
}
}
for
(
var
i
=
0
;
i
<
this
.
segments
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
segments
.
length
;
i
++
)
{
if
(
this
.
segments
[
i
].
value
.
indexOf
(
'*'
)
>=
0
)
{
if
(
this
.
segments
[
i
].
value
.
indexOf
(
'*'
)
>=
0
)
{
func
.
params
[
0
]
=
i
;
func
.
params
[
0
]
=
i
;
func
.
added
=
false
;
func
.
added
=
false
;
...
...
public/app/plugins/datasource/influxdb/datasource.ts
View file @
552a61b6
...
@@ -40,14 +40,14 @@ export default class InfluxDatasource {
...
@@ -40,14 +40,14 @@ export default class InfluxDatasource {
}
}
query
(
options
)
{
query
(
options
)
{
var
timeFilter
=
this
.
getTimeFilter
(
options
);
let
timeFilter
=
this
.
getTimeFilter
(
options
);
const
scopedVars
=
options
.
scopedVars
;
const
scopedVars
=
options
.
scopedVars
;
const
targets
=
_
.
cloneDeep
(
options
.
targets
);
const
targets
=
_
.
cloneDeep
(
options
.
targets
);
const
queryTargets
=
[];
const
queryTargets
=
[];
var
queryModel
;
let
queryModel
;
var
i
,
y
;
let
i
,
y
;
var
allQueries
=
_
.
map
(
targets
,
target
=>
{
let
allQueries
=
_
.
map
(
targets
,
target
=>
{
if
(
target
.
hide
)
{
if
(
target
.
hide
)
{
return
''
;
return
''
;
}
}
...
@@ -95,7 +95,7 @@ export default class InfluxDatasource {
...
@@ -95,7 +95,7 @@ export default class InfluxDatasource {
}
}
const
target
=
queryTargets
[
i
];
const
target
=
queryTargets
[
i
];
var
alias
=
target
.
alias
;
let
alias
=
target
.
alias
;
if
(
alias
)
{
if
(
alias
)
{
alias
=
this
.
templateSrv
.
replace
(
target
.
alias
,
options
.
scopedVars
);
alias
=
this
.
templateSrv
.
replace
(
target
.
alias
,
options
.
scopedVars
);
}
}
...
@@ -132,7 +132,7 @@ export default class InfluxDatasource {
...
@@ -132,7 +132,7 @@ export default class InfluxDatasource {
}
}
const
timeFilter
=
this
.
getTimeFilter
({
rangeRaw
:
options
.
rangeRaw
});
const
timeFilter
=
this
.
getTimeFilter
({
rangeRaw
:
options
.
rangeRaw
});
var
query
=
options
.
annotation
.
query
.
replace
(
'$timeFilter'
,
timeFilter
);
let
query
=
options
.
annotation
.
query
.
replace
(
'$timeFilter'
,
timeFilter
);
query
=
this
.
templateSrv
.
replace
(
query
,
null
,
'regex'
);
query
=
this
.
templateSrv
.
replace
(
query
,
null
,
'regex'
);
return
this
.
_seriesQuery
(
query
,
options
).
then
(
data
=>
{
return
this
.
_seriesQuery
(
query
,
options
).
then
(
data
=>
{
...
...
public/app/plugins/datasource/influxdb/influx_query.ts
View file @
552a61b6
...
@@ -125,9 +125,9 @@ export default class InfluxQuery {
...
@@ -125,9 +125,9 @@ export default class InfluxQuery {
}
}
private
renderTagCondition
(
tag
,
index
,
interpolate
)
{
private
renderTagCondition
(
tag
,
index
,
interpolate
)
{
var
str
=
''
;
let
str
=
''
;
var
operator
=
tag
.
operator
;
let
operator
=
tag
.
operator
;
var
value
=
tag
.
value
;
let
value
=
tag
.
value
;
if
(
index
>
0
)
{
if
(
index
>
0
)
{
str
=
(
tag
.
condition
||
'AND'
)
+
' '
;
str
=
(
tag
.
condition
||
'AND'
)
+
' '
;
}
}
...
@@ -156,8 +156,8 @@ export default class InfluxQuery {
...
@@ -156,8 +156,8 @@ export default class InfluxQuery {
}
}
getMeasurementAndPolicy(interpolate) {
getMeasurementAndPolicy(interpolate) {
var
policy = this.target.policy;
let
policy = this.target.policy;
var
measurement = this.target.measurement || 'measurement';
let
measurement = this.target.measurement || 'measurement';
if (!measurement.match('^/.*/$')) {
if (!measurement.match('^/.*/$')) {
measurement = '"
' + measurement + '
"';
measurement = '"
' + measurement + '
"';
...
@@ -199,11 +199,11 @@ export default class InfluxQuery {
...
@@ -199,11 +199,11 @@ export default class InfluxQuery {
}
}
}
}
var
query = 'SELECT ';
let
query = 'SELECT ';
var
i, y;
let
i, y;
for (i = 0; i < this.selectModels.length; i++) {
for (i = 0; i < this.selectModels.length; i++) {
const parts = this.selectModels[i];
const parts = this.selectModels[i];
var
selectText = '';
let
selectText = '';
for (y = 0; y < parts.length; y++) {
for (y = 0; y < parts.length; y++) {
const part = parts[y];
const part = parts[y];
selectText = part.render(selectText);
selectText = part.render(selectText);
...
@@ -226,7 +226,7 @@ export default class InfluxQuery {
...
@@ -226,7 +226,7 @@ export default class InfluxQuery {
query += '$timeFilter';
query += '$timeFilter';
var
groupBySection = '';
let
groupBySection = '';
for (i = 0; i < this.groupByParts.length; i++) {
for (i = 0; i < this.groupByParts.length; i++) {
const part = this.groupByParts[i];
const part = this.groupByParts[i];
if (i > 0) {
if (i > 0) {
...
...
public/app/plugins/datasource/influxdb/influx_series.ts
View file @
552a61b6
...
@@ -14,7 +14,7 @@ export default class InfluxSeries {
...
@@ -14,7 +14,7 @@ export default class InfluxSeries {
getTimeSeries
()
{
getTimeSeries
()
{
const
output
=
[];
const
output
=
[];
var
i
,
j
;
let
i
,
j
;
if
(
this
.
series
.
length
===
0
)
{
if
(
this
.
series
.
length
===
0
)
{
return
output
;
return
output
;
...
@@ -27,7 +27,7 @@ export default class InfluxSeries {
...
@@ -27,7 +27,7 @@ export default class InfluxSeries {
});
});
for
(
j
=
1
;
j
<
columns
;
j
++
)
{
for
(
j
=
1
;
j
<
columns
;
j
++
)
{
var
seriesName
=
series
.
name
;
let
seriesName
=
series
.
name
;
const
columnName
=
series
.
columns
[
j
];
const
columnName
=
series
.
columns
[
j
];
if
(
columnName
!==
'value'
)
{
if
(
columnName
!==
'value'
)
{
seriesName
=
seriesName
+
'.'
+
columnName
;
seriesName
=
seriesName
+
'.'
+
columnName
;
...
@@ -86,10 +86,10 @@ export default class InfluxSeries {
...
@@ -86,10 +86,10 @@ export default class InfluxSeries {
const
list
=
[];
const
list
=
[];
_
.
each
(
this
.
series
,
series
=>
{
_
.
each
(
this
.
series
,
series
=>
{
var
titleCol
=
null
;
let
titleCol
=
null
;
var
timeCol
=
null
;
let
timeCol
=
null
;
const
tagsCol
=
[];
const
tagsCol
=
[];
var
textCol
=
null
;
let
textCol
=
null
;
_
.
each
(
series
.
columns
,
(
column
,
index
)
=>
{
_
.
each
(
series
.
columns
,
(
column
,
index
)
=>
{
if
(
column
===
'time'
)
{
if
(
column
===
'time'
)
{
...
@@ -143,7 +143,7 @@ export default class InfluxSeries {
...
@@ -143,7 +143,7 @@ export default class InfluxSeries {
getTable
()
{
getTable
()
{
const
table
=
new
TableModel
();
const
table
=
new
TableModel
();
var
i
,
j
;
let
i
,
j
;
if
(
this
.
series
.
length
===
0
)
{
if
(
this
.
series
.
length
===
0
)
{
return
table
;
return
table
;
...
...
public/app/plugins/datasource/influxdb/query_builder.ts
View file @
552a61b6
import
_
from
'lodash'
;
import
_
from
'lodash'
;
function
renderTagCondition
(
tag
,
index
)
{
function
renderTagCondition
(
tag
,
index
)
{
var
str
=
''
;
let
str
=
''
;
var
operator
=
tag
.
operator
;
let
operator
=
tag
.
operator
;
var
value
=
tag
.
value
;
let
value
=
tag
.
value
;
if
(
index
>
0
)
{
if
(
index
>
0
)
{
str
=
(
tag
.
condition
||
'AND'
)
+
' '
;
str
=
(
tag
.
condition
||
'AND'
)
+
' '
;
}
}
...
@@ -28,9 +28,9 @@ export class InfluxQueryBuilder {
...
@@ -28,9 +28,9 @@ export class InfluxQueryBuilder {
constructor
(
private
target
,
private
database
?)
{}
constructor
(
private
target
,
private
database
?)
{}
buildExploreQuery
(
type
:
string
,
withKey
?:
string
,
withMeasurementFilter
?:
string
)
{
buildExploreQuery
(
type
:
string
,
withKey
?:
string
,
withMeasurementFilter
?:
string
)
{
var
query
;
let
query
;
var
measurement
;
let
measurement
;
var
policy
;
let
policy
;
if
(
type
===
'TAG_KEYS'
)
{
if
(
type
===
'TAG_KEYS'
)
{
query
=
'SHOW TAG KEYS'
;
query
=
'SHOW TAG KEYS'
;
...
...
public/app/plugins/datasource/influxdb/query_ctrl.ts
View file @
552a61b6
...
@@ -279,7 +279,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
...
@@ -279,7 +279,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
}
}
}
}
var
query
,
addTemplateVars
;
let
query
,
addTemplateVars
;
if
(
segment
.
type
===
'key'
||
segment
.
type
===
'plus-button'
)
{
if
(
segment
.
type
===
'key'
||
segment
.
type
===
'plus-button'
)
{
query
=
this
.
queryBuilder
.
buildExploreQuery
(
'TAG_KEYS'
);
query
=
this
.
queryBuilder
.
buildExploreQuery
(
'TAG_KEYS'
);
addTemplateVars
=
false
;
addTemplateVars
=
false
;
...
@@ -343,8 +343,8 @@ export class InfluxQueryCtrl extends QueryCtrl {
...
@@ -343,8 +343,8 @@ export class InfluxQueryCtrl extends QueryCtrl {
rebuildTargetTagConditions
()
{
rebuildTargetTagConditions
()
{
const
tags
=
[];
const
tags
=
[];
var
tagIndex
=
0
;
let
tagIndex
=
0
;
var
tagOperator
=
''
;
let
tagOperator
=
''
;
_
.
each
(
this
.
tagSegments
,
(
segment2
,
index
)
=>
{
_
.
each
(
this
.
tagSegments
,
(
segment2
,
index
)
=>
{
if
(
segment2
.
type
===
'key'
)
{
if
(
segment2
.
type
===
'key'
)
{
...
...
public/app/plugins/datasource/influxdb/query_part.ts
View file @
552a61b6
...
@@ -41,7 +41,7 @@ function fieldRenderer(part, innerExpr) {
...
@@ -41,7 +41,7 @@ function fieldRenderer(part, innerExpr) {
function
replaceAggregationAddStrategy
(
selectParts
,
partModel
)
{
function
replaceAggregationAddStrategy
(
selectParts
,
partModel
)
{
// look for existing aggregation
// look for existing aggregation
for
(
var
i
=
0
;
i
<
selectParts
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
selectParts
.
length
;
i
++
)
{
const
part
=
selectParts
[
i
];
const
part
=
selectParts
[
i
];
if
(
part
.
def
.
category
===
categories
.
Aggregations
)
{
if
(
part
.
def
.
category
===
categories
.
Aggregations
)
{
if
(
part
.
def
.
type
===
partModel
.
def
.
type
)
{
if
(
part
.
def
.
type
===
partModel
.
def
.
type
)
{
...
@@ -79,7 +79,7 @@ function replaceAggregationAddStrategy(selectParts, partModel) {
...
@@ -79,7 +79,7 @@ function replaceAggregationAddStrategy(selectParts, partModel) {
}
}
function
addTransformationStrategy
(
selectParts
,
partModel
)
{
function
addTransformationStrategy
(
selectParts
,
partModel
)
{
var
i
;
let
i
;
// look for index to add transformation
// look for index to add transformation
for
(
i
=
0
;
i
<
selectParts
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
selectParts
.
length
;
i
++
)
{
const
part
=
selectParts
[
i
];
const
part
=
selectParts
[
i
];
...
...
public/app/plugins/datasource/opentsdb/datasource.ts
View file @
552a61b6
...
@@ -114,7 +114,7 @@ export default class OpenTsDatasource {
...
@@ -114,7 +114,7 @@ export default class OpenTsDatasource {
return
this
.
performTimeSeriesQuery
(
queries
,
start
,
end
).
then
(
return
this
.
performTimeSeriesQuery
(
queries
,
start
,
end
).
then
(
function
(
results
)
{
function
(
results
)
{
if
(
results
.
data
[
0
])
{
if
(
results
.
data
[
0
])
{
var
annotationObject
=
results
.
data
[
0
].
annotations
;
let
annotationObject
=
results
.
data
[
0
].
annotations
;
if
(
options
.
annotation
.
isGlobal
)
{
if
(
options
.
annotation
.
isGlobal
)
{
annotationObject
=
results
.
data
[
0
].
globalAnnotations
;
annotationObject
=
results
.
data
[
0
].
globalAnnotations
;
}
}
...
@@ -137,7 +137,7 @@ export default class OpenTsDatasource {
...
@@ -137,7 +137,7 @@ export default class OpenTsDatasource {
targetContainsTemplate
(
target
)
{
targetContainsTemplate
(
target
)
{
if
(
target
.
filters
&&
target
.
filters
.
length
>
0
)
{
if
(
target
.
filters
&&
target
.
filters
.
length
>
0
)
{
for
(
var
i
=
0
;
i
<
target
.
filters
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
target
.
filters
.
length
;
i
++
)
{
if
(
this
.
templateSrv
.
variableExists
(
target
.
filters
[
i
].
filter
))
{
if
(
this
.
templateSrv
.
variableExists
(
target
.
filters
[
i
].
filter
))
{
return
true
;
return
true
;
}
}
...
@@ -156,7 +156,7 @@ export default class OpenTsDatasource {
...
@@ -156,7 +156,7 @@ export default class OpenTsDatasource {
}
}
performTimeSeriesQuery
(
queries
,
start
,
end
)
{
performTimeSeriesQuery
(
queries
,
start
,
end
)
{
var
msResolution
=
false
;
let
msResolution
=
false
;
if
(
this
.
tsdbResolution
===
2
)
{
if
(
this
.
tsdbResolution
===
2
)
{
msResolution
=
true
;
msResolution
=
true
;
}
}
...
@@ -213,7 +213,7 @@ export default class OpenTsDatasource {
...
@@ -213,7 +213,7 @@ export default class OpenTsDatasource {
return
key
.
trim
();
return
key
.
trim
();
});
});
const
key
=
keysArray
[
0
];
const
key
=
keysArray
[
0
];
var
keysQuery
=
key
+
'=*'
;
let
keysQuery
=
key
+
'=*'
;
if
(
keysArray
.
length
>
1
)
{
if
(
keysArray
.
length
>
1
)
{
keysQuery
+=
','
+
keysArray
.
splice
(
1
).
join
(
','
);
keysQuery
+=
','
+
keysArray
.
splice
(
1
).
join
(
','
);
...
@@ -278,7 +278,7 @@ export default class OpenTsDatasource {
...
@@ -278,7 +278,7 @@ export default class OpenTsDatasource {
return
this
.
$q
.
when
([]);
return
this
.
$q
.
when
([]);
}
}
var
interpolated
;
let
interpolated
;
try
{
try
{
interpolated
=
this
.
templateSrv
.
replace
(
query
,
{},
'distributed'
);
interpolated
=
this
.
templateSrv
.
replace
(
query
,
{},
'distributed'
);
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -385,7 +385,7 @@ export default class OpenTsDatasource {
...
@@ -385,7 +385,7 @@ export default class OpenTsDatasource {
return
this
.
templateSrv
.
replace
(
target
.
alias
,
scopedVars
);
return
this
.
templateSrv
.
replace
(
target
.
alias
,
scopedVars
);
}
}
var
label
=
md
.
metric
;
let
label
=
md
.
metric
;
const
tagData
=
[];
const
tagData
=
[];
if
(
!
_
.
isEmpty
(
md
.
tags
))
{
if
(
!
_
.
isEmpty
(
md
.
tags
))
{
...
@@ -438,7 +438,7 @@ export default class OpenTsDatasource {
...
@@ -438,7 +438,7 @@ export default class OpenTsDatasource {
}
}
if
(
!
target
.
disableDownsampling
)
{
if
(
!
target
.
disableDownsampling
)
{
var
interval
=
this
.
templateSrv
.
replace
(
target
.
downsampleInterval
||
options
.
interval
);
let
interval
=
this
.
templateSrv
.
replace
(
target
.
downsampleInterval
||
options
.
interval
);
if
(
interval
.
match
(
/
\.[
0-9
]
+s/
))
{
if
(
interval
.
match
(
/
\.[
0-9
]
+s/
))
{
interval
=
parseFloat
(
interval
)
*
1000
+
'ms'
;
interval
=
parseFloat
(
interval
)
*
1000
+
'ms'
;
...
@@ -479,7 +479,7 @@ export default class OpenTsDatasource {
...
@@ -479,7 +479,7 @@ export default class OpenTsDatasource {
}
}
mapMetricsToTargets
(
metrics
,
options
,
tsdbVersion
)
{
mapMetricsToTargets
(
metrics
,
options
,
tsdbVersion
)
{
var
interpolatedTagValue
,
arrTagV
;
let
interpolatedTagValue
,
arrTagV
;
return
_
.
map
(
metrics
,
metricData
=>
{
return
_
.
map
(
metrics
,
metricData
=>
{
if
(
tsdbVersion
===
3
)
{
if
(
tsdbVersion
===
3
)
{
return
metricData
.
query
.
index
;
return
metricData
.
query
.
index
;
...
...
public/app/plugins/datasource/prometheus/completer.ts
View file @
552a61b6
...
@@ -294,9 +294,9 @@ export class PromCompleter {
...
@@ -294,9 +294,9 @@ export class PromCompleter {
}
}
findMetricName
(
session
,
row
,
column
)
{
findMetricName
(
session
,
row
,
column
)
{
var
metricName
=
''
;
let
metricName
=
''
;
var
tokens
;
let
tokens
;
const
nameLabelNameToken
=
this
.
findToken
(
const
nameLabelNameToken
=
this
.
findToken
(
session
,
session
,
row
,
row
,
...
@@ -323,9 +323,9 @@ export class PromCompleter {
...
@@ -323,9 +323,9 @@ export class PromCompleter {
}
}
findToken
(
session
,
row
,
column
,
target
,
value
,
guard
)
{
findToken
(
session
,
row
,
column
,
target
,
value
,
guard
)
{
var
tokens
,
idx
;
let
tokens
,
idx
;
// find index and get column of previous token
// find index and get column of previous token
for
(
var
r
=
row
;
r
>=
0
;
r
--
)
{
for
(
let
r
=
row
;
r
>=
0
;
r
--
)
{
let
c
;
let
c
;
tokens
=
session
.
getTokens
(
r
);
tokens
=
session
.
getTokens
(
r
);
if
(
r
===
row
)
{
if
(
r
===
row
)
{
...
...
public/app/plugins/datasource/prometheus/datasource.ts
View file @
552a61b6
...
@@ -384,7 +384,7 @@ export class PrometheusDatasource {
...
@@ -384,7 +384,7 @@ export class PrometheusDatasource {
};
};
const range = Math.ceil(end - start);
const range = Math.ceil(end - start);
var
interval = kbn.interval_to_seconds(options.interval);
let
interval = kbn.interval_to_seconds(options.interval);
// Minimum interval ("Min step"), if specified for the query. or same as interval otherwise
// Minimum interval ("Min step"), if specified for the query. or same as interval otherwise
const minInterval = kbn.interval_to_seconds(
const minInterval = kbn.interval_to_seconds(
this.templateSrv.replace(target.interval, options.scopedVars) || options.interval
this.templateSrv.replace(target.interval, options.scopedVars) || options.interval
...
@@ -392,7 +392,7 @@ export class PrometheusDatasource {
...
@@ -392,7 +392,7 @@ export class PrometheusDatasource {
const intervalFactor = target.intervalFactor || 1;
const intervalFactor = target.intervalFactor || 1;
// Adjust the interval to take into account any specified minimum and interval factor plus Prometheus limits
// Adjust the interval to take into account any specified minimum and interval factor plus Prometheus limits
const adjustedInterval = this.adjustInterval(interval, minInterval, range, intervalFactor);
const adjustedInterval = this.adjustInterval(interval, minInterval, range, intervalFactor);
var
scopedVars = { ...options.scopedVars, ...this.getRangeScopedVars() };
let
scopedVars = { ...options.scopedVars, ...this.getRangeScopedVars() };
// If the interval was adjusted, make a shallow copy of scopedVars with updated interval vars
// If the interval was adjusted, make a shallow copy of scopedVars with updated interval vars
if (interval !== adjustedInterval) {
if (interval !== adjustedInterval) {
interval = adjustedInterval;
interval = adjustedInterval;
...
@@ -507,7 +507,7 @@ export class PrometheusDatasource {
...
@@ -507,7 +507,7 @@ export class PrometheusDatasource {
annotationQuery(options) {
annotationQuery(options) {
const annotation = options.annotation;
const annotation = options.annotation;
const expr = annotation.expr || '';
const expr = annotation.expr || '';
var
tagKeys = annotation.tagKeys || '';
let
tagKeys = annotation.tagKeys || '';
const titleFormat = annotation.titleFormat || '';
const titleFormat = annotation.titleFormat || '';
const textFormat = annotation.textFormat || '';
const textFormat = annotation.textFormat || '';
...
...
public/app/plugins/datasource/prometheus/metric_find_query.ts
View file @
552a61b6
...
@@ -40,7 +40,7 @@ export default class PrometheusMetricFindQuery {
...
@@ -40,7 +40,7 @@ export default class PrometheusMetricFindQuery {
}
}
labelValuesQuery
(
label
,
metric
)
{
labelValuesQuery
(
label
,
metric
)
{
var
url
;
let
url
;
if
(
!
metric
)
{
if
(
!
metric
)
{
// return label values globally
// return label values globally
...
@@ -96,7 +96,7 @@ export default class PrometheusMetricFindQuery {
...
@@ -96,7 +96,7 @@ export default class PrometheusMetricFindQuery {
const
end
=
this
.
datasource
.
getPrometheusTime
(
this
.
range
.
to
,
true
);
const
end
=
this
.
datasource
.
getPrometheusTime
(
this
.
range
.
to
,
true
);
return
this
.
datasource
.
performInstantQuery
({
expr
:
query
},
end
).
then
(
function
(
result
)
{
return
this
.
datasource
.
performInstantQuery
({
expr
:
query
},
end
).
then
(
function
(
result
)
{
return
_
.
map
(
result
.
data
.
data
.
result
,
function
(
metricData
)
{
return
_
.
map
(
result
.
data
.
data
.
result
,
function
(
metricData
)
{
var
text
=
metricData
.
metric
.
__name__
||
''
;
let
text
=
metricData
.
metric
.
__name__
||
''
;
delete
metricData
.
metric
.
__name__
;
delete
metricData
.
metric
.
__name__
;
text
+=
text
+=
'{'
+
'{'
+
...
...
public/app/plugins/datasource/prometheus/result_transformer.ts
View file @
552a61b6
...
@@ -73,7 +73,7 @@ export class ResultTransformer {
...
@@ -73,7 +73,7 @@ export class ResultTransformer {
transformMetricDataToTable
(
md
,
resultCount
:
number
,
refId
:
string
)
{
transformMetricDataToTable
(
md
,
resultCount
:
number
,
refId
:
string
)
{
const
table
=
new
TableModel
();
const
table
=
new
TableModel
();
var
i
,
j
;
let
i
,
j
;
const
metricLabels
=
{};
const
metricLabels
=
{};
if
(
md
.
length
===
0
)
{
if
(
md
.
length
===
0
)
{
...
...
public/app/plugins/panel/graph/threshold_manager.ts
View file @
552a61b6
...
@@ -13,7 +13,7 @@ export class ThresholdManager {
...
@@ -13,7 +13,7 @@ export class ThresholdManager {
constructor
(
private
panelCtrl
)
{}
constructor
(
private
panelCtrl
)
{}
getHandleHtml
(
handleIndex
,
model
,
valueStr
)
{
getHandleHtml
(
handleIndex
,
model
,
valueStr
)
{
var
stateClass
=
model
.
colorMode
;
let
stateClass
=
model
.
colorMode
;
if
(
model
.
colorMode
===
'custom'
)
{
if
(
model
.
colorMode
===
'custom'
)
{
stateClass
=
'critical'
;
stateClass
=
'critical'
;
}
}
...
@@ -33,8 +33,8 @@ export class ThresholdManager {
...
@@ -33,8 +33,8 @@ export class ThresholdManager {
const
handleElem
=
$
(
evt
.
currentTarget
).
parents
(
'.alert-handle-wrapper'
);
const
handleElem
=
$
(
evt
.
currentTarget
).
parents
(
'.alert-handle-wrapper'
);
const
handleIndex
=
$
(
evt
.
currentTarget
).
data
(
'handleIndex'
);
const
handleIndex
=
$
(
evt
.
currentTarget
).
data
(
'handleIndex'
);
var
lastY
=
null
;
let
lastY
=
null
;
var
posTop
;
let
posTop
;
const
plot
=
this
.
plot
;
const
plot
=
this
.
plot
;
const
panelCtrl
=
this
.
panelCtrl
;
const
panelCtrl
=
this
.
panelCtrl
;
const
model
=
this
.
thresholds
[
handleIndex
];
const
model
=
this
.
thresholds
[
handleIndex
];
...
@@ -52,7 +52,7 @@ export class ThresholdManager {
...
@@ -52,7 +52,7 @@ export class ThresholdManager {
function
stopped
()
{
function
stopped
()
{
// calculate graph level
// calculate graph level
var
graphValue
=
plot
.
c2p
({
left
:
0
,
top
:
posTop
}).
y
;
let
graphValue
=
plot
.
c2p
({
left
:
0
,
top
:
posTop
}).
y
;
graphValue
=
parseInt
(
graphValue
.
toFixed
(
0
));
graphValue
=
parseInt
(
graphValue
.
toFixed
(
0
));
model
.
value
=
graphValue
;
model
.
value
=
graphValue
;
...
@@ -86,8 +86,8 @@ export class ThresholdManager {
...
@@ -86,8 +86,8 @@ export class ThresholdManager {
renderHandle
(
handleIndex
,
defaultHandleTopPos
)
{
renderHandle
(
handleIndex
,
defaultHandleTopPos
)
{
const
model
=
this
.
thresholds
[
handleIndex
];
const
model
=
this
.
thresholds
[
handleIndex
];
const
value
=
model
.
value
;
const
value
=
model
.
value
;
var
valueStr
=
value
;
let
valueStr
=
value
;
var
handleTopPos
=
0
;
let
handleTopPos
=
0
;
// handle no value
// handle no value
if
(
!
_
.
isNumber
(
value
))
{
if
(
!
_
.
isNumber
(
value
))
{
...
@@ -111,7 +111,7 @@ export class ThresholdManager {
...
@@ -111,7 +111,7 @@ export class ThresholdManager {
prepare
(
elem
,
data
)
{
prepare
(
elem
,
data
)
{
this
.
hasSecondYAxis
=
false
;
this
.
hasSecondYAxis
=
false
;
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
yaxis
>
1
)
{
if
(
data
[
i
].
yaxis
>
1
)
{
this
.
hasSecondYAxis
=
true
;
this
.
hasSecondYAxis
=
true
;
break
;
break
;
...
@@ -158,9 +158,9 @@ export class ThresholdManager {
...
@@ -158,9 +158,9 @@ export class ThresholdManager {
return
;
return
;
}
}
var
gtLimit
=
Infinity
;
let
gtLimit
=
Infinity
;
var
ltLimit
=
-
Infinity
;
let
ltLimit
=
-
Infinity
;
var
i
,
threshold
,
other
;
let
i
,
threshold
,
other
;
for
(
i
=
0
;
i
<
panel
.
thresholds
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
panel
.
thresholds
.
length
;
i
++
)
{
threshold
=
panel
.
thresholds
[
i
];
threshold
=
panel
.
thresholds
[
i
];
...
@@ -168,7 +168,7 @@ export class ThresholdManager {
...
@@ -168,7 +168,7 @@ export class ThresholdManager {
continue
;
continue
;
}
}
var
limit
;
let
limit
;
switch
(
threshold
.
op
)
{
switch
(
threshold
.
op
)
{
case
'gt'
:
{
case
'gt'
:
{
limit
=
gtLimit
;
limit
=
gtLimit
;
...
@@ -196,7 +196,7 @@ export class ThresholdManager {
...
@@ -196,7 +196,7 @@ export class ThresholdManager {
}
}
}
}
var
fillColor
,
lineColor
;
let
fillColor
,
lineColor
;
switch
(
threshold
.
colorMode
)
{
switch
(
threshold
.
colorMode
)
{
case
'critical'
:
{
case
'critical'
:
{
fillColor
=
'rgba(234, 112, 112, 0.12)'
;
fillColor
=
'rgba(234, 112, 112, 0.12)'
;
...
...
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