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
116b6188
Unverified
Commit
116b6188
authored
Nov 27, 2019
by
Erik Sundell
Committed by
GitHub
Nov 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CloudWatch: Region template query fix (#20661)
* Make region an optional parameter * Test region template query
parent
49dfb9a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
public/app/plugins/datasource/cloudwatch/datasource.ts
+2
-2
public/app/plugins/datasource/cloudwatch/specs/datasource.test.ts
+33
-0
No files found.
public/app/plugins/datasource/cloudwatch/datasource.ts
View file @
116b6188
...
...
@@ -334,8 +334,8 @@ export default class CloudWatchDatasource extends DataSourceApi<CloudWatchQuery,
return
this
.
doMetricQueryRequest
(
'namespaces'
,
null
);
}
async
getMetrics
(
namespace
:
string
,
region
:
string
)
{
if
(
!
namespace
||
!
region
)
{
async
getMetrics
(
namespace
:
string
,
region
?
:
string
)
{
if
(
!
namespace
)
{
return
[];
}
...
...
public/app/plugins/datasource/cloudwatch/specs/datasource.test.ts
View file @
116b6188
...
...
@@ -307,6 +307,39 @@ describe('CloudWatchDatasource', () => {
});
});
});
describe
(
'when regions query is used'
,
()
=>
{
beforeEach
(()
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(()
=>
{
return
Promise
.
resolve
({});
});
ctx
.
ds
=
new
CloudWatchDatasource
(
instanceSettings
,
{}
as
any
,
backendSrv
,
templateSrv
,
timeSrv
);
ctx
.
ds
.
doMetricQueryRequest
=
jest
.
fn
(()
=>
[]);
});
describe
(
'and region param is left out'
,
()
=>
{
it
(
'should use the default region'
,
done
=>
{
ctx
.
ds
.
metricFindQuery
(
'metrics(testNamespace)'
).
then
(()
=>
{
expect
(
ctx
.
ds
.
doMetricQueryRequest
).
toHaveBeenCalledWith
(
'metrics'
,
{
namespace
:
'testNamespace'
,
region
:
instanceSettings
.
jsonData
.
defaultRegion
,
});
done
();
});
});
});
describe
(
'and region param is defined by user'
,
()
=>
{
it
(
'should use the user defined region'
,
done
=>
{
ctx
.
ds
.
metricFindQuery
(
'metrics(testNamespace2, custom-region)'
).
then
(()
=>
{
expect
(
ctx
.
ds
.
doMetricQueryRequest
).
toHaveBeenCalledWith
(
'metrics'
,
{
namespace
:
'testNamespace2'
,
region
:
'custom-region'
,
});
done
();
});
});
});
});
});
describe
(
'When query region is "default"'
,
()
=>
{
...
...
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