Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: sql editor worksheet ux (#20541)
ecmadao4dbe34d4e91e
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex a2459e2177..7f50b7f185 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -2605,6 +2605,8 @@"show-shared": "Show shared"},"hint-tips": {+ "confirm-multi-delete-content": "The selected worksheets and folders will be permanently deleted.",+ "confirm-multi-delete-title": "Delete selected items?","confirm-to-delete-sheet-title": "Confirm to delete this worksheet?","confirm-to-duplicate-sheet": "Confirm to duplicate this worksheet?","delete-all-sheets": "Delete all files",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 3c9b41015a..07cf31dce1 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -2605,6 +2605,8 @@"show-shared": "Mostrar compartido"},"hint-tips": {+ "confirm-multi-delete-content": "Las hojas de cálculo y carpetas seleccionadas se eliminarán permanentemente.",+ "confirm-multi-delete-title": "¿Eliminar los elementos seleccionados?","confirm-to-delete-sheet-title": "¿Confirmar la eliminación de esta hoja de cálculo?","confirm-to-duplicate-sheet": "¿Confirmar para duplicar esta hoja?","delete-all-sheets": "Eliminar todos los archivos",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 345d82bead..920c763402 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -2605,6 +2605,8 @@"show-shared": "共有を表示"},"hint-tips": {+ "confirm-multi-delete-content": "選択したワークシートとフォルダーは完全に削除されます。",+ "confirm-multi-delete-title": "選択した項目を削除しますか?","confirm-to-delete-sheet-title": "このワークシートを削除しますか?","confirm-to-duplicate-sheet": "このワークシートをコピーしてもよろしいですか?","delete-all-sheets": "すべてのファイルを削除する",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 6f0f168f50..948a59e01a 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -2605,6 +2605,8 @@"show-shared": "Hiển thị chia sẻ"},"hint-tips": {+ "confirm-multi-delete-content": "Các bảng tính và thư mục đã chọn sẽ bị xóa vĩnh viễn.",+ "confirm-multi-delete-title": "Xóa các mục đã chọn?","confirm-to-delete-sheet-title": "Xác nhận xóa bảng tính này?","confirm-to-duplicate-sheet": "Xác nhận nhân bản trang tính này?","delete-all-sheets": "Xóa tất cả các tập tin",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex f34d2ddf93..b7e1e53dc8 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2605,6 +2605,8 @@"show-shared": "显示共享"},"hint-tips": {+ "confirm-multi-delete-content": "选中的工作表和文件夹将被永久删除。",+ "confirm-multi-delete-title": "删除选中的项目?","confirm-to-delete-sheet-title": "确认删除此工作表?","confirm-to-duplicate-sheet": "确定要复制这条工作表?","delete-all-sheets": "删除所有文件",diff --git a/frontend/src/react/components/sql-editor/SharePopoverBody.test.tsx b/frontend/src/react/components/sql-editor/SharePopoverBody.test.tsxindex 195db8fd5f..07e2527cdd 100644--- a/frontend/src/react/components/sql-editor/SharePopoverBody.test.tsx+++ b/frontend/src/react/components/sql-editor/SharePopoverBody.test.tsx@@ -235,7 +235,11 @@ describe("SharePopoverBody", () => {test("copy button writes to clipboard and pushes notification", async () => {const { container, render, unmount } = renderIntoContainer(- <SharePopoverBody worksheet={mockWorksheet as never} />+ <SharePopoverBody+ worksheet={+ { ...mockWorksheet, visibility: 1 /* PROJECT_READ */ } as never+ }+ />);render();@@ -268,4 +272,20 @@ describe("SharePopoverBody", () => {expect(copyBtn.disabled).toBe(true);unmount();});++ test("copy button enabled for a private worksheet (share status ignored)", () => {+ // mockWorksheet is PRIVATE; the copy button stays enabled regardless of+ // share status, gated only by the tab's saved state.+ const { container, render, unmount } = renderIntoContainer(+ <SharePopoverBody worksheet={mockWorksheet as never} />+ );+ render();++ const copyBtn = container.querySelector(+ "[data-copy-btn]"+ ) as HTMLButtonElement;+ expect(copyBtn).not.toBeNull();+ expect(copyBtn.disabled).toBe(false);+ unmount();+ });});diff --git a/frontend/src/react/components/sql-editor/SharePopoverBody.tsx b/frontend/src/react/components/sql-editor/SharePopoverBody.tsxindex 00fffd938a..0e73a9f5a4 100644--- a/frontend/src/react/components/sql-editor/SharePopoverBody.tsx+++ b/frontend/src/react/components/sql-editor/SharePopoverBody.tsx@@ -8,6 +8,7 @@ import {} from "lucide-react";import { useEffect, useMemo, useState } from "react";import { useTranslation } from "react-i18next";+import { Button } from "@/react/components/ui/button";import {Popover,PopoverContent,@@ -219,29 +220,34 @@ export function SharePopoverBody({ worksheet }: Props) {</Popover></section>- {/* Link input + copy button */}- <div className="flex items-center gap-x-0">- {/* Link icon prefix */}- <div className="flex items-center justify-center px-2 py-1 border border-r-0 border-control-border bg-control-bg rounded-l-xs h-8">+ {/* Link input + copy button — single bordered container with rounded+ inner corners. No group-level focus ring; only the input shows a+ focus highlight. */}+ <div className="flex items-center h-8 rounded-xs border border-control-border overflow-hidden">+ {/* Link icon prefix (gray addon) */}+ <div className="flex items-center justify-center h-full px-2 bg-control-bg text-control-light border-r border-control-border"><Link2 className="size-5" /></div>- {/* URL input */}+ {/* URL input — always read-only; the link itself is not editable. */}<inputtype="text"readOnlyvalue={sharedTabLink}- className="flex-1 min-w-0 px-2 py-1 border border-control-border bg-control-bg text-control text-sm h-8 focus:outline-none"+ className="flex-1 min-w-0 h-full px-2 bg-white text-control text-sm cursor-text appearance-none border-0 shadow-none outline-hidden focus:outline-hidden focus:ring-0 focus:border-0 focus:shadow-none"/>- {/* Copy button */}- <button+ {/* Copy button — always available regardless of share status; only+ disabled while the tab has unsaved changes. */}+ <Buttontype="button"+ variant="ghost"+ size="sm"data-copy-btndisabled={tabStatus !== "CLEAN"}onClick={handleCopyLink}- className="flex items-center justify-center px-2 py-1 border border-l-0 border-control-border bg-control-bg rounded-r-xs h-8 text-control-light hover:text-main disabled:opacity-50 disabled:cursor-not-allowed"+ className="h-full rounded-none border-l border-control-border bg-white enabled:hover:bg-control-bg-hover enabled:hover:text-main disabled:bg-control-bg focus-visible:ring-inset focus-visible:ring-offset-0"><Copy className="size-4" />- </button>+ </Button></div></div>);diff --git a/frontend/src/react/components/sql-editor/SheetTree.tsx b/frontend/src/react/components/sql-editor/SheetTree.tsxindex 543837892c..3ba39e39ac 100644--- a/frontend/src/react/components/sql-editor/SheetTree.tsx+++ b/frontend/src/react/components/sql-editor/SheetTree.tsx@@ -114,6 +114,11 @@ type DeleteDialogState =folders: string[];worksheets: string[];}+ | {+ type: "multi-delete";+ folders: string[];+ worksheets: string[];+ }| {type: "duplicate-folder-name";existingLabel: string;@@ -628,7 +633,7 @@ export function SheetTree({// ---- handleMultiDelete (exposed via ref) ---------------------------------const handleMultiDelete = useCallback(- async (nodes: WorksheetFolderNode[]) => {+ (nodes: WorksheetFolderNode[]): Promise<void> => {const folders: string[] = [];const worksheets: string[] = [];for (const node of nodes) {@@ -651,14 +656,25 @@ export function SheetTree({}folders.push(node.key);}- const removed = await handleDeleteFolders(folders, worksheets);- if (removed) {- onMultiSelectModeChange?.(false);+ if (folders.length === 0 && worksheets.length === 0) {+ return Promise.resolve();}+ // Multi-select is explicit: delete exactly what was checked. Checking a+ // folder already auto-includes its descendants, so the selection captures+ // the user's full intent. We must NOT reuse the folder context-menu's+ // "Non-empty folder → move to root vs delete" prompt here — that prompt+ // exists for deleting a single folder whose worksheets weren't selected.+ return new Promise<void>((resolve) => {+ multiDeleteResolveRef.current = resolve;+ setDeleteDialogState({ type: "multi-delete", folders, worksheets });+ });},- [folderContext, handleDeleteFolders, onMultiSelectModeChange]+ [folderContext]);+ // Ref to hold the pending promise resolve for the multi-delete dialog.+ const multiDeleteResolveRef = useRef<(() => void) | null>(null);+// Expose handleMultiDelete via an imperative ref so WorksheetPane can call ituseImperativeHandle(ref, () => ({ handleMultiDelete }), [handleMultiDelete]);@@ -1254,6 +1270,55 @@ export function SheetTree({);};+ // ---- Multi-delete dialog -------------------------------------------------+ const renderMultiDeleteDialog = () => {+ const isOpen = deleteDialogState.type === "multi-delete";+ const finish = () => {+ setDeleteDialogState({ type: "none" });+ const resolve = multiDeleteResolveRef.current;+ multiDeleteResolveRef.current = null;+ resolve?.();+ };+ return (+ <AlertDialog open={isOpen}>+ <AlertDialogContent>+ <AlertDialogTitle>+ {t("sheet.hint-tips.confirm-multi-delete-title")}+ </AlertDialogTitle>+ <AlertDialogDescription>+ {t("sheet.hint-tips.confirm-multi-delete-content")}+ </AlertDialogDescription>+ <AlertDialogFooter>+ <Button variant="outline" size="sm" onClick={finish}>+ {t("common.cancel")}+ </Button>+ <Button+ variant="destructive"+ size="sm"+ onClick={async () => {+ if (deleteDialogState.type !== "multi-delete") return;+ const { folders, worksheets } = deleteDialogState;+ setDeleteDialogState({ type: "none" });+ if (worksheets.length > 0) {+ await doDeleteWorksheets(worksheets);+ }+ for (const folder of folders) {+ folderContext.removeFolder(folder);+ }+ onMultiSelectModeChange?.(false);+ const resolve = multiDeleteResolveRef.current;+ multiDeleteResolveRef.current = null;+ resolve?.();+ }}+ >+ {t("common.delete")}+ </Button>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ );+ };+// ---- Duplicate folder name dialog ----------------------------------------const renderDuplicateFolderDialog = () => {const isOpen = deleteDialogState.type === "duplicate-folder-name";@@ -1401,6 +1466,7 @@ export function SheetTree({{renderDeleteSheetDialog()}{renderDuplicateSheetDialog()}{renderDeleteFoldersDialog()}+ {renderMultiDeleteDialog()}{renderDuplicateFolderDialog()}</div>);