This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new febc07aec3 fix(table): percentage metric should use verbose map
(#24158)
febc07aec3 is described below
commit febc07aec361d80056195c001d26084e3a0b9363
Author: Stepan <[email protected]>
AuthorDate: Sun May 21 12:52:23 2023 +0300
fix(table): percentage metric should use verbose map (#24158)
---
superset-frontend/plugins/plugin-chart-table/src/transformProps.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts
b/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts
index df59d89f09..e03667a695 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts
@@ -111,13 +111,15 @@ const processColumns = memoizeOne(function processColumns(
!(rawPercentMetricsSet.has(key) && !metricsSet.has(key)),
)
.map((key: string, i) => {
- const label = verboseMap?.[key] || key;
const dataType = coltypes[i];
const config = columnConfig[key] || {};
// for the purpose of presentation, only numeric values are treated as
metrics
// because users can also add things like `MAX(str_col)` as a metric.
const isMetric = metricsSet.has(key) && isNumeric(key, records);
const isPercentMetric = percentMetricsSet.has(key);
+ const label = isPercentMetric
+ ? `%${verboseMap?.[key.replace('%', '')] || key}`
+ : verboseMap?.[key] || key;
const isTime = dataType === GenericDataType.TEMPORAL;
const isNumber = dataType === GenericDataType.NUMERIC;
const savedFormat = columnFormats?.[key];