Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix issues using new API changes

Jonathan Summers-Muirdc9f9956df3a
diff --git a/studio/components/interfaces/Integrations/ProjectLinker.tsx b/studio/components/interfaces/Integrations/ProjectLinker.tsx
index 7488298a8a8..81e9ca7e6d2 100644
--- a/studio/components/interfaces/Integrations/ProjectLinker.tsx
+++ b/studio/components/interfaces/Integrations/ProjectLinker.tsx
@@ -34,16 +34,16 @@ const ProjectLinker = ({
installedConnections && installedConnections.length > 0
? installedConnections?.map((connection) => {
return {
- foreignProjectId: connection?.foreign_project_id,
- supabaseProjectId: connection?.supabase_project_id,
+ foreign_project_id: connection?.foreign_project_id,
+ supabase_project_id: connection?.supabase_project_id,
integrationId: INTEGRATION_INTERNAL_ID,
metadata: UNDEFINED_METADATA_VALUE,
}
})
: [
{
- foreignProjectId: UNDEFINED_SELECT_VALUE,
- supabaseProjectId: UNDEFINED_SELECT_VALUE,
+ foreign_project_id: UNDEFINED_SELECT_VALUE,
+ supabase_project_id: UNDEFINED_SELECT_VALUE,
integrationId: INTEGRATION_INTERNAL_ID,
metadata: UNDEFINED_METADATA_VALUE,
},
@@ -59,7 +59,7 @@ const ProjectLinker = ({
const newConnections = [...connections]
const projectDetails = foreignProjects.filter((x) => x.id === id)[0]
newConnections[idx].metadata = { ...projectDetails }
- newConnections[idx].foreignProjectId = id
+ newConnections[idx].foreign_project_id = id
newConnections[idx].supabaseConfig = {
projectEnvVars: {
write: true,
@@ -71,7 +71,7 @@ const ProjectLinker = ({
function onSetSupabaseProjectId(idx: number, id: string) {
const newConnections = [...connections]
- newConnections[idx].supabaseProjectId = id
+ newConnections[idx].supabase_project_id = id
setConnections(newConnections)
}
@@ -79,8 +79,8 @@ const ProjectLinker = ({
setConnections([
...connections,
{
- foreignProjectId: UNDEFINED_SELECT_VALUE,
- supabaseProjectId: UNDEFINED_SELECT_VALUE,
+ foreign_project_id: UNDEFINED_SELECT_VALUE,
+ supabase_project_id: UNDEFINED_SELECT_VALUE,
integrationId: INTEGRATION_INTERNAL_ID,
metadata: UNDEFINED_METADATA_VALUE,
},
@@ -117,9 +117,9 @@ const ProjectLinker = ({
connections={connections}
foreignProjects={foreignProjects}
supabaseProjects={supabaseProjects}
- foreignProjectId={connection.foreignProjectId}
+ foreignProjectId={connection.foreign_project_id}
setForeignProjectId={(id) => onSetForeignProjectId(i, id)}
- supabaseProjectId={connection.supabaseProjectId}
+ supabaseProjectId={connection.supabase_project_id}
setSupabaseProjectId={(id) => onSetSupabaseProjectId(i, id)}
removeConnection={() => removeConnection(i)}
canRemove={connections.length > 1}
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
index 7576bb5187c..240cce5449c 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
@@ -11,7 +11,7 @@ import SidePanelVercelProjectLinker from './SidePanelVercelProjectLinker'
const IntegrationSettings = () => {
const { ui } = useStore()
const { slug } = useParams()
- const { data } = useIntegrationsQuery({ orgSlug: slug })
+ const { data } = useIntegrationsQuery({ orgId: ui.selectedOrganization?.id })
const org = ui.selectedOrganization
@@ -71,7 +71,7 @@ You can change the scope of the access for Supabase by configuring here.
integrations={githubIntegrations}
/>
{/* <SidePanelGitHubRepoSelection /> */}
- <SidePanelVercelProjectLinker />
+ {/* <SidePanelVercelProjectLinker /> */}
</>
)
}
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx b/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
index 44132a299db..f5c459773b5 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
@@ -16,8 +16,8 @@ import { useVercelProjectConnectionsQuery } from 'data/integrations/integrations
const SidePanelVercelProjectLinker = () => {
const { ui } = useStore()
- const { slug } = useParams()
- const { data } = useIntegrationsQuery({ orgSlug: slug })
+
+ const { data } = useIntegrationsQuery({ orgId: ui.selectedOrganization?.id })
const vercelIntegrations = data?.filter((integration) => integration.integration.id === 1) // vercel
diff --git a/studio/data/integrations/integration-connections-create-mutation.ts b/studio/data/integrations/integration-connections-create-mutation.ts
index 6881b405fab..3c58ea49072 100644
--- a/studio/data/integrations/integration-connections-create-mutation.ts
+++ b/studio/data/integrations/integration-connections-create-mutation.ts
@@ -17,7 +17,7 @@ export async function createIntegrationConnections({
connections,
}: IntegrationConnectionsCreateVariables) {
const response = await post(`${API_URL}/integrations/vercel/connections`, {
- organizationIntegrationId,
+ organization_integration_id: organizationIntegrationId,
connections,
})
if (response.error) {
diff --git a/studio/data/integrations/integrations-query.ts b/studio/data/integrations/integrations-query.ts
index 1dff671601a..39cc1f7b7ad 100644
--- a/studio/data/integrations/integrations-query.ts
+++ b/studio/data/integrations/integrations-query.ts
@@ -7,20 +7,15 @@ type metadata = {
metadata: {
id: string
supabaseConfig: {
- // branching: {
- // prodBranch: string
- // }
projectEnvVars: {
write: boolean
}
- // supabaseDeploymentConfig: {
- // functions: {
- // deploy: false
- // }
- // }
}
link?:
| {
+ /**
+ * GitHub link
+ */
org?: string
repo?: string
repoId?: number
@@ -39,6 +34,9 @@ type metadata = {
productionBranch?: string
}
| {
+ /**
+ * GitLab link
+ */
projectId?: string
projectName?: string
projectNameWithNamespace?: string
@@ -59,6 +57,9 @@ type metadata = {
productionBranch?: string
}
| {
+ /**
+ * Bitbucket link
+ */
name?: string
slug?: string
owner?: string
@@ -138,7 +139,7 @@ export type IntegrationProjectConnection = {
}
export type IntegrationsVariables = {
- orgSlug?: string
+ orgId?: number
}
export type IntegrationProjectConnectionPayload = {
@@ -174,87 +175,12 @@ export type Integration = {
export type IntegrationsResponse = Integration[]
-export async function getIntegrations({ orgSlug }: IntegrationsVariables, signal?: AbortSignal) {
- if (!orgSlug) {
- throw new Error('orgSlug is required')
+export async function getIntegrations({ orgId }: IntegrationsVariables, signal?: AbortSignal) {
+ if (!orgId) {
+ throw new Error('orgId is required')
}
- // const response: IntegrationsResponse = [
- // {
- // id: '1',
- // type: 'VERCEL',
- // createdBy: '[email protected]',
- // createdAt: '2023-06-05T06:56:25.565Z',
- // metadata: {
- // vercelTeam: 'alaister-team',
- // },
- // connections: [
- // {
- // id: '1.0',
- // createdAt: '2023-06-05T01:56:25.565Z',
- // to: {
- // name: 'www prod',
- // },
- // from: {
- // name: 'alaister project prod',
- // },
- // },
- // {
- // id: '1.1',
- // createdAt: '2023-06-14T06:56:25.565Z',
- // to: {
- // name: 'www staging',
- // },
- // from: {
- // name: 'alaister project staging',
- // },
- // },
- // {
- // id: '1.1',
- // createdAt: '2023-06-02T21:56:25.565Z',
- // to: {
- // name: 'bees knees',
- // },
- // from: {
- // name: 'jonny bee project',
- // },
- // },
- // ],
- // },
- // {
- // id: '2',
- // type: 'VERCEL',
- // createdBy: '[email protected]',
- // createdAt: '2023-06-05T06:56:25.565Z',
- // metadata: {
- // vercelTeam: 'alaister-team',
- // },
- // connections: [],
- // },
- // {
- // id: '3',
- // type: 'GITHUB',
- // createdBy: 'Alaister',
- // createdAt: '2023-06-05T06:56:25.565Z',
- // metadata: {
- // gitHubConnectionOwner: 'alaister',
- // },
- // connections: [
- // {
- // id: '1.2',
- // createdAt: '2023-06-05T06:56:25.565Z',
- // to: {
- // name: 'supabase/supabase',
- // },
- // from: {
- // name: 'alaister project',
- // },
- // },
- // ],
- // },
- // ]
-
- const response = await get(`${API_URL}/integrations/${orgSlug}`, {
+ const response = await get(`${API_URL}/integrations/${orgId}`, {
signal,
})
if (response.error) {
@@ -264,24 +190,6 @@ export async function getIntegrations({ orgSlug }: IntegrationsVariables, signal
return response as IntegrationsResponse
}
-// export async function getProjectIntegrationConnections(
-// { orgSlug }: IntegrationsVariables,
-// signal?: AbortSignal
-// ) {
-// if (!orgSlug) {
-// throw new Error('orgSlug is required')
-// }
-
-// const response = await get(`${API_URL}/integrations`, {
-// signal,
-// })
-// if (response.error) {
-// throw response.error
-// }
-
-// return response as IntegrationsResponse
-// }
-
export type IntegrationsData = Awaited<ReturnType<typeof getIntegrations>>
export type ProjectIntegrationConnectionsData = Awaited<
ReturnType<typeof getProjectIntegrationConnections>
@@ -289,11 +197,11 @@ export type ProjectIntegrationConnectionsData = Awaited<
export type IntegrationsError = unknown
export const useIntegrationsQuery = <TData = IntegrationsData>(
- { orgSlug }: IntegrationsVariables,
+ { orgId }: IntegrationsVariables,
{ enabled = true, ...options }: UseQueryOptions<IntegrationsData, IntegrationsError, TData> = {}
) =>
useQuery<IntegrationsData, IntegrationsError, TData>(
- integrationKeys.list(orgSlug),
- ({ signal }) => getIntegrations({ orgSlug }, signal),
- { enabled: enabled && typeof orgSlug !== 'undefined', ...options }
+ integrationKeys.list(orgId),
+ ({ signal }) => getIntegrations({ orgId }, signal),
+ { enabled: enabled && typeof orgId !== 'undefined', ...options }
)
diff --git a/studio/data/integrations/integrations-vercel-projects-query.ts b/studio/data/integrations/integrations-vercel-projects-query.ts
index da159791234..493cfd83dae 100644
--- a/studio/data/integrations/integrations-vercel-projects-query.ts
+++ b/studio/data/integrations/integrations-vercel-projects-query.ts
@@ -25,7 +25,7 @@ export async function getVercelProjects({ orgId }: VercelProjectsVariables, sign
throw new Error('orgId is required')
}
- const response = await get(`${API_URL}/integrations/vercel/projects/${orgId}`, {
+ const response = await get(`${API_URL}/integrations/vercel/connections/${orgId}`, {
signal,
})
if (response.error) {