diff --git a/apps/web/src/app/(onboarding)/setup/GitHubSourceControlConfig.tsx b/apps/web/src/app/(onboarding)/setup/GitHubSourceControlConfig.tsx index a75e73056..74553180c 100644 --- a/apps/web/src/app/(onboarding)/setup/GitHubSourceControlConfig.tsx +++ b/apps/web/src/app/(onboarding)/setup/GitHubSourceControlConfig.tsx @@ -7,19 +7,12 @@ import { Button, Input, Label, - Pencil, Sparkles, Spinner, } from '@/components/system'; import { useCreateGitHubAppManifest } from '@/hooks/github'; -export function GitHubSourceControlConfig({ - onBack, - onManualValues, -}: { - onBack?: () => void; - onManualValues: () => void; -}) { +export function GitHubSourceControlConfig({ onBack }: { onBack?: () => void }) { const [githubOrganization, setGithubOrganization] = useState(''); const [showAdvancedConfig, setShowAdvancedConfig] = useState(false); const [manifestForm, setManifestForm] = useState<{ @@ -53,10 +46,9 @@ export function GitHubSourceControlConfig({ box GitHub app - you need to create your own.

- Roomote can create it for you automatically or you can enter values - manually if you already have an app or want to do each step yourself. - You'll pick the account or organization to install it on during - the GitHub install step. + Roomote can create it for you automatically. You'll pick the + account or organization to install it on during the GitHub install + step.

@@ -144,15 +136,6 @@ export function GitHubSourceControlConfig({ )} Create GitHub App - ); diff --git a/apps/web/src/app/(onboarding)/setup/StepSourceControlConfig.client.test.tsx b/apps/web/src/app/(onboarding)/setup/StepSourceControlConfig.client.test.tsx index ec47a8863..b27d89b94 100644 --- a/apps/web/src/app/(onboarding)/setup/StepSourceControlConfig.client.test.tsx +++ b/apps/web/src/app/(onboarding)/setup/StepSourceControlConfig.client.test.tsx @@ -173,8 +173,8 @@ describe('StepSourceControlConfig', () => { screen.getByRole('button', { name: 'Create GitHub App' }), ).toBeInTheDocument(); expect( - screen.getByRole('button', { name: 'Enter values manually' }), - ).toBeInTheDocument(); + screen.queryByRole('button', { name: 'Enter values manually' }), + ).not.toBeInTheDocument(); expect( screen.queryByLabelText('GitHub organization'), ).not.toBeInTheDocument(); @@ -224,7 +224,7 @@ describe('StepSourceControlConfig', () => { }); }); - it('reveals the existing GitHub field form from the manual path', () => { + it('keeps the GitHub field form hidden without a manual entry path', () => { render( { />, ); - fireEvent.click( - screen.getByRole('button', { name: 'Enter values manually' }), - ); - - expect(screen.getByText('GitHub App Slug')).toBeInTheDocument(); - expect(screen.getByText('GitHub App ID')).toBeInTheDocument(); + expect(screen.queryByText('GitHub App Slug')).not.toBeInTheDocument(); + expect(screen.queryByText('GitHub App ID')).not.toBeInTheDocument(); expect( - screen.getByRole('button', { name: /Save and continue/i }), - ).toBeInTheDocument(); + screen.queryByRole('button', { name: /Save and continue/i }), + ).not.toBeInTheDocument(); }); it('guides GitLab OAuth application setup', () => { diff --git a/apps/web/src/app/(onboarding)/setup/StepSourceControlConfig.tsx b/apps/web/src/app/(onboarding)/setup/StepSourceControlConfig.tsx index 5f1a388b6..ca6a9e178 100644 --- a/apps/web/src/app/(onboarding)/setup/StepSourceControlConfig.tsx +++ b/apps/web/src/app/(onboarding)/setup/StepSourceControlConfig.tsx @@ -126,7 +126,6 @@ export function StepSourceControlConfig({ const [editingSavedValues, setEditingSavedValues] = useState< Record >({}); - const [showManualGitHubValues, setShowManualGitHubValues] = useState(false); const [showAdoAdvancedConfig, setShowAdoAdvancedConfig] = useState(false); const [showGitlabAdvancedConfig, setShowGitlabAdvancedConfig] = useState(false); @@ -230,7 +229,6 @@ export function StepSourceControlConfig({ useEffect(() => { setValues(nonSecretInitialValues); setEditingSavedValues({}); - setShowManualGitHubValues(false); setShowAdoAdvancedConfig(false); setShowGitlabAdvancedConfig(false); setShowGiteaAdvancedConfig(false); @@ -354,14 +352,11 @@ export function StepSourceControlConfig({ : undefined : providerSetupCopy?.creationHref; - if (selectedProvider?.provider === 'github' && !showManualGitHubValues) { + if (selectedProvider?.provider === 'github') { return (
- setShowManualGitHubValues(true)} - /> +
); } diff --git a/apps/web/src/components/settings/SourceControl.test.tsx b/apps/web/src/components/settings/SourceControl.test.tsx index aca1873c6..58cc53cd9 100644 --- a/apps/web/src/components/settings/SourceControl.test.tsx +++ b/apps/web/src/components/settings/SourceControl.test.tsx @@ -425,7 +425,7 @@ describe('SourceControl settings', () => { ).not.toBeInTheDocument(); }); - it('shows create and manual GitHub App paths when GitHub is not configured', () => { + it('shows the create GitHub App path when GitHub is not configured', () => { state.gitHubInstallations = []; state.gitHubRepositories = []; state.configProviders = [ @@ -444,25 +444,14 @@ describe('SourceControl settings', () => { screen.getByRole('button', { name: 'Create GitHub App' }), ).toBeInTheDocument(); expect( - screen.getByRole('button', { name: 'Enter values manually' }), - ).toBeInTheDocument(); + screen.queryByRole('button', { name: 'Enter values manually' }), + ).not.toBeInTheDocument(); expect( screen.queryByRole('button', { name: 'Connect GitHub' }), ).not.toBeInTheDocument(); expect( screen.queryByTestId('source-control-config-github'), ).not.toBeInTheDocument(); - - fireEvent.click( - screen.getByRole('button', { name: 'Enter values manually' }), - ); - - expect( - screen.getByTestId('source-control-config-github'), - ).toBeInTheDocument(); - expect( - screen.getByText(/Paste the app slug, App ID, private key/i), - ).toBeInTheDocument(); }); it('shows the recommendation highlight copy when targeted from a setup link', () => { diff --git a/apps/web/src/components/settings/SourceControl.tsx b/apps/web/src/components/settings/SourceControl.tsx index 2d1c51fd0..c56789ac9 100644 --- a/apps/web/src/components/settings/SourceControl.tsx +++ b/apps/web/src/components/settings/SourceControl.tsx @@ -340,8 +340,9 @@ export function SourceControl() { ) : ( <> - Create a GitHub App for this deployment, or enter an existing - app's credentials, then connect it to select repositories. + Create a GitHub App for this deployment, then connect it to select + repositories. Existing apps can be configured with deployment + environment variables. ), adminHelp: isAdmin @@ -622,18 +623,15 @@ function SourceControlProviderBlock({ }: SourceControlProviderBlockProps) { const [isRepositoryListOpen, setIsRepositoryListOpen] = useState(false); const [isExpanded, setIsExpanded] = useState(isConfigured); - const [showManualGitHubValues, setShowManualGitHubValues] = useState(false); const repositoryCount = repositories?.length ?? 0; const shouldShowSetup = !isPending && !isConfigured && !isExpanded; const isGitHubUnconfigured = provider === 'github' && !isConfigured && Boolean(githubSetup); - const shouldShowGitHubManualForm = - !isGitHubUnconfigured || showManualGitHubValues; + const shouldShowGitHubConfigForm = !isGitHubUnconfigured; useEffect(() => { if (isConfigured) { setIsExpanded(true); - setShowManualGitHubValues(false); } }, [isConfigured]); @@ -669,17 +667,12 @@ function SourceControlProviderBlock({
{!isConfigured ? ( isGitHubUnconfigured ? ( - setShowManualGitHubValues(true)} - onHideManualValues={() => setShowManualGitHubValues(false)} - /> + ) : ( ) ) : null} - {shouldShowGitHubManualForm ? configForm : null} + {shouldShowGitHubConfigForm ? configForm : null} {isPending ? null : repositoryCount > 0 && repositories ? (

Self-hosted Roomote needs its own GitHub App. Create one - automatically, or enter values manually if you already have an app. - You'll pick the account or organization to install it on during - the GitHub install step. + automatically. You'll pick the account or organization to install + it on during the GitHub install step.

@@ -848,60 +840,17 @@ function GitHubAppSettingsSetup({ ); } -function GitHubAppSettingsSetupPanel({ - setup, - showManualValues, - onShowManualValues, - onHideManualValues, -}: { - setup: ReactNode; - showManualValues: boolean; - onShowManualValues: () => void; - onHideManualValues: () => void; -}) { +function GitHubAppSettingsSetupPanel({ setup }: { setup: ReactNode }) { return (
- {!showManualValues ? setup : null} -
- {!showManualValues ? ( - - ) : ( - - )} + {setup} +
+

Then install the app.

+

+ After credentials are saved, Connect GitHub installs the app for the + repositories Roomote should work with. +

- {showManualValues ? ( -
-

Enter GitHub App credentials.

-

- Paste the app slug, App ID, private key, OAuth client credentials, - and webhook secret from your existing GitHub App, then install it - with Connect GitHub. -

-
- ) : ( -
-

Then install the app.

-

- After credentials are saved, Connect GitHub installs the app for the - repositories Roomote should work with. -

-
- )}
); }