Skip to content

Commit e4d2d17

Browse files
fix: Add missing graph properties for single-value custom widgets (#327)
CustomWidgets with a Single Value type didn't have all properties correctly set, such as the `title`. The createGraphWidget() method is safe to be called like this because although its `props: GraphWidgetProps` parameter is *not* directly compatible with type type `SingleValueWidgetProps`, the parameters are being filled in CustomMonitoring.createCustomMetricGroupWidgets(), which only contains fields from their common supertype (`MetricWidgetProps`), therefore making the fields compatible. --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent f675375 commit e4d2d17

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/common/widget/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export function createGraphWidget(
4848

4949
case GraphWidgetType.SINGLE_VALUE:
5050
return new SingleValueWidget({
51+
...props,
5152
metrics: [...(props.left ?? []), ...(props.right ?? [])],
5253
});
5354

test/monitoring/custom/__snapshots__/CustomMonitoring.test.ts.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)