feat(matrixify): implement matrix of any charts as core Superset feature (#34526)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Maxime Beauchemin
2025-08-19 08:36:55 -07:00
committed by GitHub
parent 6969f2cf7a
commit e6c8343fd0
54 changed files with 5696 additions and 106 deletions

View File

@@ -171,7 +171,8 @@ export function getAllControlsState(
formData: QueryFormData,
) {
const controlsState: Record<string, ControlState<any> | null> = {};
getSectionsToRender(vizType, datasourceType).forEach(section =>
getSectionsToRender(vizType, datasourceType).forEach(section => {
if (!section || !section.controlSetRows) return;
section.controlSetRows.forEach(fieldsetRow =>
fieldsetRow.forEach((field: CustomControlItem) => {
if (field?.config && field.name) {
@@ -183,7 +184,7 @@ export function getAllControlsState(
);
}
}),
),
);
);
});
return controlsState;
}

View File

@@ -58,7 +58,13 @@ const getMemoizedSectionsToRender = memoizeOne(
}
});
const { datasourceAndVizType } = sections;
const {
datasourceAndVizType,
matrixifyRows = null,
matrixifyColumns = null,
matrixifyCells = null,
matrixifyEnableSection = null,
} = sections;
// list of datasource-specific controls that should be removed if the datasource is a specific type
const filterControlsForTypes = [DatasourceType.Query, DatasourceType.Table];
@@ -66,9 +72,17 @@ const getMemoizedSectionsToRender = memoizeOne(
? ['granularity']
: ['granularity_sqla', 'time_grain_sqla'];
return [datasourceAndVizType as ControlPanelSectionConfig]
return [
datasourceAndVizType as ControlPanelSectionConfig,
matrixifyEnableSection as ControlPanelSectionConfig,
matrixifyCells as ControlPanelSectionConfig,
matrixifyColumns as ControlPanelSectionConfig,
matrixifyRows as ControlPanelSectionConfig,
]
.filter(Boolean) // Filter out null/undefined sections
.concat(controlPanelSections.filter(isControlPanelSectionConfig))
.map(section => {
if (!section) return null;
const { controlSetRows } = section;
return {
...section,
@@ -83,7 +97,8 @@ const getMemoizedSectionsToRender = memoizeOne(
.map(item => expandControlConfig(item, controlOverrides)),
) || [],
};
});
})
.filter(Boolean); // Filter out any null results
},
);