diff --git a/app/ui/src/Components/SiteBar/components/CapabilitiesSelector/CapabilitiesSelector.tsx b/app/ui/src/Components/SiteBar/components/CapabilitiesSelector/CapabilitiesSelector.tsx index 082702fe6..1ce3abcf7 100644 --- a/app/ui/src/Components/SiteBar/components/CapabilitiesSelector/CapabilitiesSelector.tsx +++ b/app/ui/src/Components/SiteBar/components/CapabilitiesSelector/CapabilitiesSelector.tsx @@ -1,7 +1,5 @@ import React, { FC } from 'react'; import styles from './CapabilitiesSelector.module.scss'; -import { useReactiveVar } from '@apollo/client'; -import { selectedCapabilities } from 'Graphql/client/cache'; import { BottomComponentProps } from '../Breadcrumbs/components/Crumb/Crumb'; import { GetCapabilities_capabilities } from 'Graphql/queries/types/GetCapabilities'; import CapabilitiesItem from './CapabilitiesItem/CapabilitiesItem'; @@ -10,10 +8,6 @@ type Props = { capabilities: GetCapabilities_capabilities[] | undefined; }; -function sortCapability(capability1: GetCapabilities_capabilities) { - return capability1.default ? 1 : -1; -} - const CapabilitiesSelector: FC = ({ capabilities, ...props }) => { return (
diff --git a/app/ui/src/Graphql/client/hooks/useNewProject.ts b/app/ui/src/Graphql/client/hooks/useNewProject.ts index c9f2215c0..d7cf87f97 100644 --- a/app/ui/src/Graphql/client/hooks/useNewProject.ts +++ b/app/ui/src/Graphql/client/hooks/useNewProject.ts @@ -42,7 +42,6 @@ function useNewProject(section: keyof NewProject) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore newState[section].errors[key] = value; - newProject(newState); } diff --git a/app/ui/src/Pages/NewProject/NewProject.tsx b/app/ui/src/Pages/NewProject/NewProject.tsx index 3365b5210..9c3af23d4 100644 --- a/app/ui/src/Pages/NewProject/NewProject.tsx +++ b/app/ui/src/Pages/NewProject/NewProject.tsx @@ -70,7 +70,7 @@ function NewProject() { const type = data.repository.values.type; const stepsWithData: (StepNames.INFORMATION | StepNames.EXTERNAL)[] = useMemo(() => { - return [StepNames.INFORMATION, repoTypeToStepName[type || '']]; + return [StepNames.INFORMATION, StepNames.EXTERNAL, repoTypeToStepName[type || '']]; }, [type]); // We want to execute this on on component mount and unmount @@ -151,7 +151,6 @@ function NewProject() { const values = Object.values(actStepData.values).filter((v) => typeof v !== 'boolean'); const completed = values && values.every((v) => !!v) && !error; - updateState(completed, error); return !error; } else if (!hasData) { diff --git a/app/ui/src/Pages/NewProject/pages/RepositoryDetails/components/ExternalRepository/ExternalRepository.tsx b/app/ui/src/Pages/NewProject/pages/RepositoryDetails/components/ExternalRepository/ExternalRepository.tsx index 80a92af58..b1da7d1e6 100644 --- a/app/ui/src/Pages/NewProject/pages/RepositoryDetails/components/ExternalRepository/ExternalRepository.tsx +++ b/app/ui/src/Pages/NewProject/pages/RepositoryDetails/components/ExternalRepository/ExternalRepository.tsx @@ -15,6 +15,8 @@ type Props = { const authMethods = [RepositoryAuthMethod.PASSWORD, RepositoryAuthMethod.TOKEN]; +let authOk = false; + function ExternalRepository({ showErrors }: Props) { const project = useReactiveVar(newProject); const { updateValue, updateError, clearError } = useNewProject('externalRepository'); @@ -26,6 +28,16 @@ function ExternalRepository({ showErrors }: Props) { errors: { url: urlError, credential: credentialError, username: usernameError, authMethod: authMethodError }, } = project.externalRepository; + React.useEffect(() => { + if (authMethod == 'PASSWORD' || authMethod == 'TOKEN') { + updateValue('authMethod', ''); + authOk = false; + } else { + authOk = true; + } + //eslint-disable-next-line + }, []); + return (

Your external repository

@@ -69,16 +81,18 @@ function ExternalRepository({ showErrors }: Props) { whiteColor={false} showSelectAllOption={false} shouldSort={true} + defaultOption="" onChange={(value: string) => { updateValue('authMethod', value); clearError('authMethod'); + authOk = true; }} - formSelectedOption={authMethod ?? undefined} + formSelectedOption={authMethod} className={styles.authMethod} error={showErrors ? authMethodError : ''} /> - {authMethod && ( + {authOk && ( {