From 3661482eb3f2ee44b9dfcd4dc258664bcc7b839a Mon Sep 17 00:00:00 2001 From: "JUST.in DO IT" Date: Tue, 19 Aug 2025 09:16:40 -0700 Subject: [PATCH] chore(saved_query): Copy link to clipboard before redirect to edit (#34567) (#34758) (cherry picked from commit 9cbe5a90b8e6c539e8d5759f68b6559a6947c244) --- superset-frontend/src/pages/SavedQueryList/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 {