mirror of
https://github.com/apache/superset.git
synced 2026-07-29 01:52:26 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user