diff --git a/superset-frontend/src/pages/SavedQueryList/index.tsx b/superset-frontend/src/pages/SavedQueryList/index.tsx index 1342d3fb2ee..33c65aa079b 100644 --- a/superset-frontend/src/pages/SavedQueryList/index.tsx +++ b/superset-frontend/src/pages/SavedQueryList/index.tsx @@ -61,6 +61,7 @@ import { QueryObjectColumns, SavedQueryObject } from 'src/views/CRUD/types'; import { TagTypeEnum } from 'src/components/Tag/TagType'; import { loadTags } from 'src/components/Tag/utils'; import { Icons } from '@superset-ui/core/components/Icons'; +import copyTextToClipboard from 'src/utils/copy'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; import SavedQueryPreviewModal from 'src/features/queries/SavedQueryPreviewModal'; import { findPermission } from 'src/utils/findPermission'; @@ -229,6 +230,15 @@ function SavedQueryList({ // Action methods const openInSqlLab = (id: number, openInNewWindow: boolean) => { + copyTextToClipboard(() => + Promise.resolve(`${window.location.origin}/sqllab?savedQueryId=${id}`), + ) + .then(() => { + addSuccessToast(t('Link Copied!')); + }) + .catch(() => { + addDangerToast(t('Sorry, your browser does not support copying.')); + }); if (openInNewWindow) { window.open(`/sqllab?savedQueryId=${id}`); } else {