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
ffc9a832
Commit
ffc9a832
authored
Feb 17, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4054 from mtanda/cloudwatch_template_dimension_fix
(cloudwatch) fix template replace in legend
parents
84e50f90
f28eec8b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
public/app/plugins/datasource/cloudwatch/datasource.js
+12
-6
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
ffc9a832
...
...
@@ -58,7 +58,7 @@ function (angular, _, moment, dateMath) {
var
result
=
[];
_
.
each
(
allResponse
,
function
(
response
,
index
)
{
var
metrics
=
transformMetricData
(
response
,
options
.
targets
[
index
]);
var
metrics
=
transformMetricData
(
response
,
options
.
targets
[
index
]
,
options
.
scopedVars
);
result
=
result
.
concat
(
metrics
);
});
...
...
@@ -302,15 +302,21 @@ function (angular, _, moment, dateMath) {
return
this
.
defaultRegion
;
};
function
transformMetricData
(
md
,
options
)
{
function
transformMetricData
(
md
,
options
,
scopedVars
)
{
var
aliasRegex
=
/
\{\{(
.+
?)\}\}
/g
;
var
aliasPattern
=
options
.
alias
||
'{{metric}}_{{stat}}'
;
var
aliasData
=
{
region
:
templateSrv
.
replace
(
options
.
region
),
namespace
:
templateSrv
.
replace
(
options
.
namespace
),
metric
:
templateSrv
.
replace
(
options
.
metricName
),
region
:
templateSrv
.
replace
(
options
.
region
,
scopedVars
),
namespace
:
templateSrv
.
replace
(
options
.
namespace
,
scopedVars
),
metric
:
templateSrv
.
replace
(
options
.
metricName
,
scopedVars
),
};
_
.
extend
(
aliasData
,
options
.
dimensions
);
var
aliasDimensions
=
{};
_
.
each
(
_
.
keys
(
options
.
dimensions
),
function
(
origKey
)
{
var
key
=
templateSrv
.
replace
(
origKey
,
scopedVars
);
var
value
=
templateSrv
.
replace
(
options
.
dimensions
[
origKey
],
scopedVars
);
aliasDimensions
[
key
]
=
value
;
});
_
.
extend
(
aliasData
,
aliasDimensions
);
var
periodMs
=
options
.
period
*
1000
;
return
_
.
map
(
options
.
statistics
,
function
(
stat
)
{
...
...
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