sadpandajoe commented on code in PR #34785:
URL: https://github.com/apache/superset/pull/34785#discussion_r3825217838
##########
superset/datasets/schemas.py:
##########
@@ -322,6 +323,7 @@ def fix_extra(self, data: dict[str, Any], **kwargs: Any) ->
dict[str, Any]:
fetch_values_predicate = fields.String(allow_none=True)
extra = fields.Dict(allow_none=True)
uuid = fields.UUID(required=True)
+ drill_through_chart_id = fields.Integer(allow_none=True)
Review Comment:
This exports an environment-local `slices.id` as dataset configuration.
Importing a dataset into another instance can either fail the foreign key
before that chart exists or bind the dataset to an unrelated chart with the
same ID. Could this use a portable chart reference and resolve it after chart
import instead?
##########
superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx:
##########
@@ -109,14 +120,65 @@ export default function DrillDetailModal({
findPermission('can_explore', 'Superset', state.user?.roles),
);
- const exploreUrl = useMemo(
- () => `/explore/?dashboard_page_id=${dashboardPageId}&slice_id=${chartId}`,
- [chartId, dashboardPageId],
+ const showEditButton = Boolean(dataset?.drill_through_chart_id);
+ const dashboardContextFormData = useDashboardFormData(
+ dataset?.drill_through_chart_id,
);
- const exploreChart = useCallback(() => {
- history.push(exploreUrl);
- }, [exploreUrl, history]);
+ const drillThroughFormData = useMemo(() => {
+ if (!dataset?.drill_through_chart_id || !dataset?.id) {
+ return null;
+ }
+
+ const drillThroughBaseFormData = {
+ slice_id: dataset.drill_through_chart_id,
+ datasource: `${dataset.id}__table`,
+ viz_type: 'table',
Review Comment:
This overrides the saved chart's `viz_type`, so configuring any non-table
chart for drill-through still renders a table. Could the override contain only
the drill context and leave the selected chart's visualization type intact?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]