EnxDev commented on code in PR #43719:
URL: https://github.com/apache/superset/pull/43719#discussion_r3915805551


##########
superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx:
##########
@@ -196,13 +196,22 @@ const SliceHeaderControls = (
       .get(props.slice.viz_type)
       ?.behaviors?.includes(Behavior.InteractiveChart);
   const canExplore = props.supersetCanExplore;
-  const { canDrillToDetail, canViewQuery, canViewTable } = usePermissions();
+  const { canDrillToDetail, canGetDrillInfo, canViewQuery, canViewTable } =
+    usePermissions();
 
+  // Single predicate for the "View as table" entry, so the fetch that feeds 
its
+  // column headers cannot drift from the set of users who can open it.
+  const canViewResultsTable = canExplore || canViewTable;
+
+  // The dataset's verbose map resolves friendly Labels for both the 
drill-to-detail
+  // pane and the results grid, and those are separate permissions — so fetch 
it for
+  // either one, as long as the drill_info endpoint itself is readable (it is 
gated
+  // by `can_get_drill_info` on Dataset).
   const datasetResource = useDatasetDrillInfo(
     props.slice.datasource,
     props.dashboardId,
     props.formData,

Review Comment:
   Could we avoid using the drill-by extension as the label source here? With 
`formData` present, `useDatasetDrillInfo` prefers `load.drillby.options` and 
never calls the REST endpoint. That extension only promises drill-by options, 
so it may omit metrics and non-dimension columns; in those deployments, View as 
table still gets an incomplete verbose map. A separate REST fetch for labels, 
or a fallback when the extension response lacks full metadata, would keep this 
fix working with extensions.



-- 
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]

Reply via email to