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
5dd64b97
Commit
5dd64b97
authored
Sep 18, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
9600b1f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
16 deletions
+31
-16
public/app/plugins/datasource/cloudwatch/datasource.js
+31
-16
No files found.
public/app/plugins/datasource/cloudwatch/datasource.js
View file @
5dd64b97
...
...
@@ -353,6 +353,30 @@ function (angular, _, dateMath) {
return
d
.
promise
;
};
CloudWatchDatasource
.
prototype
.
performEC2DescribeInstances
=
function
(
region
,
filters
,
instanceIds
)
{
var
ec2
=
this
.
getAwsClient
(
region
,
'EC2'
);
var
params
=
{};
if
(
filters
.
length
>
0
)
{
params
.
Filters
=
filters
;
}
if
(
instanceIds
.
length
>
0
)
{
params
.
InstanceIds
=
instanceIds
;
}
var
d
=
$q
.
defer
();
ec2
.
describeInstances
(
params
,
function
(
err
,
data
)
{
if
(
err
)
{
return
d
.
reject
(
err
);
}
return
d
.
resolve
(
data
);
});
return
d
.
promise
;
};
CloudWatchDatasource
.
prototype
.
getTemplateVariableNames
=
function
()
{
var
variables
=
[];
templateSrv
.
fillVariableValuesForUrl
(
variables
);
...
...
@@ -440,27 +464,18 @@ function (angular, _, dateMath) {
if
(
ebsVolumeIdsQuery
)
{
region
=
templateSrv
.
replace
(
ebsVolumeIdsQuery
[
1
]);
var
instanceId
=
templateSrv
.
replace
(
ebsVolumeIdsQuery
[
2
]);
var
instanceIds
=
[
instanceId
];
var
ec2
=
this
.
getAwsClient
(
region
,
'EC2'
);
var
params
=
{
InstanceIds
:
[
instanceId
]
};
ec2
.
describeInstances
(
params
,
function
(
err
,
data
)
{
if
(
err
)
{
throw
err
;
}
var
volumeIds
=
_
.
map
(
data
.
Reservations
[
0
].
Instances
[
0
].
BlockDeviceMappings
,
function
(
mapping
)
{
return
this
.
performEC2DescribeInstances
(
region
,
[],
instanceIds
)
.
then
(
function
(
result
)
{
var
volumeIds
=
_
.
map
(
result
.
Reservations
[
0
].
Instances
[
0
].
BlockDeviceMappings
,
function
(
mapping
)
{
return
mapping
.
EBS
.
VolumeID
;
});
d
.
resolve
(
transformSuggestData
(
volumeIds
)
);
return
transformSuggestData
(
volumeIds
);
});
return
d
.
promise
;
}
return
$q
.
when
([]);
...
...
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