-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-cloudwatch): add support for sparkline graphs in SingleValue…
…Widget (#21684) Adds configuration option for enabling sparkline in SingleValueWidget. Fixes #21683
- Loading branch information
Showing
11 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { App, Stack, StackProps } from '@aws-cdk/core'; | ||
import { IntegTest } from '@aws-cdk/integ-tests'; | ||
import { Dashboard, SingleValueWidget, Metric } from '../lib'; | ||
|
||
class TestStack extends Stack { | ||
constructor(scope: App, id: string, props?: StackProps) { | ||
super(scope, id, props); | ||
|
||
const dashboard = new Dashboard(this, 'Dashboard'); | ||
|
||
const testMetric = new Metric({ | ||
namespace: 'CDK/Test', | ||
metricName: 'Metric', | ||
}); | ||
|
||
const widget = new SingleValueWidget({ | ||
metrics: [testMetric], | ||
sparkline: true, | ||
}); | ||
|
||
dashboard.addWidgets(widget); | ||
} | ||
} | ||
const app = new App(); | ||
const testCase = new TestStack(app, 'aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ'); | ||
new IntegTest(app, 'singlevaluewidget-with-sparkline', { | ||
testCases: [testCase], | ||
}); |
21 changes: 21 additions & 0 deletions
21
...shboard.integ.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"Resources": { | ||
"Dashboard9E4231ED": { | ||
"Type": "AWS::CloudWatch::Dashboard", | ||
"Properties": { | ||
"DashboardBody": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":3,\"x\":0,\"y\":0,\"properties\":{\"view\":\"singleValue\",\"region\":\"", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
"\",\"sparkline\":true,\"metrics\":[[\"CDK/Test\",\"Metric\"]]}}]}" | ||
] | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...-cdk/aws-cloudwatch/test/sparkline-singlevaluewidget-and-dashboard.integ.snapshot/cdk.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"20.0.0"} |
11 changes: 11 additions & 0 deletions
11
...k/aws-cloudwatch/test/sparkline-singlevaluewidget-and-dashboard.integ.snapshot/integ.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "20.0.0", | ||
"testCases": { | ||
"singlevaluewidget-with-sparkline/DefaultTest": { | ||
"stacks": [ | ||
"aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ" | ||
], | ||
"assertionStack": "singlevaluewidget-with-sparkline/DefaultTest/DeployAssert" | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ws-cloudwatch/test/sparkline-singlevaluewidget-and-dashboard.integ.snapshot/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"version": "20.0.0", | ||
"artifacts": { | ||
"Tree": { | ||
"type": "cdk:tree", | ||
"properties": { | ||
"file": "tree.json" | ||
} | ||
}, | ||
"aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.template.json", | ||
"validateOnSynth": false | ||
}, | ||
"metadata": { | ||
"/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ/Dashboard/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "Dashboard9E4231ED" | ||
} | ||
] | ||
}, | ||
"displayName": "aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ" | ||
}, | ||
"singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.template.json", | ||
"validateOnSynth": false | ||
}, | ||
"displayName": "singlevaluewidget-with-sparkline/DefaultTest/DeployAssert" | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...nteg.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
102 changes: 102 additions & 0 deletions
102
...dk/aws-cloudwatch/test/sparkline-singlevaluewidget-and-dashboard.integ.snapshot/tree.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"version": "tree-0.1", | ||
"tree": { | ||
"id": "App", | ||
"path": "", | ||
"children": { | ||
"Tree": { | ||
"id": "Tree", | ||
"path": "Tree", | ||
"constructInfo": { | ||
"fqn": "constructs.Construct", | ||
"version": "10.1.78" | ||
} | ||
}, | ||
"aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ": { | ||
"id": "aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ", | ||
"path": "aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ", | ||
"children": { | ||
"Dashboard": { | ||
"id": "Dashboard", | ||
"path": "aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ/Dashboard", | ||
"children": { | ||
"Resource": { | ||
"id": "Resource", | ||
"path": "aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ/Dashboard/Resource", | ||
"attributes": { | ||
"aws:cdk:cloudformation:type": "AWS::CloudWatch::Dashboard", | ||
"aws:cdk:cloudformation:props": { | ||
"dashboardBody": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":3,\"x\":0,\"y\":0,\"properties\":{\"view\":\"singleValue\",\"region\":\"", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
"\",\"sparkline\":true,\"metrics\":[[\"CDK/Test\",\"Metric\"]]}}]}" | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-cloudwatch.CfnDashboard", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/aws-cloudwatch.Dashboard", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Stack", | ||
"version": "0.0.0" | ||
} | ||
}, | ||
"singlevaluewidget-with-sparkline": { | ||
"id": "singlevaluewidget-with-sparkline", | ||
"path": "singlevaluewidget-with-sparkline", | ||
"children": { | ||
"DefaultTest": { | ||
"id": "DefaultTest", | ||
"path": "singlevaluewidget-with-sparkline/DefaultTest", | ||
"children": { | ||
"Default": { | ||
"id": "Default", | ||
"path": "singlevaluewidget-with-sparkline/DefaultTest/Default", | ||
"constructInfo": { | ||
"fqn": "constructs.Construct", | ||
"version": "10.1.78" | ||
} | ||
}, | ||
"DeployAssert": { | ||
"id": "DeployAssert", | ||
"path": "singlevaluewidget-with-sparkline/DefaultTest/DeployAssert", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Stack", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/integ-tests.IntegTestCase", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/integ-tests.IntegTest", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.App", | ||
"version": "0.0.0" | ||
} | ||
} | ||
} |