fix(chart): Restore subheader used in bignumber with trendline (#33196)

This commit is contained in:
Levis Mbote
2025-04-25 15:39:07 +03:00
committed by GitHub
parent fbd8ae2888
commit 6a586fe4fd
7 changed files with 332 additions and 15 deletions

View File

@@ -734,6 +734,17 @@ const retainQueryModeRequirements = hiddenFormData =>
key => !QUERY_MODE_REQUISITES.has(key),
);
function patchBigNumberTotalFormData(form_data, slice) {
if (
form_data.viz_type === 'big_number_total' &&
!form_data.subtitle &&
slice?.form_data?.subheader
) {
return { ...form_data, subtitle: slice.form_data.subheader };
}
return form_data;
}
function mapStateToProps(state) {
const {
explore,
@@ -768,6 +779,25 @@ function mapStateToProps(state) {
dashboardId = undefined;
}
if (
form_data.viz_type === 'big_number_total' &&
slice?.form_data?.subheader &&
(!controls.subtitle?.value || controls.subtitle.value === '')
) {
controls.subtitle = {
...controls.subtitle,
value: slice.form_data.subheader,
};
if (slice?.form_data?.subheader_font_size) {
controls.subtitle_font_size = {
...controls.subtitle_font_size,
value: slice.form_data.subheader_font_size,
};
}
}
const patchedFormData = patchBigNumberTotalFormData(form_data, slice);
return {
isDatasourceMetaLoading: explore.isDatasourceMetaLoading,
datasource,
@@ -789,7 +819,7 @@ function mapStateToProps(state) {
slice,
sliceName: explore.sliceName ?? slice?.slice_name ?? null,
triggerRender: explore.triggerRender,
form_data,
form_data: patchedFormData,
table_name: datasource.table_name,
vizType: form_data.viz_type,
standalone: !!explore.standalone,