Skip to content

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

fix: vercel project count

Alaister Younga4f29141e1ad
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/Integration.tsx b/studio/components/interfaces/Organization/IntegrationSettings/Integration.tsx
index f67e692fefc..c0a351aff61 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/Integration.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/Integration.tsx
@@ -21,7 +21,7 @@ import { BASE_PATH } from 'lib/constants'
import { pluralize } from 'lib/helpers'
import { EMPTY_ARR } from 'lib/void'
import { useGithubConnectionConfigPanelSnapshot } from 'state/github-connection-config-panel'
-import { Button, Dropdown, IconChevronDown, IconRefreshCcw, IconTrash } from 'ui'
+import { Button, Dropdown, IconChevronDown, IconTrash } from 'ui'
export interface IntegrationProps {
title: string
@@ -149,7 +149,7 @@ Repository connections for ${title?.toLowerCase()}
)
})}
</div>
- <Markdown content={`${note}`} className="text-scale-900" />
+ {note !== undefined && <Markdown content={note} className="text-scale-900" />}
</ScaffoldSectionContent>
</ScaffoldSection>
</ScaffoldContainer>
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
index 96d9e1d7653..caa0c20383c 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
@@ -3,6 +3,7 @@ import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-or
import { useSelectedOrganization } from 'hooks'
import Integration from './Integration'
import SidePanelVercelProjectLinker from './SidePanelVercelProjectLinker'
+import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query'
const IntegrationSettings = () => {
const org = useSelectedOrganization()
@@ -15,17 +16,27 @@ const IntegrationSettings = () => {
(integration) => integration.integration.name === 'GitHub'
) // github
- vercelIntegrations?.map((x) => {
+ vercelIntegrations?.forEach((x) => {
let data: any = { ...x }
const avatarSrc = data.metadata.account.avatar
? `https://vercel.com/api/www/avatar/${data.metadata.account.avatar}?s=48`
: `https://vercel.com/api/www/avatar?teamId=${data.metadata.account.team_id}&s=48`
- data['metadata']['account']['avatar'] = avatarSrc
- return data
+ data['metadata']['account']['avatar'] = avatarSrc
})
+ // We're only supporting one Vercel integration per org for now
+ // this will need to be updated when we support multiple integrations
+ const vercelIntegration = vercelIntegrations?.[0]
+ const { data: vercelProjectsData } = useVercelProjectsQuery(
+ {
+ organization_integration_id: vercelIntegration?.id,
+ },
+ { enabled: vercelIntegration?.id !== undefined }
+ )
+ const vercelProjectCount = vercelProjectsData?.length ?? 0
+
return (
<>
<Integration
@@ -42,10 +53,14 @@ Connect your Vercel teams to your Supabase organization.
Supabase will keep the right environment variables up to date in each of the projects you assign to a Supabase project.
You can also link multiple Vercel Projects to the same Supabase project.
`}
- note={`
-Your Vercel connection has access to 7 Vercel Projects.
-You can change the scope of the access for Supabase by configuring here.
-`}
+ note={
+ vercelProjectCount > 0
+ ? `
+Your Vercel connection has access to ${vercelProjectCount} Vercel Projects.
+You can change the scope of the access for Supabase by configuring [here](https://vercel.com/dashboard/integrations/${vercelIntegration?.metadata?.configuration_id}).
+`
+ : undefined
+ }
integrations={vercelIntegrations}
/>
<ScaffoldDivider />
@@ -65,9 +80,7 @@ GitHub connections are coming soon.
You will be able to connect a GitHub repository to a Supabase project.
The GitHub app will watch for changes in your repository such as file changes, branch changes as well as pull request activity.
-These connections will be part of a GitHub workflow that is currently in deveopment.
-`}
- note={`
+These connections will be part of a GitHub workflow that is currently in development.
`}
integrations={githubIntegrations}
/>
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx b/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
index 272a0026911..6beed7de861 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker.tsx
@@ -1,12 +1,12 @@
+import { useMemo } from 'react'
+
import ProjectLinker from 'components/interfaces/Integrations/ProjectLinker'
import { Markdown } from 'components/interfaces/Markdown'
import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-org-only'
-import { useVercelProjectConnectionsQuery } from 'data/integrations/integrations-vercel-installed-connections-query'
import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query'
import { useProjectsQuery } from 'data/projects/projects-query'
import { useSelectedOrganization } from 'hooks'
import { EMPTY_ARR } from 'lib/void'
-import { useMemo } from 'react'
import { useGithubConnectionConfigPanelSnapshot } from 'state/github-connection-config-panel'
import { SidePanel } from 'ui'
@@ -38,7 +38,7 @@ const SidePanelVercelProjectLinker = () => {
* Supabase projects available
*/
const { data: supabaseProjectsData } = useProjectsQuery({
- enabled: organizationIntegrationId !== null,
+ enabled: organizationIntegrationId !== undefined,
})
const supabaseProjects = useMemo(
@@ -54,7 +54,7 @@ const SidePanelVercelProjectLinker = () => {
{
organization_integration_id: organizationIntegrationId,
},
- { enabled: organizationIntegrationId !== null }
+ { enabled: organizationIntegrationId !== undefined }
)
const vercelProjects = useMemo(() => vercelProjectsData ?? EMPTY_ARR, [vercelProjectsData])
diff --git a/studio/state/github-connection-config-panel.ts b/studio/state/github-connection-config-panel.ts
index 915c6ec5fe8..78feb1a3615 100644
--- a/studio/state/github-connection-config-panel.ts
+++ b/studio/state/github-connection-config-panel.ts
@@ -5,9 +5,9 @@ export const githubConnectionConfigPanelState = proxy({
setOpen: (open: boolean) => {
githubConnectionConfigPanelState.open = open
},
- organizationIntegrationId: '' as string,
- setOrganizationIntegrationId: (organizationInterationId: string) => {
- githubConnectionConfigPanelState.organizationIntegrationId = organizationInterationId
+ organizationIntegrationId: undefined as string | undefined,
+ setOrganizationIntegrationId: (organizationIntegrationId: string) => {
+ githubConnectionConfigPanelState.organizationIntegrationId = organizationIntegrationId
},
})