Skip to content

Commit 8ee2c8e

Browse files
committed
fix percentage metrics columns
1 parent ad75ff3 commit 8ee2c8e

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,14 +590,30 @@ const config: ControlPanelConfig = {
590590
)
591591
.forEach((colname, index) => {
592592
if (
593-
explore.form_data.metrics?.some(
594-
metric => getMetricLabel(metric) === colname,
595-
) ||
593+
colname &&
594+
!colname.startsWith('%') &&
595+
colnames.includes(`%${colname}`) &&
596596
explore.form_data.percent_metrics?.some(
597597
(metric: QueryFormMetric) =>
598598
getMetricLabel(metric) === colname,
599+
) &&
600+
!explore.form_data.metrics?.some(
601+
(metric: QueryFormMetric) =>
602+
getMetricLabel(metric) === colname,
599603
)
600604
) {
605+
return;
606+
}
607+
const isMetric = explore.form_data.metrics?.some(
608+
metric => getMetricLabel(metric) === colname,
609+
);
610+
const isPercentMetric =
611+
explore.form_data.percent_metrics?.some(
612+
(metric: QueryFormMetric) =>
613+
`%${getMetricLabel(metric)}` === colname,
614+
);
615+
616+
if (isMetric || isPercentMetric) {
601617
const comparisonColumns =
602618
generateComparisonColumns(colname);
603619
comparisonColumns.forEach((name, idx) => {

superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigItem.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ export default memo(function ColumnConfigItem({
101101
)}
102102
trigger="click"
103103
placement="right"
104-
styles={{ body: { width, height } }}
105-
rootClassName="column-config-popover"
104+
style={{ width, height }}
105+
className="column-config-popover"
106106
>
107107
<div css={outerContainerStyle}>
108108
<div css={nameContainerStyle}>
@@ -117,7 +117,7 @@ export default memo(function ColumnConfigItem({
117117
iconColor={colors.grayscale.base}
118118
/>
119119
)}
120-
<Icons.CaretRightOutlined css={caretIconStyle} />
120+
<Icons.RightOutlined css={caretIconStyle} />
121121
</div>
122122
</div>
123123
</Popover>

0 commit comments

Comments
 (0)