fix(drill-detail): decouple copy button from download permission

Copy was gated on canDownload, which hid the button for users who
lacked export permission but could still legitimately use the clipboard.
Gate Copy on canCopyClipboard (via usePermissions) and show the same
permission-denied tooltip pattern used by the sibling Explore pane
DataTableControls.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
alex-poor
2026-04-22 11:14:15 +12:00
parent 6e1f03b469
commit ca0e9cf65d

View File

@@ -30,6 +30,7 @@ import { Icons } from '@superset-ui/core/components/Icons';
import { Tooltip } from '@superset-ui/core/components';
import { CopyToClipboardButton } from 'src/explore/components/DataTableControl';
import { TabularDataRow } from 'src/utils/common';
import { usePermissions } from 'src/hooks/usePermissions';
import DownloadDropdown from './DownloadDropdown';
export type TableControlsProps = {
@@ -58,6 +59,7 @@ export default function TableControls({
columnNames,
}: TableControlsProps) {
const theme = useTheme();
const { canCopyClipboard: copyEnabled } = usePermissions();
const filterMap: Record<string, BinaryQueryObjectFilterClause> = useMemo(
() =>
Object.assign(
@@ -142,8 +144,18 @@ export default function TableControls({
onDownloadXLSX={onDownloadXLSX}
/>
)}
{canDownload && (
{copyEnabled ? (
<CopyToClipboardButton data={data} columns={columnNames} />
) : (
<Tooltip title={t("You don't have permission to copy to clipboard")}>
<span>
<CopyToClipboardButton
data={data}
columns={columnNames}
disabled
/>
</span>
</Tooltip>
)}
<Tooltip title={t('Reload')}>
<Icons.ReloadOutlined