diff --git a/gradle/changelog/repo_type.yaml b/gradle/changelog/repo_type.yaml new file mode 100644 index 0000000000..462021ec6c --- /dev/null +++ b/gradle/changelog/repo_type.yaml @@ -0,0 +1,2 @@ +- type: fixed + description: Selection of undefined type in import repository dialog diff --git a/scm-ui/ui-webapp/public/locales/de/repos.json b/scm-ui/ui-webapp/public/locales/de/repos.json index 9deb5a1265..932237e9a4 100644 --- a/scm-ui/ui-webapp/public/locales/de/repos.json +++ b/scm-ui/ui-webapp/public/locales/de/repos.json @@ -2,7 +2,7 @@ "repository": { "namespace": "Namespace", "name": "Name", - "type": "Typ", + "type": "Typ des Repositorys", "contact": "Kontakt", "description": "Beschreibung", "creationDate": "Erstellt", @@ -24,7 +24,6 @@ "help": { "namespaceHelpText": "Der Namespace des Repository. Dieser wird Teil der URL des Repository sein.", "nameHelpText": "Der Name des Repository. Dieser wird Teil der URL des Repository sein.", - "typeHelpText": "Der Typ des Repository (Mercurial, Git oder Subversion).", "contactHelpText": "E-Mail Adresse der Person, die für das Repository verantwortlich ist.", "descriptionHelpText": "Eine kurze Beschreibung des Repository.", "initializeRepository": "Erstellt einen ersten Branch und committet eine README.md.", diff --git a/scm-ui/ui-webapp/public/locales/en/repos.json b/scm-ui/ui-webapp/public/locales/en/repos.json index 42065e5fc4..8e2b638f2c 100644 --- a/scm-ui/ui-webapp/public/locales/en/repos.json +++ b/scm-ui/ui-webapp/public/locales/en/repos.json @@ -2,7 +2,7 @@ "repository": { "namespace": "Namespace", "name": "Name", - "type": "Type", + "type": "Type of repository", "contact": "Contact", "description": "Description", "creationDate": "Creation Date", @@ -24,7 +24,6 @@ "help": { "namespaceHelpText": "The namespace of the repository. This name will be part of the repository url.", "nameHelpText": "The name of the repository. This name will be part of the repository url.", - "typeHelpText": "The type of the repository (e.g. Mercurial, Git or Subversion).", "contactHelpText": "Email address of the person who is responsible for this repository.", "descriptionHelpText": "A short description of the repository.", "initializeRepository": "Creates an initial branch and commits a basic README.md.", diff --git a/scm-ui/ui-webapp/public/locales/es/repos.json b/scm-ui/ui-webapp/public/locales/es/repos.json index 2b456e627e..c61730b956 100644 --- a/scm-ui/ui-webapp/public/locales/es/repos.json +++ b/scm-ui/ui-webapp/public/locales/es/repos.json @@ -2,7 +2,7 @@ "repository": { "namespace": "Espacio de nombres", "name": "Nombre", - "type": "Tipo", + "type": "Tipo del repositorio", "contact": "Contacto", "description": "Descripción", "creationDate": "Fecha de creación", @@ -19,7 +19,6 @@ "help": { "namespaceHelpText": "El espacio de nombres del repositorio. Este nombre formará parte de la URL del repositorio.", "nameHelpText": "El nombre del repositorio. Este nombre formará parte de la URL del repositorio.", - "typeHelpText": "El tipo del repositorio (Mercurial, Git or Subversion).", "contactHelpText": "Dirección del correo electrónico de la persona responsable del repositorio.", "descriptionHelpText": "Breve descripción del repositorio.", "initializeRepository": "Creates an initial branch and commits a basic README.md." diff --git a/scm-ui/ui-webapp/src/repos/components/ImportRepositoryTypeSelect.tsx b/scm-ui/ui-webapp/src/repos/components/ImportRepositoryTypeSelect.tsx index 89b40f6abf..6956684126 100644 --- a/scm-ui/ui-webapp/src/repos/components/ImportRepositoryTypeSelect.tsx +++ b/scm-ui/ui-webapp/src/repos/components/ImportRepositoryTypeSelect.tsx @@ -17,7 +17,7 @@ import React, { FC } from "react"; import { RepositoryType } from "@scm-manager/ui-types"; import { useTranslation } from "react-i18next"; -import { Select } from "@scm-manager/ui-components"; +import { Label, Loading, Select } from "@scm-manager/ui-core"; type Props = { repositoryTypes: RepositoryType[]; @@ -30,32 +30,36 @@ const ImportRepositoryTypeSelect: FC = ({ repositoryTypes, repositoryType const [t] = useTranslation("repos"); const createSelectOptions = () => { - const options = repositoryTypes - .filter(repoType => !!repoType._links.import) - .map(repositoryType => { + return repositoryTypes + .filter((repoType) => !!repoType._links.import) + .map((repositoryType) => { return { label: repositoryType.displayName, - value: repositoryType.name + value: repositoryType.name, }; }); - options.unshift({ label: "", value: "" }); - return options; }; - const onChangeType = (type: string) => { - const repositoryType = repositoryTypes.filter(t => t.name === type)[0]; + const onChangeType = (event: React.ChangeEvent) => { + const type = event.target.value; + const repositoryType = repositoryTypes.filter((t) => t.name === type)[0]; setRepositoryType(repositoryType); }; + if (!repositoryType) { + return ; + } + return ( - + ); }; diff --git a/scm-ui/ui-webapp/src/repos/containers/ImportRepository.tsx b/scm-ui/ui-webapp/src/repos/containers/ImportRepository.tsx index 2157c84666..a87899a675 100644 --- a/scm-ui/ui-webapp/src/repos/containers/ImportRepository.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/ImportRepository.tsx @@ -45,11 +45,13 @@ const ImportPendingLoading = ({ importPending }: { importPending: boolean }) => const ImportRepository: extensionPoints.RepositoryCreatorExtension["component"] = ({ repositoryTypes, nameForm, - informationForm + informationForm, }) => { const [importPending, setImportPending] = useState(false); const [importedRepository, setImportedRepository] = useState(); - const [repositoryType, setRepositoryType] = useState(); + const [repositoryType, setRepositoryType] = useState( + repositoryTypes?._embedded?.repositoryTypes?.[0] + ); const [importType, setImportType] = useState(""); const [t] = useTranslation("repos");