fix(conditional formatting): controls looses on save (#23137)

This commit is contained in:
Stepan
2023-03-30 20:10:31 +03:00
committed by GitHub
parent 63751c6c0f
commit ce3ba67cf6
4 changed files with 22 additions and 22 deletions

View File

@@ -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,
};