The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
updating to use slug
Jonathan Summers-Muirc10ad8f01e95
diff --git a/studio/components/interfaces/Integrations/IntegrationPanels.tsx b/studio/components/interfaces/Integrations/IntegrationPanels.tsxindex ae9fdbde404..429a06bfc50 100644--- a/studio/components/interfaces/Integrations/IntegrationPanels.tsx+++ b/studio/components/interfaces/Integrations/IntegrationPanels.tsx@@ -40,7 +40,7 @@ const HandleIcon = ({ type }: { type: HandleIconType }) => {breakcase 'Supabase':- return <img src="/img/supabase-logo.svg" alt="Supabase" className="w-3.5"></img>+ return <img src={`${BASE_PATH}/img/supabase-logo.svg`} alt="Supabase" className="w-3.5"></img>breakdefault:diff --git a/studio/components/interfaces/Integrations/ProjectLinker.tsx b/studio/components/interfaces/Integrations/ProjectLinker.tsxindex 3b0553124f1..4f384ec30be 100644--- a/studio/components/interfaces/Integrations/ProjectLinker.tsx+++ b/studio/components/interfaces/Integrations/ProjectLinker.tsx@@ -12,6 +12,7 @@ import { Button, IconArrowRight, IconPlus, IconX, Input, Listbox, Select, cn } finterface Project {id: stringname: string+ ref: string}// to do: move this somewhere@@ -37,7 +38,7 @@ const ProjectLinker = ({}: ProjectLinkerProps) => {const { ui } = useStore()- const [supabaseProjectId, setSupabaseProjectId] = useState(UNDEFINED_SELECT_VALUE)+ const [supabaseProjectRef, setSupabaseProjectRef] = useState(UNDEFINED_SELECT_VALUE)const [vercelProjectId, setVercelProjectId] = useState(UNDEFINED_SELECT_VALUE)// function addConnection() {@@ -73,8 +74,8 @@ const ProjectLinker = ({organizationIntegrationId,connection: {foreign_project_id: vercelProjectId,- supabase_project_id: supabaseProjectId,- integrationId: INTEGRATION_INTERNAL_ID,+ supabase_project_ref: supabaseProjectRef,+ integration_id: INTEGRATION_INTERNAL_ID,metadata: {...projectDetails,supabaseConfig: {@@ -129,16 +130,16 @@ const ProjectLinker = ({</div><ListboxclassName="w-full"- value={supabaseProjectId ?? UNDEFINED_SELECT_VALUE}- onChange={(e) => setSupabaseProjectId(e)}+ value={supabaseProjectRef ?? UNDEFINED_SELECT_VALUE}+ onChange={(e) => setSupabaseProjectRef(e)}><Listbox.Option value={UNDEFINED_SELECT_VALUE} label="Choose a project" disabled>- Choose a Supabase project+ Choose project</Listbox.Option>{supabaseProjects.map((project) => (<Listbox.Optionkey={project.id}- value={project.id}+ value={project.ref}label={project.name}addOnBefore={() => {return (@@ -178,7 +179,7 @@ const ProjectLinker = ({onChange={(e) => setVercelProjectId(e)}><Listbox.Option value={UNDEFINED_SELECT_VALUE} label="Choose a project" disabled>- Choose a Vercel project+ Choose Vercel project</Listbox.Option>{filteredForeignProjects.map((project) => {return (@@ -193,7 +194,7 @@ const ProjectLinker = ({vercelIcon) : (<img- src={`/img/icons/frameworks/${project.framework}.svg`}+ src={`${BASE_PATH}/img/icons/frameworks/${project.framework}.svg`}width={21}height={21}alt={`icon`}diff --git a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsxindex e2932027eba..88efe9e86d9 100644--- a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx+++ b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx@@ -1,17 +1,13 @@-import { useParams } from 'common'import { ScaffoldDivider } from 'components/layouts/Scaffold'import { useIntegrationsQuery } from 'data/integrations/integrations-query'import { useStore } from 'hooks'import { observer } from 'mobx-react-lite'-import GitHubRepoSelection from './SidePanelGitHubRepoSelection'import Integration from './Integration'-import SidePanelGitHubRepoSelection from './SidePanelGitHubRepoSelection'import SidePanelVercelProjectLinker from './SidePanelVercelProjectLinker'const IntegrationSettings = () => {const { ui } = useStore()- const { slug } = useParams()- const { data } = useIntegrationsQuery({ orgId: ui.selectedOrganization?.id })+ const { data } = useIntegrationsQuery({ orgSlug: ui.selectedOrganization?.slug })const org = ui.selectedOrganizationdiff --git a/studio/data/integrations/integration-connections-create-mutation.ts b/studio/data/integrations/integration-connections-create-mutation.tsindex aa73ad05b9a..b6605601fd6 100644--- a/studio/data/integrations/integration-connections-create-mutation.ts+++ b/studio/data/integrations/integration-connections-create-mutation.ts@@ -6,9 +6,9 @@ import { integrationKeys } from './keys'export type IntegrationConnectionsCreateVariables = {organizationIntegrationId: stringconnection: {- foreignProjectId: string- supabaseProjectId: string- integrationId: number+ foreign_project_id: string+ supabase_project_ref: string+ integration_id: numbermetadata: any}orgId: number | undefineddiff --git a/studio/data/integrations/integrations-query.ts b/studio/data/integrations/integrations-query.tsindex 4467bbf9b9f..d0c01593a57 100644--- a/studio/data/integrations/integrations-query.ts+++ b/studio/data/integrations/integrations-query.ts@@ -144,7 +144,7 @@ export type IntegrationProjectConnection = {}export type IntegrationsVariables = {- orgId?: number+ orgSlug?: string}export type IntegrationProjectConnectionPayload = {@@ -180,12 +180,12 @@ export type Integration = {export type IntegrationsResponse = Integration[]-export async function getIntegrations({ orgId }: IntegrationsVariables, signal?: AbortSignal) {- if (!orgId) {- throw new Error('orgId is required')+export async function getIntegrations({ orgSlug }: IntegrationsVariables, signal?: AbortSignal) {+ if (!orgSlug) {+ throw new Error('orgSlug is required')}- const response = await get(`${API_URL}/integrations/${orgId}`, {+ const response = await get(`${API_URL}/integrations/${orgSlug}`, {signal,})if (response.error) {@@ -202,11 +202,11 @@ export type ProjectIntegrationConnectionsData = Awaited<export type IntegrationsError = unknownexport const useIntegrationsQuery = <TData = IntegrationsData>(- { orgId }: IntegrationsVariables,+ { orgSlug }: IntegrationsVariables,{ enabled = true, ...options }: UseQueryOptions<IntegrationsData, IntegrationsError, TData> = {}) =>useQuery<IntegrationsData, IntegrationsError, TData>(- integrationKeys.list(orgId),- ({ signal }) => getIntegrations({ orgId }, signal),- { enabled: enabled && typeof orgId !== 'undefined', ...options }+ integrationKeys.list(orgSlug),+ ({ signal }) => getIntegrations({ orgSlug }, signal),+ { enabled: enabled && typeof orgSlug !== 'undefined', ...options })diff --git a/studio/data/integrations/keys.ts b/studio/data/integrations/keys.tsindex b25c9329d41..7164ad8068f 100644--- a/studio/data/integrations/keys.ts+++ b/studio/data/integrations/keys.ts@@ -1,5 +1,5 @@export const integrationKeys = {- list: (orgId: number | undefined) => ['organizations', orgId, 'integrations'] as const,+ list: (orgSlug: string | undefined) => ['organizations', orgSlug, 'integrations'] as const,vercelProjectList: (organization_integration_id: string | undefined) =>['organizations', organization_integration_id, 'vercel-projects'] as const,vercelConnectionsList: (organization_integration_id: string | undefined) =>diff --git a/studio/data/integrations/vercel-integration-create-mutation.ts b/studio/data/integrations/vercel-integration-create-mutation.tsindex 04781212e39..9165c33df2d 100644--- a/studio/data/integrations/vercel-integration-create-mutation.ts+++ b/studio/data/integrations/vercel-integration-create-mutation.ts@@ -5,7 +5,7 @@ import { API_URL } from 'lib/constants'export type VercelIntegrationCreateVariables = {code: stringconfigurationId: string- orgId: number+ orgSlug: stringmetadata: { [key: string]: string }source: string// teamId is only present when a team is being installed@@ -16,16 +16,16 @@ export type VercelIntegrationCreateVariables = {export async function createVercelIntegration({code,configurationId,- orgId,+ orgSlug,metadata,source,teamId,}: VercelIntegrationCreateVariables) {- console.log('payload', { code, configurationId, orgId, metadata, source, teamId })+ console.log('payload', { code, configurationId, orgSlug, metadata, source, teamId })const response = await post(`${API_URL}/integrations/vercel`, {code,configuration_id: configurationId,- organization_id: orgId,+ organization_slug: orgSlug,metadata,source,teamId,diff --git a/studio/pages/integrations/vercel.tsx b/studio/pages/integrations/vercel.tsxindex 2133b293df6..da33fc04467 100644--- a/studio/pages/integrations/vercel.tsx+++ b/studio/pages/integrations/vercel.tsx@@ -30,8 +30,8 @@ const VercelIntegration: NextPageWithLayout = () => {})function onInstall() {- const orgId = selectedOrg?.id- if (!orgId) {+ const orgSlug = selectedOrg?.slug+ if (!orgSlug) {return ui.setNotification({ category: 'error', message: 'Please select an organization' })}@@ -55,7 +55,7 @@ const VercelIntegration: NextPageWithLayout = () => {mutate({code,configurationId,- orgId,+ orgSlug,metadata,source,teamId: teamId,@@ -69,7 +69,8 @@ const VercelIntegration: NextPageWithLayout = () => {() =>supabaseProjectsData?.filter((project) => project.organization_id === selectedOrg?.id)- .map((project) => ({ id: project.id.toString(), name: project.name })) ?? EMPTY_ARR,+ .map((project) => ({ id: project.id.toString(), name: project.name, ref: project.ref })) ??+ EMPTY_ARR,[selectedOrg?.id, supabaseProjectsData])