mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudWatch: fix color order (#16408)
* fix cloudwatch color order * fix test * use for-of
This commit is contained in:
parent
3c21a121eb
commit
d7d20a5b10
@ -138,15 +138,16 @@ export default class CloudWatchDatasource {
|
|||||||
const data = [];
|
const data = [];
|
||||||
|
|
||||||
if (res.results) {
|
if (res.results) {
|
||||||
_.forEach(res.results, queryRes => {
|
for (const query of request.queries) {
|
||||||
_.forEach(queryRes.series, series => {
|
const queryRes = res.results[query.refId];
|
||||||
|
for (const series of queryRes.series) {
|
||||||
const s = { target: series.name, datapoints: series.points } as any;
|
const s = { target: series.name, datapoints: series.points } as any;
|
||||||
if (queryRes.meta.unit) {
|
if (queryRes.meta.unit) {
|
||||||
s.unit = queryRes.meta.unit;
|
s.unit = queryRes.meta.unit;
|
||||||
}
|
}
|
||||||
data.push(s);
|
data.push(s);
|
||||||
});
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { data: data };
|
return { data: data };
|
||||||
|
@ -42,6 +42,7 @@ describe('CloudWatchDatasource', () => {
|
|||||||
rangeRaw: { from: 1483228800, to: 1483232400 },
|
rangeRaw: { from: 1483228800, to: 1483232400 },
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
|
refId: 'A',
|
||||||
region: 'us-east-1',
|
region: 'us-east-1',
|
||||||
namespace: 'AWS/EC2',
|
namespace: 'AWS/EC2',
|
||||||
metricName: 'CPUUtilization',
|
metricName: 'CPUUtilization',
|
||||||
@ -103,6 +104,7 @@ describe('CloudWatchDatasource', () => {
|
|||||||
rangeRaw: { from: 1483228800, to: 1483232400 },
|
rangeRaw: { from: 1483228800, to: 1483232400 },
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
|
refId: 'A',
|
||||||
region: 'us-east-1',
|
region: 'us-east-1',
|
||||||
namespace: 'AWS/EC2',
|
namespace: 'AWS/EC2',
|
||||||
metricName: 'CPUUtilization',
|
metricName: 'CPUUtilization',
|
||||||
@ -128,6 +130,7 @@ describe('CloudWatchDatasource', () => {
|
|||||||
rangeRaw: { from: 1483228800, to: 1483232400 },
|
rangeRaw: { from: 1483228800, to: 1483232400 },
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
|
refId: 'A',
|
||||||
region: 'us-east-1',
|
region: 'us-east-1',
|
||||||
namespace: 'AWS/EC2',
|
namespace: 'AWS/EC2',
|
||||||
metricName: 'CPUUtilization',
|
metricName: 'CPUUtilization',
|
||||||
@ -178,6 +181,7 @@ describe('CloudWatchDatasource', () => {
|
|||||||
rangeRaw: { from: 1483228800, to: 1483232400 },
|
rangeRaw: { from: 1483228800, to: 1483232400 },
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
|
refId: 'A',
|
||||||
region: 'default',
|
region: 'default',
|
||||||
namespace: 'AWS/EC2',
|
namespace: 'AWS/EC2',
|
||||||
metricName: 'CPUUtilization',
|
metricName: 'CPUUtilization',
|
||||||
@ -203,6 +207,7 @@ describe('CloudWatchDatasource', () => {
|
|||||||
rangeRaw: { from: 1483228800, to: 1483232400 },
|
rangeRaw: { from: 1483228800, to: 1483232400 },
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
|
refId: 'A',
|
||||||
region: 'us-east-1',
|
region: 'us-east-1',
|
||||||
namespace: 'AWS/ApplicationELB',
|
namespace: 'AWS/ApplicationELB',
|
||||||
metricName: 'TargetResponseTime',
|
metricName: 'TargetResponseTime',
|
||||||
|
Loading…
Reference in New Issue
Block a user