From 5da09bf341cbad437f653d4ca698c585be840d8a Mon Sep 17 00:00:00 2001 From: Stepan <66589759+Always-prog@users.noreply.github.com> Date: Wed, 25 Jan 2023 22:25:34 +0300 Subject: [PATCH] fix(Annotation Layers): Error when render options with renamed columns (#22453) --- .../AnnotationLayerControl/AnnotationLayer.jsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx index 8f9bec53bb987..bc95bc487ee38 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx @@ -28,6 +28,7 @@ import { validateNonEmpty, isValidExpression, styled, + getColumnLabel, withTheme, } from '@superset-ui/core'; @@ -326,7 +327,19 @@ class AnnotationLayer extends React.PureComponent { metadata && metadata.canBeAnnotationType(annotationType) ); }) - .map(x => ({ value: x.id, label: x.title, slice: x })), + .map(x => ({ + value: x.id, + label: x.title, + slice: { + ...x, + data: { + ...x.data, + groupby: x.data.groupby.map(column => + getColumnLabel(column), + ), + }, + }, + })), }); }, ); @@ -499,7 +512,7 @@ class AnnotationLayer extends React.PureComponent { isSelected title={t('Annotation Slice Configuration')} info={t(`This section allows you to configure how to use the slice - to generate annotations.`)} + to generate annotations.`)} > {(annotationType === ANNOTATION_TYPES.EVENT || annotationType === ANNOTATION_TYPES.INTERVAL) && (