From 83b5664e6b8aae1afeaad2e924b3deb84ab1fb5f Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Wed, 9 Jul 2025 19:07:33 +0800 Subject: [PATCH] fix: show run logs for gitless branches (#36949) * fix: show run logs for gitless branches * fix: show edit branch modal for production * remove side panel github --------- Co-authored-by: Saxon Fletcher --- .../BranchManagement/BranchManagement.tsx | 1 + .../BranchManagement/BranchPanels.tsx | 69 +- .../BranchManagement/EditBranchModal.tsx | 126 ++- .../BranchManagement/EmptyStates.tsx | 11 +- .../IntegrationSettings.tsx | 2 - .../SidePanelGitHubRepoLinker.tsx | 742 ------------------ .../Integrations/IntegrationsSettings.tsx | 2 - .../GithubRepositorySelection.tsx | 117 --- .../layouts/ProjectLayout/ProjectLayout.tsx | 2 - apps/studio/state/side-panels.ts | 8 - 10 files changed, 133 insertions(+), 947 deletions(-) delete mode 100644 apps/studio/components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker.tsx delete mode 100644 apps/studio/components/layouts/AppLayout/EnableBranchingButton/GithubRepositorySelection.tsx diff --git a/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx b/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx index 3e1e963f8a1..bcd95439ffd 100644 --- a/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx +++ b/apps/studio/components/interfaces/BranchManagement/BranchManagement.tsx @@ -322,6 +322,7 @@ const BranchManagement = () => { ) : ( 0} githubConnection={githubConnection} gitlessBranching={gitlessBranching} diff --git a/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx b/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx index 12d6633969b..b05ad093c42 100644 --- a/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx +++ b/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx @@ -210,32 +210,51 @@ export const BranchRow = ({ {isMain ? (
{repo && ( - <> - - - - - )} + + + +
) : (
diff --git a/apps/studio/components/interfaces/BranchManagement/EditBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/EditBranchModal.tsx index 388cd63928b..2ab15c74e3d 100644 --- a/apps/studio/components/interfaces/BranchManagement/EditBranchModal.tsx +++ b/apps/studio/components/interfaces/BranchManagement/EditBranchModal.tsx @@ -16,9 +16,11 @@ import { useCheckGithubBranchValidity } from 'data/integrations/github-branch-ch import { useGitHubConnectionsQuery } from 'data/integrations/github-connections-query' import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization' import { useSelectedProject } from 'hooks/misc/useSelectedProject' +import { useFlag } from 'hooks/ui/useFlag' import { BASE_PATH } from 'lib/constants' -import { sidePanelsState } from 'state/side-panels' +import { useRouter } from 'next/router' import { + Badge, Button, Dialog, DialogContent, @@ -29,7 +31,6 @@ import { DialogTitle, FormControl_Shadcn_, FormField_Shadcn_, - FormItem_Shadcn_, FormMessage_Shadcn_, Form_Shadcn_, Input_Shadcn_, @@ -46,8 +47,10 @@ interface EditBranchModalProps { export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalProps) => { const { ref } = useParams() + const router = useRouter() const projectDetails = useSelectedProject() const selectedOrg = useSelectedOrganization() + const gitlessBranching = useFlag('gitlessBranching') const [isGitBranchValid, setIsGitBranchValid] = useState(false) @@ -100,13 +103,18 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro val === branch?.name || (branches ?? []).every((b) => b.name !== val), 'A branch with this name already exists' ), - gitBranchName: z.string().optional(), + gitBranchName: z + .string() + .refine( + (val) => gitlessBranching || !githubConnection || (val && val.length > 0), + 'Git branch name is required when GitHub is connected' + ), }) .superRefine(async (val, ctx) => { - if (val.gitBranchName && val.gitBranchName.length > 0 && githubConnection?.id) { + if (val.gitBranchName && val.gitBranchName.length > 0 && githubConnection?.repository.id) { try { await checkGithubBranchValidity({ - repositoryId: githubConnection.id, + repositoryId: githubConnection.repository.id, branchName: val.gitBranchName, }) setIsGitBranchValid(true) @@ -119,8 +127,10 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro }) } } else { - // If git branch is empty or removed, it's valid - setIsGitBranchValid(!val.gitBranchName || val.gitBranchName.length === 0) + // If git branch is empty or removed, it's valid for gitless branching + setIsGitBranchValid( + !val.gitBranchName || val.gitBranchName.length === 0 || gitlessBranching + ) } }) @@ -162,35 +172,44 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro // Pre-fill form when the modal becomes visible and branch data is available useEffect(() => { if (visible && branch) { - setIsGitBranchValid(!!branch.git_branch) // Initial validity based on existing link + setIsGitBranchValid(!!branch.git_branch || gitlessBranching) // Initial validity based on existing link or gitless branching form.reset({ branchName: branch.name ?? '', gitBranchName: branch.git_branch ?? '', }) } - }, [branch, visible, form]) + }, [branch, visible, form, gitlessBranching]) // Handle initial state and changes for git branch validity useEffect(() => { setIsGitBranchValid( - !form.getValues('gitBranchName') || form.getValues('gitBranchName')?.length === 0 + !form.getValues('gitBranchName') || + form.getValues('gitBranchName')?.length === 0 || + gitlessBranching ) // Trigger validation if a git branch name exists initially or is entered if (form.getValues('gitBranchName')) { form.trigger('gitBranchName') } - }, [githubConnection?.id, form.getValues('gitBranchName'), form.trigger, visible, branch]) + }, [ + githubConnection?.id, + form.getValues('gitBranchName'), + form.trigger, + visible, + branch, + gitlessBranching, + ]) const openLinkerPanel = () => { onClose() - sidePanelsState.setGithubConnectionsOpen(true) + router.push(`/project/${projectRef}/settings/integrations`) } return ( !open && onClose()}> - Edit branch "{branch?.name}" {/* Update title */} + Edit branch "{branch?.name}" @@ -217,27 +236,37 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro control={form.control} name="gitBranchName" render={({ field }) => ( - -
- -
- {`GitHub - - {repoOwner}/{repoName} - + + + Sync with Git branch {gitlessBranching ? '(optional)' : ''} + +
+ {`GitHub + + {repoOwner}/{repoName} + +
-
+ } + description={ + gitlessBranching + ? 'Automatically deploy changes on every commit' + : 'If linked, migrations from this Git branch will be automatically deployed.' + } + >
-

- If linked, migrations from this Git branch will be automatically deployed. -

-
+ )} /> )} @@ -270,15 +296,23 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro )} {isSuccessConnections && !githubConnection && (
-
- +
+
+ + {!gitlessBranching && ( + + Required + + )} +

- Optionally connect to a GitHub repository to manage migrations automatically - for this branch. + {gitlessBranching + ? 'Optionally connect to a GitHub repository to manage migrations automatically for this branch.' + : 'Keep this preview branch in sync with a chosen GitHub branch'}

)} @@ -290,7 +324,13 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro
-
) diff --git a/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx index 20c6cb31224..5cd1f00d766 100644 --- a/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx +++ b/apps/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx @@ -28,7 +28,6 @@ import { } from 'lib/github' import { useSidePanelsStateSnapshot } from 'state/side-panels' import { IntegrationConnectionItem } from '../../Integrations/VercelGithub/IntegrationConnection' -import SidePanelGitHubRepoLinker from './SidePanelGitHubRepoLinker' import SidePanelVercelProjectLinker from './SidePanelVercelProjectLinker' import { useRouter } from 'next/router' @@ -183,7 +182,6 @@ The GitHub app will watch for changes in your repository such as file changes, b - ) } diff --git a/apps/studio/components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker.tsx b/apps/studio/components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker.tsx deleted file mode 100644 index 36272d090a1..00000000000 --- a/apps/studio/components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker.tsx +++ /dev/null @@ -1,742 +0,0 @@ -import { zodResolver } from '@hookform/resolvers/zod' -import { PermissionAction } from '@supabase/shared-types/out/constants' -import { ChevronDown, Loader2, PlusIcon } from 'lucide-react' -import { useCallback, useEffect, useMemo, useState } from 'react' -import { useForm } from 'react-hook-form' -import { toast } from 'sonner' -import * as z from 'zod' - -import { Markdown } from 'components/interfaces/Markdown' -import { useBranchCreateMutation } from 'data/branches/branch-create-mutation' -import { useBranchUpdateMutation } from 'data/branches/branch-update-mutation' -import { useBranchesQuery } from 'data/branches/branches-query' -import { useCheckGithubBranchValidity } from 'data/integrations/github-branch-check-query' -import { useGitHubAuthorizationQuery } from 'data/integrations/github-authorization-query' -import { useGitHubConnectionCreateMutation } from 'data/integrations/github-connection-create-mutation' -import { useGitHubConnectionDeleteMutation } from 'data/integrations/github-connection-delete-mutation' -import { useGitHubConnectionUpdateMutation } from 'data/integrations/github-connection-update-mutation' -import { useGitHubConnectionsQuery } from 'data/integrations/github-connections-query' -import { useGitHubRepositoriesQuery } from 'data/integrations/github-repositories-query' -import type { GitHubConnection } from 'data/integrations/integrations.types' -import { useProjectsQuery } from 'data/projects/projects-query' -import { useCheckPermissions } from 'hooks/misc/useCheckPermissions' -import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization' -import { useSelectedProject } from 'hooks/misc/useSelectedProject' -import { openInstallGitHubIntegrationWindow } from 'lib/github' -import { EMPTY_ARR } from 'lib/void' -import { useSidePanelsStateSnapshot } from 'state/side-panels' -import { - Button, - CommandEmpty_Shadcn_, - CommandGroup_Shadcn_, - CommandInput_Shadcn_, - CommandItem_Shadcn_, - CommandList_Shadcn_, - CommandSeparator_Shadcn_, - Command_Shadcn_, - Form_Shadcn_, - FormControl_Shadcn_, - FormField_Shadcn_, - Input_Shadcn_, - PopoverContent_Shadcn_, - PopoverTrigger_Shadcn_, - Popover_Shadcn_, - Sheet, - SheetContent, - SheetDescription, - SheetFooter, - SheetHeader, - SheetTitle, - Switch, - cn, -} from 'ui' -import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal' -import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' - -const GITHUB_ICON = ( - - - -) - -export type SidePanelGitHubRepoLinkerProps = { - projectRef?: string -} - -const SidePanelGitHubRepoLinker = ({ projectRef }: SidePanelGitHubRepoLinkerProps) => { - const selectedProject = useSelectedProject() - const selectedOrganization = useSelectedOrganization() - const sidePanelStateSnapshot = useSidePanelsStateSnapshot() - - const [isConfirmingBranchChange, setIsConfirmingBranchChange] = useState(false) - const [isConfirmingRepoChange, setIsConfirmingRepoChange] = useState(false) - const [selectedRepositoryId, setSelectedRepositoryId] = useState() - const [repoComboBoxOpen, setRepoComboboxOpen] = useState(false) - - const visible = sidePanelStateSnapshot.githubConnectionsOpen - - const canUpdateGitHubConnection = useCheckPermissions( - PermissionAction.UPDATE, - 'integrations.github_connections' - ) - const canCreateGitHubConnection = useCheckPermissions( - PermissionAction.CREATE, - 'integrations.github_connections' - ) - - const { data: gitHubAuthorization, isLoading: isLoadingGitHubAuthorization } = - useGitHubAuthorizationQuery({ enabled: visible }) - - const { data: githubReposData, isLoading: isLoadingGitHubRepos } = useGitHubRepositoriesQuery< - any[] - >({ - enabled: visible && Boolean(gitHubAuthorization), - }) - - const { data: connections } = useGitHubConnectionsQuery( - { - organizationId: selectedOrganization?.id, - }, - { - enabled: visible, - } - ) - - const { data: existingBranches } = useBranchesQuery( - { projectRef: selectedProject?.parent_project_ref || selectedProject?.ref }, - { enabled: !!selectedProject?.ref } - ) - - const githubRepos = useMemo( - () => - githubReposData?.map((repo: any) => ({ - id: repo.id.toString(), - name: repo.name, - installation_id: repo.installation_id, - })) ?? EMPTY_ARR, - [githubReposData] - ) - - const existingConnection = useMemo( - () => connections?.find((c) => c.project.ref === projectRef), - [connections, projectRef] - ) - - const prodBranch = existingBranches?.find((branch) => branch.is_default) - - // Mutations - const { mutate: createBranch } = useBranchCreateMutation({ - onError: (error) => { - console.error('Failed to enable branching:', error) - }, - }) - - const { mutate: updateBranch } = useBranchUpdateMutation() - - const { mutateAsync: checkGithubBranchValidity, isLoading: isCheckingBranch } = - useCheckGithubBranchValidity({ onError: () => {} }) - - const { mutate: createConnection, isLoading: isCreatingConnection } = - useGitHubConnectionCreateMutation({ - onSuccess: (data, variables) => { - // Enable branching if not already enabled - if (selectedProject && !selectedProject.is_branch_enabled) { - createBranch({ - projectRef: variables.connection.project_ref, - branchName: 'main', - gitBranch: '', - }) - } - toast.success('Successfully linked project to repository!') - }, - }) - - const { mutateAsync: deleteConnection } = useGitHubConnectionDeleteMutation() - - const { mutate: updateConnectionSettings, isLoading: isUpdatingConnection } = - useGitHubConnectionUpdateMutation() - - // Form schema with validation - const GitHubSettingsSchema = z - .object({ - repositoryId: z.string().min(1, 'Please select a repository'), - enableProductionSync: z.boolean().default(false), - branchName: z.string(), - new_branch_per_pr: z.boolean().default(false), - supabaseDirectory: z.string().default('.'), - supabaseChangesOnly: z.boolean().default(false), - branchLimit: z.string().default('50'), - }) - .superRefine(async (val, ctx) => { - if ( - val.enableProductionSync && - val.branchName && - val.branchName.length > 0 && - val.repositoryId - ) { - try { - await checkGithubBranchValidity({ - repositoryId: Number(val.repositoryId), - branchName: val.branchName, - }) - } catch (error) { - const selectedRepo = githubRepos.find((repo) => repo.id === val.repositoryId) - const repoName = selectedRepo?.name || 'selected repository' - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: `Branch "${val.branchName}" not found in ${repoName}`, - path: ['branchName'], - }) - } - } - }) - - const githubSettingsForm = useForm>({ - resolver: zodResolver(GitHubSettingsSchema), - mode: 'onSubmit', - reValidateMode: 'onBlur', - defaultValues: { - repositoryId: '', - enableProductionSync: false, - branchName: '', - new_branch_per_pr: false, - supabaseDirectory: '', - supabaseChangesOnly: false, - branchLimit: '50', - }, - }) - - const enableProductionSync = githubSettingsForm.watch('enableProductionSync') - const newBranchPerPr = githubSettingsForm.watch('new_branch_per_pr') - const currentRepositoryId = githubSettingsForm.watch('repositoryId') - - // Calculate selected repository based on current form value - const selectedRepository = githubRepos.find( - (repo) => repo.id === (currentRepositoryId || selectedRepositoryId) - ) - - // Initialize form when existing connection is loaded - useEffect(() => { - if (existingConnection) { - const hasGitBranch = Boolean(prodBranch?.git_branch?.trim()) - const formValues = { - repositoryId: existingConnection.repository.id.toString(), - enableProductionSync: hasGitBranch, - branchName: prodBranch?.git_branch || 'main', - new_branch_per_pr: existingConnection.new_branch_per_pr, - supabaseDirectory: existingConnection.workdir || '', - supabaseChangesOnly: existingConnection.supabase_changes_only, - branchLimit: String(existingConnection.branch_limit), - } - - // Only reset if the form hasn't been modified or if the connection has actually changed - if ( - !githubSettingsForm.formState.isDirty || - githubSettingsForm.getValues().repositoryId !== formValues.repositoryId - ) { - githubSettingsForm.reset(formValues) - setSelectedRepositoryId(existingConnection.repository.id.toString()) - } - } - }, [existingConnection?.id, prodBranch?.git_branch, prodBranch?.id]) - - // Handle clearing branch name when production sync is disabled - useEffect(() => { - if (!enableProductionSync) { - githubSettingsForm.setValue('branchName', '') - } else if (enableProductionSync && !githubSettingsForm.getValues().branchName) { - githubSettingsForm.setValue('branchName', 'main') - } - }, [enableProductionSync, githubSettingsForm]) - - const handleCreateOrUpdateConnection = async (data: z.infer) => { - if (!selectedProject?.ref || !selectedOrganization?.id) return - - const selectedRepo = githubRepos.find((repo) => repo.id === data.repositoryId) - if (!selectedRepo) { - toast.error('Please select a repository') - return - } - - try { - if (existingConnection) { - // Check if repository is being changed - const isRepoChanged = existingConnection.repository.id.toString() !== data.repositoryId - if (isRepoChanged) { - setIsConfirmingRepoChange(true) - return - } - // Update existing connection - await handleUpdateConnection(data, existingConnection) - } else { - // Create new connection - await handleCreateConnection(data, selectedRepo) - } - } catch (error) { - console.error('Error managing connection:', error) - } - } - - const handleCreateConnection = async ( - data: z.infer, - selectedRepo: { id: string; installation_id: number } - ) => { - if (!selectedProject?.ref || !selectedOrganization?.id) return - - // Create the connection - createConnection({ - organizationId: selectedOrganization.id, - connection: { - installation_id: selectedRepo.installation_id, - project_ref: selectedProject.ref, - repository_id: Number(selectedRepo.id), - workdir: data.supabaseDirectory, - supabase_changes_only: data.supabaseChangesOnly, - branch_limit: Number(data.branchLimit), - new_branch_per_pr: data.new_branch_per_pr, - }, - }) - - // Handle branch creation/update for production sync - if (data.enableProductionSync && data.branchName) { - if (prodBranch?.id) { - updateBranch({ - id: prodBranch.id, - projectRef: selectedProject.ref, - gitBranch: data.branchName, - }) - } else { - // Create new branch if none exists - createBranch({ - projectRef: selectedProject.ref, - branchName: 'main', - gitBranch: data.branchName, - }) - } - } - - toast.success('GitHub connection created successfully') - sidePanelStateSnapshot.setGithubConnectionsOpen(false) - } - - const handleUpdateConnection = async ( - data: z.infer, - connection: GitHubConnection - ) => { - if (!selectedProject?.ref || !selectedOrganization?.id) return - - const originalBranchName = prodBranch?.git_branch - - if (originalBranchName && data.branchName !== originalBranchName && data.enableProductionSync) { - setIsConfirmingBranchChange(true) - return - } - - await executeUpdate(data, connection) - } - - const executeUpdate = async ( - data: z.infer, - connection: GitHubConnection - ) => { - if (!selectedProject?.ref || !selectedOrganization?.id) return - - // Update connection settings - updateConnectionSettings({ - connectionId: connection.id, - organizationId: selectedOrganization.id, - connection: { - workdir: data.supabaseDirectory, - supabase_changes_only: data.supabaseChangesOnly, - branch_limit: Number(data.branchLimit), - new_branch_per_pr: data.new_branch_per_pr, - }, - }) - - // Handle branch update - if (prodBranch?.id) { - updateBranch({ - id: prodBranch.id, - projectRef: selectedProject.ref, - gitBranch: data.enableProductionSync ? data.branchName : '', - }) - } - - toast.success('GitHub integration updated successfully') - setIsConfirmingBranchChange(false) - sidePanelStateSnapshot.setGithubConnectionsOpen(false) - } - - const onConfirmBranchChange = async () => { - if (existingConnection) { - await executeUpdate(githubSettingsForm.getValues(), existingConnection) - } - } - - const onConfirmRepoChange = async () => { - const data = githubSettingsForm.getValues() - const selectedRepo = githubRepos.find((repo) => repo.id === data.repositoryId) - - if (!selectedRepo || !existingConnection) return - - try { - // Delete the existing connection - await deleteConnection({ - organizationId: selectedOrganization!.id, - connectionId: existingConnection.id, - }) - - // Create new connection with the new repository - await handleCreateConnection(data, selectedRepo) - - setIsConfirmingRepoChange(false) - } catch (error) { - console.error('Error changing repository:', error) - toast.error('Failed to change repository') - } - } - - const isConnected = Boolean(existingConnection) - const isLoading = isCreatingConnection || isUpdatingConnection - - return ( - <> - !open && sidePanelStateSnapshot.setGithubConnectionsOpen(false)} - > - - - GitHub Integration - - {isConnected - ? 'Update your GitHub integration settings below.' - : 'Connect your Supabase project to a GitHub repository to enable automatic deployments and preview branches.'} - - - -
- {gitHubAuthorization === null ? ( -
-

Authorize with GitHub

-

- Connect your GitHub account to access and select repositories for integration. -

- -
- ) : ( - -
- {/* Repository Selection */} - ( - - - - -
- } - iconRight={ - - - - } - > - {selectedRepository - ? selectedRepository.name - : 'Choose GitHub Repository'} - - - - - - - - No repositories found. - - {githubRepos.map((repo, i) => ( - { - setSelectedRepositoryId(repo.id) - field.onChange(repo.id) - setRepoComboboxOpen(false) - }} - > -
- {GITHUB_ICON} -
- - {repo.name} - -
- ))} -
- - - openInstallGitHubIntegrationWindow('install')} - > - - Add GitHub Repositories - - -
-
-
- - - )} - /> - - {/* Supabase Directory */} - ( - - - - - - )} - /> - - {/* Production Branch Sync Section */} -
- ( - - - - - - )} - /> - -
- ( - -
- - - -
- {isCheckingBranch && } -
-
-
- )} - /> -
-
- - {/* Automatic Branching Section */} -
- ( - - - - - - )} - /> - -
- ( - - - - - - )} - /> - - ( - - - field.onChange(val)} - disabled={!newBranchPerPr || !canUpdateGitHubConnection} - /> - - - )} - /> -
-
- - - )} - - - - - - -
-
- - setIsConfirmingBranchChange(false)} - onConfirm={onConfirmBranchChange} - loading={isUpdatingConnection} - > -

