mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 19:35:06 +03:00
<img width="1289" height="863" alt="image" src="https://github.com/user-attachments/assets/d661f107-b358-4894-8531-80441d60ab91" /> GitHub integration is now available on the free plan and so we'd like to start promoting code-first workflows as much as possible. One way to do that is to set the tone straight away by asking a user to connecting their GitHub repository to a project as part of project creation. This PR: - decouples GitHub connection and repo selection into a separate component we can make use of in integration settings and project creation. - Adds new GitHub fields to project creation form and sends them off to project creation endpoint - Pre-fills project name based on repo selection To test locally: - Ensure you have GitHub integration set up locally (using ngrok etc) - Ensure you are on the connected platform branch - Open create a new project page - Connect GitHub as part of the creation form and select a repo - Create the project and wait for status to be healthy - Check project settings integrations page and ensure repo is connected Note: - this requires changes on the management api end to accept new GitHub fields - it might make sense to pull out GitHub connection/authorization from GitHub repository selection but in the current state they are tied together. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * GitHub repository selection now available during project creation with integrated authorization flow * GitHub connection status and compute availability indicators now displayed on project dashboard * Project name auto-populates from selected GitHub repository name when available <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
96 lines
3.8 KiB
TypeScript
96 lines
3.8 KiB
TypeScript
import { ReactFlowProvider } from '@xyflow/react'
|
|
import Link from 'next/link'
|
|
import { Badge, cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
|
|
|
|
import { InstanceConfiguration } from '../Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration'
|
|
import { ActivityStats } from '@/components/interfaces/ProjectHome/ActivityStats'
|
|
import { ProjectConnectionPopover } from '@/components/interfaces/ProjectHome/ProjectConnectionPopover'
|
|
import { ProjectPausedState } from '@/components/layouts/ProjectLayout/PausedState/ProjectPausedState'
|
|
import { InlineLink } from '@/components/ui/InlineLink'
|
|
import { ProjectUpgradeFailedBanner } from '@/components/ui/ProjectUpgradeFailedBanner'
|
|
import { useBranchesQuery } from '@/data/branches/branches-query'
|
|
import { useProjectDetailQuery } from '@/data/projects/project-detail-query'
|
|
import { useIsOrioleDb, useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
|
|
import { DOCS_URL, PROJECT_STATUS } from '@/lib/constants'
|
|
|
|
export const TopSection = () => {
|
|
const isOrioleDb = useIsOrioleDb()
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const { data: parentProject } = useProjectDetailQuery({ ref: project?.parent_project_ref })
|
|
|
|
const { data: branches } = useBranchesQuery({
|
|
projectRef: project?.parent_project_ref ?? project?.ref,
|
|
})
|
|
|
|
const mainBranch = branches?.find((branch) => branch.is_default)
|
|
const currentBranch = branches?.find((branch) => branch.project_ref === project?.ref)
|
|
const isMainBranch = currentBranch?.name === mainBranch?.name
|
|
|
|
const isPaused = project?.status === PROJECT_STATUS.INACTIVE
|
|
const projectName =
|
|
currentBranch && !isMainBranch
|
|
? currentBranch.name
|
|
: project?.name
|
|
? project.name
|
|
: 'Welcome to your project'
|
|
|
|
if (isPaused) {
|
|
return <ProjectPausedState />
|
|
}
|
|
|
|
return (
|
|
<div className="flex flex-col gap-y-4">
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 py-0 w-full items-center">
|
|
<div className="flex flex-col">
|
|
<div className="flex flex-row flex-wrap items-center gap-4 w-full">
|
|
<div>
|
|
{!isMainBranch && (
|
|
<Link
|
|
href={`/project/${parentProject?.ref}`}
|
|
className="text-sm text-foreground-light"
|
|
>
|
|
{parentProject?.name}
|
|
</Link>
|
|
)}
|
|
<div className="flex items-center gap-x-2">
|
|
<h1 className="text-3xl">{projectName}</h1>
|
|
{isOrioleDb && (
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Badge variant="warning">OrioleDB</Badge>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="bottom" align="start" className="max-w-80 text-center">
|
|
This project is using Postgres with OrioleDB which is currently in preview and
|
|
not suitable for production workloads. View our{' '}
|
|
<InlineLink href={`${DOCS_URL}/guides/database/orioledb`}>
|
|
documentation
|
|
</InlineLink>{' '}
|
|
for all limitations.
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
)}
|
|
</div>
|
|
<ProjectConnectionPopover projectRef={project?.ref} />
|
|
</div>
|
|
</div>
|
|
<div className="mt-8">
|
|
<ActivityStats />
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div
|
|
className={cn(
|
|
'w-full h-[400px] md:h-[500px] border border-muted rounded-md overflow-hidden flex flex-col relative'
|
|
)}
|
|
>
|
|
<ReactFlowProvider>
|
|
<InstanceConfiguration diagramOnly />
|
|
</ReactFlowProvider>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<ProjectUpgradeFailedBanner />
|
|
</div>
|
|
)
|
|
}
|