diff --git a/apps/studio/components/grid/components/grid/ColumnHeader.tsx b/apps/studio/components/grid/components/grid/ColumnHeader.tsx index b240639756..4e7e7279ac 100644 --- a/apps/studio/components/grid/components/grid/ColumnHeader.tsx +++ b/apps/studio/components/grid/components/grid/ColumnHeader.tsx @@ -87,6 +87,7 @@ export function ColumnHeader({ className="flex items-center" onClick={() => openSheet(column.name as string)} > + View {column.name} index suggestion diff --git a/apps/studio/components/grid/components/grid/Grid.tsx b/apps/studio/components/grid/components/grid/Grid.tsx index d77aa3a331..dd29d33d39 100644 --- a/apps/studio/components/grid/components/grid/Grid.tsx +++ b/apps/studio/components/grid/components/grid/Grid.tsx @@ -225,7 +225,14 @@ export const Grid = memo( } }, [rowClass]) - const sensors = useSensors(useSensor(PointerSensor)) + const sensors = useSensors( + useSensor(PointerSensor, { + activationConstraint: { + delay: 150, + tolerance: 5, + }, + }) + ) const [draggedColumn, setDraggedColumn] = useState(undefined) return ( diff --git a/e2e/studio/features/index-advisor.spec.ts b/e2e/studio/features/index-advisor.spec.ts index bfe5817ddf..c35d1d8767 100644 --- a/e2e/studio/features/index-advisor.spec.ts +++ b/e2e/studio/features/index-advisor.spec.ts @@ -6,8 +6,6 @@ import { releaseFileOnceCleanup, withFileOnceSetup } from '../utils/once-per-fil import { test, withSetupCleanup } from '../utils/test.js' import { toUrl } from '../utils/to-url.js' -const TEST_TABLE_NAME = 'pw_test_index_advisor' - test.describe('Index Advisor', () => { test.beforeAll(async () => { await withFileOnceSetup(import.meta.url, async () => { @@ -38,6 +36,7 @@ test.describe('Index Advisor', () => { }) test('should show Index Advisor warnings in Query Performance', async ({ page, ref }) => { + const TEST_TABLE_NAME = 'pw_test_index_advisor' await using _ = await withSetupCleanup( async () => { await createTable(TEST_TABLE_NAME, 'name', [ @@ -70,4 +69,37 @@ test.describe('Index Advisor', () => { timeout: 30000, }) }) + + test('should show Index Advisor warnings in Table Editor', async ({ page, ref }) => { + const TEST_TABLE_NAME = 'pw_test_index_advisor_editor' + await using _ = await withSetupCleanup( + async () => { + await createTable(TEST_TABLE_NAME, 'name', [ + { + name: 'test', + }, + { + name: 'demo', + }, + { + name: 'test', + }, + ]) + }, + async () => { + await dropTable(TEST_TABLE_NAME) + } + ) + + // Run query that need indexes + await query(`SELECT * FROM ${TEST_TABLE_NAME} WHERE name = 'test';`) + + // Navigate to table editor page + await page.goto(toUrl(`/project/${ref}/editor?schema=public`)) + await page.getByLabel(`View ${TEST_TABLE_NAME}`).click() + await expect(page.getByText('demo')).toBeVisible() + await page.waitForLoadState('networkidle') + await page.getByRole('button', { name: `View name index suggestion`, exact: true }).click() + await expect(page.getByRole('dialog', { name: 'Index Recommendation' })).toBeVisible() + }) }) diff --git a/e2e/studio/features/table-editor.spec.ts b/e2e/studio/features/table-editor.spec.ts index 4f1a3014db..c030b6c689 100644 --- a/e2e/studio/features/table-editor.spec.ts +++ b/e2e/studio/features/table-editor.spec.ts @@ -1753,4 +1753,26 @@ testRunner('table editor', () => { exact: true, }) }) + + test('Can double-click a column name to copy it', async ({ page, ref }) => { + const tableName = 'pw_table_column_click' + + // create table + verify that this exists. + await using _ = await withSetupCleanup( + () => createTableWithRLS(tableName, 'pw_column'), + async () => { + await dropTable(tableName) + } + ) + await page.goto(toUrl(`/project/${ref}/editor?schema=public`)) + await page.getByLabel(`View ${tableName}`).click() + await expect(page.getByRole('button', { name: 'pw_column', exact: true })).toBeVisible() + await page.getByRole('button', { name: 'pw_column', exact: true }).dblclick() + await page.keyboard.press('ControlOrMeta+C') + await expectClipboardValue({ + page, + value: 'pw_column', + exact: true, + }) + }) })