- Open pull requests will only update your Supabase project on merge if the git base branch - matches this new production git branch. -

-
- - setIsConfirmingRepoChange(false)} - onConfirm={onConfirmRepoChange} - loading={isLoading} - > -
-

- This will disconnect your current repository and create a new connection with the - selected repository. -

-

- Your existing branch settings will be preserved, but make sure the new repository - contains the specified branches. -

-
-
- - ) -} - -export default SidePanelGitHubRepoLinker diff --git a/apps/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx b/apps/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx index a439d2686c8..fe23171ac31 100644 --- a/apps/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx +++ b/apps/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx @@ -1,6 +1,5 @@ import Link from 'next/link' -import SidePanelGitHubRepoLinker from 'components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker' import SidePanelVercelProjectLinker from 'components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker' import { ScaffoldContainer, ScaffoldDivider } from 'components/layouts/Scaffold' import { useProjectByRef, useSelectedProject } from 'hooks/misc/useSelectedProject' @@ -47,7 +46,6 @@ const IntegrationSettings = () => { - ) } diff --git a/apps/studio/components/layouts/AppLayout/EnableBranchingButton/GithubRepositorySelection.tsx b/apps/studio/components/layouts/AppLayout/EnableBranchingButton/GithubRepositorySelection.tsx deleted file mode 100644 index df7f54921b8..00000000000 --- a/apps/studio/components/layouts/AppLayout/EnableBranchingButton/GithubRepositorySelection.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import { Check, Loader2 } from 'lucide-react' - -import { - EmptyIntegrationConnection, - IntegrationConnection, -} from 'components/interfaces/Integrations/VercelGithub/IntegrationPanels' -import type { GitHubConnection } from 'data/integrations/github-connections-query' -import { useSidePanelsStateSnapshot } from 'state/side-panels' -import { - Badge, - Button, - FormControl_Shadcn_, - FormField_Shadcn_, - FormItem_Shadcn_, - FormMessage_Shadcn_, - Input_Shadcn_, - Modal, -} from 'ui' - -interface GithubRepositorySelectionProps { - form: any - isChecking: boolean - isValid: boolean - githubConnection?: GitHubConnection -} - -const GithubRepositorySelection = ({ - form, - isChecking, - isValid, - githubConnection, -}: GithubRepositorySelectionProps) => { - const sidePanels = useSidePanelsStateSnapshot() - - function onSelectConnectRepo() { - sidePanels.setGithubConnectionsOpen(true) - } - - return ( -
- -
-
-

Git Connection

- Required -
-

- {githubConnection !== undefined - ? 'Your database preview branches will be based on the branches in the following repository that your project is connected with:' - : 'Your database preview branches will be based on the branches in the Git repository that your project is connected with.'} -

- - {githubConnection ? ( - <> -
    - onSelectConnectRepo()}> - Configure connection - - } - orientation="horizontal" - /> -
- - ( - - - - - -
- {isChecking ? ( - - ) : isValid ? ( - - ) : null} -
- - -
- )} - /> - - ) : ( - onSelectConnectRepo()} /> - )} -
-
-
- ) -} - -export default GithubRepositorySelection diff --git a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx index e6fd4b1498f..25991f5b885 100644 --- a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx +++ b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx @@ -5,7 +5,6 @@ import { forwardRef, Fragment, PropsWithChildren, ReactNode, useEffect, useState import { useParams } from 'common' import { CreateBranchModal } from 'components/interfaces/BranchManagement/CreateBranchModal' -import SidePanelGitHubRepoLinker from 'components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker' import ProjectAPIDocs from 'components/interfaces/ProjectAPIDocs/ProjectAPIDocs' import { AIAssistant } from 'components/ui/AIAssistantPanel/AIAssistant' import { EditorPanel } from 'components/ui/EditorPanel/EditorPanel' @@ -259,7 +258,6 @@ const ProjectLayout = forwardRef - {productMenu} diff --git a/apps/studio/state/side-panels.ts b/apps/studio/state/side-panels.ts index e45b7fec4aa..ca0a58a2b85 100644 --- a/apps/studio/state/side-panels.ts +++ b/apps/studio/state/side-panels.ts @@ -15,14 +15,6 @@ export const sidePanelsState = proxy({ setVercelConnectionsIntegrationId: (id: string) => { sidePanelsState.vercelConnectionsIntegrationId = id }, - - /** - * GitHub connections - */ - githubConnectionsOpen: false as boolean, - setGithubConnectionsOpen: (bool: boolean) => { - sidePanelsState.githubConnectionsOpen = bool - }, }) export const getSidePanelsState = () => snapshot(sidePanelsState)