mirror of
https://github.com/apache/superset.git
synced 2026-05-09 18:05:52 +00:00
fix(chart): Restore subheader used in bignumber with trendline (#33196)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user