The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add integrations to command k (#35550)
Joshen Lim31a804f6d41a
diff --git a/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.utils.ts b/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.utils.tsindex 59ef6d7c1d0..d203281c9d2 100644--- a/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.utils.ts+++ b/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.utils.ts@@ -6,4 +6,5 @@ export const COMMAND_MENU_SECTIONS = {TABLE: 'Table Editor',SQL: 'SQL Editor',DATABASE: 'Database',+ INTEGRATIONS: 'Integrations',} as constdiff --git a/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx b/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsxnew file mode 100644index 00000000000..0651deedf84--- /dev/null+++ b/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx@@ -0,0 +1,63 @@+import { useParams } from 'common'+import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'+import { orderCommandSectionsByPriority } from 'components/interfaces/App/CommandMenu/ordering'+import {+ IntegrationDefinition,+ INTEGRATIONS,+} from 'components/interfaces/Integrations/Landing/Integrations.constants'+import type { CommandOptions } from 'ui-patterns/CommandMenu'+import { useRegisterCommands } from 'ui-patterns/CommandMenu'++export function useIntegrationsGotoCommands(options?: CommandOptions) {+ let { ref } = useParams()+ ref ||= '_'++ const getName = (integration: IntegrationDefinition) => {+ switch (integration.id) {+ case 'cron':+ return 'View and manage your Cron Jobs'+ case 'graphiql':+ return 'Query database using GraphQL'+ case 'vault':+ return 'View and manage your keys and secrets via Vault'+ default:+ return `View and manage your ${integration.name}${integration.type === 'wrapper' ? 's' : ''}`+ }+ }++ useRegisterCommands(+ COMMAND_MENU_SECTIONS.NAVIGATE,+ INTEGRATIONS.map((x) => {+ return {+ id: `nav-integrations-${x.id}`,+ name: x.name,+ value: `Integrations: ${x.name}`,+ route: `/project/${ref}/integrations/${x.id}/overview`,+ defaultHidden: true,+ }+ }),+ { ...options, deps: [ref] }+ )++ useRegisterCommands(+ COMMAND_MENU_SECTIONS.INTEGRATIONS,+ INTEGRATIONS.map((x) => {+ return {+ id: `manage-${x.id}`,+ name: getName(x),+ route: `/project/${ref}/integrations/${x.id}/overview`,+ icon: () => (+ <div className="w-6 h-6 relative bg-white border rounded-md flex items-center justify-center [&>img]:!p-1 [&>svg]:!p-1">+ {x.icon()}+ </div>+ ),+ }+ }),+ {+ ...options,+ deps: [ref],+ orderSection: orderCommandSectionsByPriority,+ sectionMeta: { priority: 3 },+ }+ )+}diff --git a/apps/studio/components/layouts/useLayoutNavCommands.ts b/apps/studio/components/layouts/useLayoutNavCommands.tsindex 63d19540e11..1957bcc7278 100644--- a/apps/studio/components/layouts/useLayoutNavCommands.ts+++ b/apps/studio/components/layouts/useLayoutNavCommands.ts@@ -4,6 +4,7 @@ import { useAdvisorsGoToCommands } from './AdvisorsLayout/Advisors.Commands'import { useAuthGotoCommands } from './AuthLayout/Auth.Commands'import { useDatabaseGotoCommands } from './DatabaseLayout/Database.Commands'import { useFunctionsGotoCommands } from './EdgeFunctionsLayout/EdgeFunctions.Commands'+import { useIntegrationsGotoCommands } from './IntegrationsLayout/Integrations.Commands'import { useLogsGotoCommands } from './LogsLayout/Logs.Commands'import { useProjectSettingsGotoCommands } from './ProjectSettingsLayout/ProjectSettings.Commands'import { useReportsGotoCommands } from './ReportsLayout/Reports.Commands'@@ -25,4 +26,5 @@ export function useLayoutNavCommands() {useReportsGotoCommands({ enabled: isLoggedIn })useApiDocsGotoCommands({ enabled: isLoggedIn })useProjectSettingsGotoCommands({ enabled: isLoggedIn })+ useIntegrationsGotoCommands({ enabled: isLoggedIn })}