mirror of
https://github.com/apache/superset.git
synced 2026-04-15 06:04:48 +00:00
fix(conditional formatting): controls looses on save (#23137)
This commit is contained in:
@@ -384,7 +384,7 @@ const config: ControlPanelConfig = {
|
||||
renderTrigger: true,
|
||||
label: t('Conditional formatting'),
|
||||
description: t('Apply conditional color formatting to metrics'),
|
||||
mapStateToProps(explore) {
|
||||
mapStateToProps(explore, _, chart) {
|
||||
const values =
|
||||
(explore?.controls?.metrics?.value as QueryFormMetric[]) ??
|
||||
[];
|
||||
@@ -393,6 +393,7 @@ const config: ControlPanelConfig = {
|
||||
)
|
||||
? (explore?.datasource as Dataset)?.verbose_map
|
||||
: explore?.datasource?.columns ?? {};
|
||||
const chartStatus = chart?.chartStatus;
|
||||
const metricColumn = values.map(value => {
|
||||
if (typeof value === 'string') {
|
||||
return { value, label: verboseMap[value] ?? value };
|
||||
@@ -400,6 +401,7 @@ const config: ControlPanelConfig = {
|
||||
return { value: value.label, label: value.label };
|
||||
});
|
||||
return {
|
||||
removeIrrelevantConditions: chartStatus === 'success',
|
||||
columnOptions: metricColumn,
|
||||
verboseMap,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user