IntegrationSettings() — supabase Function Reference
Architecture documentation for the IntegrationSettings() function in IntegrationSettings.tsx from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx lines 46–195
export const IntegrationSettings = () => {
const router = useRouter()
const { data: org } = useSelectedOrganizationQuery()
const showVercelIntegration = useIsFeatureEnabled('integrations:vercel')
const { can: canReadGithubConnection, isLoading: isLoadingPermissions } =
useAsyncCheckPermissions(PermissionAction.READ, 'integrations.github_connections')
const { can: canCreateGitHubConnection } = useAsyncCheckPermissions(
PermissionAction.CREATE,
'integrations.github_connections'
)
const { can: canUpdateGitHubConnection } = useAsyncCheckPermissions(
PermissionAction.UPDATE,
'integrations.github_connections'
)
const { data: gitHubAuthorization } = useGitHubAuthorizationQuery()
const { data: connections } = useGitHubConnectionsQuery({ organizationId: org?.id })
const { mutate: deleteGitHubConnection } = useGitHubConnectionDeleteMutation({
onSuccess: () => {
toast.success('Successfully deleted GitHub connection')
},
})
const sidePanelsStateSnapshot = useSidePanelsStateSnapshot()
const onAddGitHubConnection = useCallback(() => {
router.push('/project/_/settings/integrations')
}, [sidePanelsStateSnapshot])
const onDeleteGitHubConnection = useCallback(
async (connection: IntegrationProjectConnection) => {
if (!org?.id) {
toast.error('Organization not found')
return
}
deleteGitHubConnection({
connectionId: connection.id,
organizationId: org.id,
})
},
[deleteGitHubConnection, org?.id]
)
/**
* GitHub markdown content
*/
const GitHubTitle = `GitHub Connections`
const GitHubDetailsSection = `
Connect any of your GitHub repositories to a project.
`
const GitHubContentSectionTop = `
### How will GitHub connections work?
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.
`
const GitHubContentSectionBottom = gitHubAuthorization
? `You are authorized with Supabase GitHub App. You can configure your GitHub App installations and repository access [here](${GITHUB_INTEGRATION_INSTALLATION_URL}). You can revoke your authorization [here](${GITHUB_INTEGRATION_REVOKE_AUTHORIZATION_URL}).`
: ''
const GitHubSection = () => (
<ScaffoldContainer>
<ScaffoldSection>
<ScaffoldSectionDetail title={GitHubTitle}>
<Markdown content={GitHubDetailsSection} />
<IntegrationImageHandler title="github" />
</ScaffoldSectionDetail>
<ScaffoldSectionContent>
{isLoadingPermissions ? (
<GenericSkeletonLoader />
) : !canReadGithubConnection ? (
<NoPermission resourceText="view this organization's GitHub connections" />
) : (
<>
<Markdown content={GitHubContentSectionTop} />
<ul className="flex flex-col gap-y-2">
{connections?.map((connection) => (
<IntegrationConnectionItem
key={connection.id}
disabled={!canUpdateGitHubConnection}
connection={{
id: String(connection.id),
added_by: {
id: String(connection.user?.id),
primary_email: connection.user?.primary_email ?? '',
username: connection.user?.username ?? '',
},
foreign_project_id: String(connection.repository.id),
supabase_project_ref: connection.project.ref,
organization_integration_id: 'unused',
inserted_at: connection.inserted_at,
updated_at: connection.updated_at,
metadata: {
name: connection.repository.name,
} as any,
}}
type="GitHub"
onDeleteConnection={onDeleteGitHubConnection}
/>
))}
</ul>
<EmptyIntegrationConnection
onClick={onAddGitHubConnection}
showNode={false}
disabled={!canCreateGitHubConnection}
>
Add new project connection
</EmptyIntegrationConnection>
{GitHubContentSectionBottom && (
<Markdown
extLinks
content={GitHubContentSectionBottom}
className="text-foreground-lighter"
/>
)}
</>
)}
</ScaffoldSectionContent>
</ScaffoldSection>
</ScaffoldContainer>
)
return (
<>
<ScaffoldContainerLegacy>
<ScaffoldTitle>Integrations</ScaffoldTitle>
</ScaffoldContainerLegacy>
<GitHubSection />
{showVercelIntegration && (
<>
<ScaffoldDivider />
<VercelSection isProjectScoped={false} />
<SidePanelVercelProjectLinker />
</>
)}
</>
)
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free