Skip to content

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

chore/Remove option to change production branch (#17925)

Joshen Limb0d6f407e0b3
diff --git a/studio/components/interfaces/BranchManagement/BranchPanels.tsx b/studio/components/interfaces/BranchManagement/BranchPanels.tsx
index 2a2f3b948da..51350384d3c 100644
--- a/studio/components/interfaces/BranchManagement/BranchPanels.tsx
+++ b/studio/components/interfaces/BranchManagement/BranchPanels.tsx
@@ -100,7 +100,7 @@ const MainBranchPanel = ({
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent side="bottom" align="end">
- <Link passHref href={`/project/${ref}/settings/general`}>
+ <Link passHref href={`/project/${ref}/settings/integrations`}>
<DropdownMenuItem
asChild
className="flex gap-2"
diff --git a/studio/components/interfaces/Home/ProjectList/ProjectList.tsx b/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
index 62c56a73916..4ad10333d75 100644
--- a/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
+++ b/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
@@ -18,6 +18,8 @@ import { useState } from 'react'
import { Organization, Project, ResponseError } from 'types'
import ProjectCard from './ProjectCard'
import ShimmeringCard from './ShimmeringCard'
+import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-org-only'
+import { useSelectedOrganization } from 'hooks'
export interface ProjectListProps {
rewriteHref?: (projectRef: string) => string
@@ -98,8 +100,17 @@ const OrganizationProjects = ({
projectsError,
rewriteHref,
}: OrganizationProjectsProps) => {
+ const organization = useSelectedOrganization()
const isEmpty = !projects || projects.length === 0
+ const { data: integrations } = useOrgIntegrationsQuery({ orgSlug: organization?.slug })
+ const githubConnections = integrations
+ ?.filter((integration) => integration.integration.name === 'GitHub')
+ .flatMap((integration) => integration.connections)
+ const vercelConnections = integrations
+ ?.filter((integration) => integration.integration.name === 'Vercel')
+ .flatMap((integration) => integration.connections)
+
const [orgBillingMigrationModalVisible, setOrgBillingMigrationModalVisible] = useState(false)
return (
@@ -158,6 +169,12 @@ const OrganizationProjects = ({
resourceWarnings={resourceWarnings.find(
(resourceWarning) => resourceWarning.project === project.ref
)}
+ githubIntegration={githubConnections?.find(
+ (connection) => connection.supabase_project_ref === project.ref
+ )}
+ vercelIntegration={vercelConnections?.find(
+ (connection) => connection.supabase_project_ref === project.ref
+ )}
/>
))
)}
diff --git a/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx b/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
index e93775fe727..faaf0e0a8b1 100644
--- a/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
+++ b/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
@@ -3,6 +3,9 @@ import { GitBranch, RotateCcw, Shield } from 'lucide-react'
import { useRef, useState } from 'react'
import { useForm } from 'react-hook-form'
import {
+ AlertDescription_Shadcn_,
+ AlertTitle_Shadcn_,
+ Alert_Shadcn_,
Button,
CommandEmpty_Shadcn_,
CommandGroup_Shadcn_,
@@ -134,11 +137,22 @@ const GitHubIntegrationConnectionForm = ({
<p className="text-xs text-light mb-3">
All other branches will be treated as Preview branches
</p>
+
+ <Alert_Shadcn_ className="mb-4 w-96">
+ <AlertTitle_Shadcn_ className="text-sm">
+ Changing Git branch for Production Branch coming soon
+ </AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_ className="text-xs">
+ If you wish to change the Git branch that is used for the Production Branch you will
+ need to disable Branching and opt back in.
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+
{/* <pre>! This should only work if branching is turned on !</pre> */}
<Popover_Shadcn_ open={open} onOpenChange={setOpen} modal={false}>
<PopoverTrigger_Shadcn_ asChild name="branch-selector">
<Button
- disabled={isUpdatingProdBranch}
+ disabled
type="default"
size="medium"
ref={comboBoxRef}
@@ -209,6 +223,17 @@ const GitHubIntegrationConnectionForm = ({
<FormDescription_Shadcn_ className="text-xs text-lighter mb-3">
Migration and seed SQL files will be run from this directory.
</FormDescription_Shadcn_>
+
+ <Alert_Shadcn_ className="mb-4 w-96">
+ <AlertTitle_Shadcn_ className="text-sm">
+ Changing Supabase directory is currently not supported
+ </AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_ className="text-xs">
+ You will need to disable Branching and opt back into Branching to change the
+ Production Branch. your Git repository.
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+
<FormField_Shadcn_
control={form.control}
name="supabaseDirectory"
@@ -217,6 +242,7 @@ const GitHubIntegrationConnectionForm = ({
<FormControl_Shadcn_ className="xl:w-96">
<div className="relative">
<Input_Shadcn_
+ disabled
{...field}
onKeyPress={(event) => {
if (event.key === 'Escape') {
@@ -250,7 +276,10 @@ const GitHubIntegrationConnectionForm = ({
type="secondary"
size="medium"
loading={isUpdatingGithubConnection}
- disabled={isUpdatingGithubConnection}
+ disabled={
+ field.value === connection.metadata?.supabaseConfig?.supabaseDirectory ||
+ isUpdatingGithubConnection
+ }
>
Update
</Button>
diff --git a/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.ts b/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.ts
index 37d0fe969dc..1e433fd6ef4 100644
--- a/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.ts
+++ b/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.ts
@@ -33,7 +33,7 @@ export const generateSettingsMenu = (
? [
{
name: 'Integrations',
- key: 'Integrations',
+ key: 'integrations',
url: `/project/${ref}/settings/integrations`,
items: [],
},
diff --git a/studio/pages/integrations/github/[integrationId]/choose-project.tsx b/studio/pages/integrations/github/[integrationId]/choose-project.tsx
index b2bda6ff510..6c170e62916 100644
--- a/studio/pages/integrations/github/[integrationId]/choose-project.tsx
+++ b/studio/pages/integrations/github/[integrationId]/choose-project.tsx
@@ -33,8 +33,10 @@ const ChooseProjectGitHubPage: NextPageWithLayout = () => {
orgSlug,
})
const { data: organizations } = useOrganizationsQuery()
- const { data: allProjects } = useProjectsQuery()
- const { data: allRepos } = useGitHubReposQuery({ integrationId })
+ const { data: allProjects, isLoading: isLoadingSupabaseProjectsData } = useProjectsQuery()
+ const { data: allRepos, isLoading: isLoadingGithubReposData } = useGitHubReposQuery({
+ integrationId,
+ })
const integration = integrations?.find((integration) => integration.id === integrationId)
const organization = organizations?.find((organization) => organization.slug === orgSlug)
@@ -93,6 +95,8 @@ This Supabase integration will allow you to link a Supabase project to a GitHub
onSkip={() => {
router.push(`/org/${orgSlug}/integrations`)
}}
+ loadingForeignProjects={isLoadingGithubReposData}
+ loadingSupabaseProjects={isLoadingSupabaseProjectsData}
/>
</ScaffoldContainer>
</>
diff --git a/studio/pages/org/[slug]/index.tsx b/studio/pages/org/[slug]/index.tsx
index fbafe9e4dd7..b4cd02d27ed 100644
--- a/studio/pages/org/[slug]/index.tsx
+++ b/studio/pages/org/[slug]/index.tsx
@@ -30,6 +30,9 @@ const ProjectsPage: NextPageWithLayout = () => {
const githubConnections = integrations
?.filter((integration) => integration.integration.name === 'GitHub')
.flatMap((integration) => integration.connections)
+ const vercelConnections = integrations
+ ?.filter((integration) => integration.integration.name === 'Vercel')
+ .flatMap((integration) => integration.connections)
return (
<ScaffoldContainer className="h-full overflow-y-auto">
@@ -84,6 +87,9 @@ const ProjectsPage: NextPageWithLayout = () => {
githubIntegration={githubConnections?.find(
(connection) => connection.supabase_project_ref === project.ref
)}
+ vercelIntegration={vercelConnections?.find(
+ (connection) => connection.supabase_project_ref === project.ref
+ )}
/>
))}
</ul>