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
fce50cf1
Commit
fce50cf1
authored
Oct 16, 2018
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return default region list from backend
parent
a417d6fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
35 deletions
+17
-35
pkg/tsdb/cloudwatch/metric_find_query.go
+8
-4
public/app/plugins/datasource/cloudwatch/config_ctrl.ts
+9
-31
No files found.
pkg/tsdb/cloudwatch/metric_find_query.go
View file @
fce50cf1
...
...
@@ -234,6 +234,8 @@ func parseMultiSelectValue(input string) []string {
// Please update the region list in public/app/plugins/datasource/cloudwatch/partials/config.html
func
(
e
*
CloudWatchExecutor
)
handleGetRegions
(
ctx
context
.
Context
,
parameters
*
simplejson
.
Json
,
queryContext
*
tsdb
.
TsdbQuery
)
([]
suggestData
,
error
)
{
regions
:=
[]
string
{
"ap-northeast-1"
,
"ap-northeast-2"
,
"ap-northeast-3"
,
"ap-south-1"
,
"ap-southeast-1"
,
"ap-southeast-2"
,
"ca-central-1"
,
"eu-central-1"
,
"eu-north-1"
,
"eu-west-1"
,
"eu-west-2"
,
"eu-west-3"
,
"me-south-1"
,
"sa-east-1"
,
"us-east-1"
,
"us-east-2"
,
"us-west-1"
,
"us-west-2"
,
"cn-north-1"
,
"cn-northwest-1"
,
"us-gov-east-1"
,
"us-gov-west-1"
,
"us-isob-east-1"
,
"us-iso-east-1"
,
}
...
...
@@ -243,10 +245,12 @@ func (e *CloudWatchExecutor) handleGetRegions(ctx context.Context, parameters *s
}
r
,
err
:=
e
.
ec2Svc
.
DescribeRegions
(
&
ec2
.
DescribeRegionsInput
{})
if
err
!=
nil
{
return
nil
,
err
}
for
_
,
region
:=
range
r
.
Regions
{
regions
=
append
(
regions
,
*
region
.
RegionName
)
// ignore error for backward compatibility
plog
.
Error
(
"Failed to get regions"
,
"error"
,
err
)
}
else
{
for
_
,
region
:=
range
r
.
Regions
{
regions
=
append
(
regions
,
*
region
.
RegionName
)
}
}
sort
.
Strings
(
regions
)
...
...
public/app/plugins/datasource/cloudwatch/config_ctrl.ts
View file @
fce50cf1
...
...
@@ -41,32 +41,7 @@ export class CloudWatchConfigCtrl {
{
name
:
'Yearly'
,
value
:
'Yearly'
,
example
:
'[logstash-]YYYY'
},
];
regions
=
[
'ap-northeast-1'
,
'ap-northeast-2'
,
'ap-northeast-3'
,
'ap-south-1'
,
'ap-southeast-1'
,
'ap-southeast-2'
,
'ca-central-1'
,
'cn-north-1'
,
'cn-northwest-1'
,
'eu-central-1'
,
'eu-north-1'
,
'eu-west-1'
,
'eu-west-2'
,
'eu-west-3'
,
'me-south-1'
,
'sa-east-1'
,
'us-east-1'
,
'us-east-2'
,
'us-gov-east-1'
,
'us-gov-west-1'
,
'us-iso-east-1'
,
'us-isob-east-1'
,
'us-west-1'
,
'us-west-2'
,
];
regions
=
[];
getRegions
()
{
this
.
datasourceSrv
...
...
@@ -74,10 +49,13 @@ export class CloudWatchConfigCtrl {
.
then
(
ds
=>
{
return
ds
.
getRegions
();
})
.
then
(
regions
=>
{
this
.
regions
=
_
.
map
(
regions
,
'value'
);
},
err
=>
{
console
.
error
(
'failed to call ec2:DescribeRegions, please check iam setting'
);
});
.
then
(
regions
=>
{
this
.
regions
=
_
.
map
(
regions
,
'value'
);
},
err
=>
{
console
.
error
(
'failed to get latest regions'
);
}
);
}
}
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