refactor RepositoryForm.tsx to FC

This commit is contained in:
Eduard Heimbuch
2020-11-24 12:50:22 +01:00
parent 240069734d
commit ff2b4d8acd
9 changed files with 355 additions and 197 deletions

View File

@@ -25,10 +25,11 @@
import { validation } from "@scm-manager/ui-components";
const nameRegex = /(?!^\.\.$)(?!^\.$)(?!.*[.]git$)(?!.*[\\\[\]])^[A-Za-z0-9\.][A-Za-z0-9\.\-_]*$/;
const namespaceExceptionsRegex = /^(([0-9]{1,3})|(create))$/;
const namespaceExceptionsRegexCreate = /^(([0-9]{1,3})|(create))$/;
const namespaceExceptionsRegexImport = /^(([0-9]{1,3})|(import))$/;
export const isNamespaceValid = (name: string) => {
return nameRegex.test(name) && !namespaceExceptionsRegex.test(name);
return nameRegex.test(name) && !namespaceExceptionsRegexCreate.test(name) && !namespaceExceptionsRegexImport.test(name);
};
export const isNameValid = (name: string) => {