mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 11:05:56 +01:00
Disable repository types (#1908)
Disable repository types via global config for Git, Mercurial and Subversion. It is only possible to disable a type, if no repositories of this type exist. Also prevent repository creation if no type is allowed at all to catch nasty errors. Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
This commit is contained in:
@@ -28,7 +28,7 @@ import CreateRepository from "./CreateRepository";
|
||||
import ImportRepository from "./ImportRepository";
|
||||
import { useBinder } from "@scm-manager/ui-extensions";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Page, urls } from "@scm-manager/ui-components";
|
||||
import { Notification, Page, urls } from "@scm-manager/ui-components";
|
||||
import RepositoryFormSwitcher from "../components/form/RepositoryFormSwitcher";
|
||||
import { useIndex, useNamespaceStrategies, useRepositoryTypes } from "@scm-manager/ui-api";
|
||||
import NamespaceAndNameFields from "../components/NamespaceAndNameFields";
|
||||
@@ -67,7 +67,11 @@ const CreatorRoute: FC<CreatorRouteProps> = ({ creator, creators }) => {
|
||||
loading={isPageLoading}
|
||||
error={pageLoadingError}
|
||||
>
|
||||
{namespaceStrategies && repositoryTypes && index ? (
|
||||
{namespaceStrategies &&
|
||||
repositoryTypes &&
|
||||
repositoryTypes?._embedded?.repositoryTypes &&
|
||||
repositoryTypes._embedded.repositoryTypes.length > 0 &&
|
||||
index ? (
|
||||
<Component
|
||||
namespaceStrategies={namespaceStrategies}
|
||||
repositoryTypes={repositoryTypes}
|
||||
@@ -75,7 +79,9 @@ const CreatorRoute: FC<CreatorRouteProps> = ({ creator, creators }) => {
|
||||
nameForm={NamespaceAndNameFields}
|
||||
informationForm={RepositoryInformationForm}
|
||||
/>
|
||||
) : null}
|
||||
) : (
|
||||
<Notification type="warning">{t("create.noTypes")}</Notification>
|
||||
)}
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user