mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudWatch: Avoid exception while accessing results (#17283)
When accessing the `series` property of query results, if a query is hidden, an exception is thrown. This is caused by lack of checks to verify that the query result exists before accessing the `series` property. Closes #17112
This commit is contained in:
parent
a1a498f96c
commit
5fa5d4bdd5
@ -149,12 +149,14 @@ export default class CloudWatchDatasource extends DataSourceApi<CloudWatchQuery>
|
|||||||
if (res.results) {
|
if (res.results) {
|
||||||
for (const query of request.queries) {
|
for (const query of request.queries) {
|
||||||
const queryRes = res.results[query.refId];
|
const queryRes = res.results[query.refId];
|
||||||
for (const series of queryRes.series) {
|
if (queryRes) {
|
||||||
const s = { target: series.name, datapoints: series.points } as any;
|
for (const series of queryRes.series) {
|
||||||
if (queryRes.meta.unit) {
|
const s = { target: series.name, datapoints: series.points } as any;
|
||||||
s.unit = queryRes.meta.unit;
|
if (queryRes.meta.unit) {
|
||||||
|
s.unit = queryRes.meta.unit;
|
||||||
|
}
|
||||||
|
data.push(s);
|
||||||
}
|
}
|
||||||
data.push(s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user