You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/12/19 17:57:36 UTC
[GitHub] [superset] villebro commented on a diff in pull request #22453: Fix(Annotation Layers): Error when render options with renamed columns
villebro commented on code in PR #22453:
URL: https://github.com/apache/superset/pull/22453#discussion_r1052482575
##########
superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx:
##########
@@ -28,6 +28,7 @@ import {
validateNonEmpty,
isValidExpression,
styled,
+ getMetricLabel,
Review Comment:
```suggestion
getColumnLabel,
```
##########
superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx:
##########
@@ -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(metricOrColumn =>
+ getMetricLabel(metricOrColumn),
+ ),
Review Comment:
I know this is can be a pain to grasp from the JS codebase, but the type of `groupby` is actually `QueryFormColumn`, and the correct label getter is `getColumnLabel`:
```suggestion
groupby: x.data.groupby.map(column =>
getColumnLabel(column),
),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org