Files
Joshen Lim 7d63d764fc Joshenlim/fe 4712 cmd k support searching for database tables (#52205)
## Context

Looking into some kaizen improvements for Cmd+K, with the overarching
idea to make Cmd+K resource-aware so finding and inspecting anything in
a project doesn't depend on knowing where it lives in the dashboard.

Specifically looking into database entities for now - end state would be
that you could search for a table name for example, and Cmd K will pull
up everything *related* to that table for you to skim (e.g Policies,
Functions, Triggers, etc). Changes in this PR sets the foundation here
by starting with just the tables.
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/65054781-2385-416c-aed9-f142380e4454"
/>

This might be similar to how we currently support searching for database
entities via these "Queries" section, but these only search within the
context of the entity category, not across (e.g only tables, only
policies)
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/66ca16c6-9551-4134-b1e1-0b0c4b004085"
/>

The idea isn't to replace this, but provide another way to find your
database entities so that
- You can see related entities to what you're searching at a glance
- You don't need to go to a 2nd level nav in Cmd K 

Also fwiw the bulk of the LOC changes in here are mainly tests actually,
actual LOC changes are +385, -22
2026-10-23 23:24:56 +08:00

73 lines
2.5 KiB
TypeScript

import { IS_PLATFORM } from 'common'
import {
CommandHeader,
CommandMenu,
CommandMenuInput,
CommandMenuList,
} from 'ui-patterns/CommandMenu'
import { useChangelogCommand } from 'ui-patterns/CommandMenu/prepackaged/Changelog'
import { useDocsAiCommands } from 'ui-patterns/CommandMenu/prepackaged/DocsAi'
import { useDocsSearchCommands } from 'ui-patterns/CommandMenu/prepackaged/DocsSearch'
import { useThemeSwitcherCommands } from 'ui-patterns/CommandMenu/prepackaged/ThemeSwitcher'
import { useApiKeysCommands } from './ApiKeys'
import { useApiUrlCommand } from './ApiUrl'
import { useContextSearchCommands } from './ContextSearchCommands'
import { useCreateCommands } from './CreateCommands'
import { useDatabaseEntitySearchCommands } from './DatabaseEntitySearchCommands'
import { useFeaturePreviewCommands } from './FeaturePreviews'
import { orderCommandSectionsByPriority } from './ordering'
import { useConfigureOrganizationCommand, useProjectSwitchCommand } from './OrgProjectSwitcher'
import { useSupportCommands } from './Support'
import { useBranchCommands } from '@/components/interfaces/BranchManagement/Branch.Commands'
import { useConnectCommands } from '@/components/interfaces/ConnectButton/Connect.Commands'
import {
useQueryTableCommands,
useSnippetCommands,
} from '@/components/layouts/SQLEditorLayout/SqlEditor.Commands'
import { useProjectLevelTableEditorCommands } from '@/components/layouts/TableEditorLayout/TableEditor.Commands'
import { useLayoutNavCommands } from '@/components/layouts/useLayoutNavCommands'
export function CommandMenuInnerContent() {
return (
<>
<CommandHeader>
<CommandMenuInput />
</CommandHeader>
<CommandMenuList />
</>
)
}
export function StudioCommandMenu() {
useCreateCommands()
useApiKeysCommands()
useApiUrlCommand()
useConnectCommands()
useProjectLevelTableEditorCommands()
useProjectSwitchCommand()
useConfigureOrganizationCommand()
useQueryTableCommands()
useBranchCommands()
useSnippetCommands()
useLayoutNavCommands()
useDocsSearchCommands({
options: { orderSection: orderCommandSectionsByPriority, sectionMeta: { priority: 3 } },
})
useDocsAiCommands({
options: { orderSection: orderCommandSectionsByPriority, sectionMeta: { priority: 3 } },
})
useSupportCommands()
useChangelogCommand({ enabled: IS_PLATFORM })
useThemeSwitcherCommands()
useContextSearchCommands()
useDatabaseEntitySearchCommands()
useFeaturePreviewCommands()
return (
<CommandMenu>
<CommandMenuInnerContent />
</CommandMenu>
)
}