mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-24 01:09:48 +01:00
merge 2.0.0-m3
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import classNames from "classnames";
|
||||
import { LabelWithHelpIcon } from "../index";
|
||||
|
||||
export type SelectItem = {
|
||||
@@ -12,6 +13,7 @@ type Props = {
|
||||
options: SelectItem[],
|
||||
value?: SelectItem,
|
||||
onChange: string => void,
|
||||
loading?: boolean,
|
||||
helpText?: string
|
||||
};
|
||||
|
||||
@@ -31,12 +33,17 @@ class Select extends React.Component<Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { options, value, label, helpText } = this.props;
|
||||
const { options, value, label, helpText, loading } = this.props;
|
||||
const loadingClass = loading ? "is-loading" : "";
|
||||
|
||||
|
||||
return (
|
||||
<div className="field">
|
||||
<LabelWithHelpIcon label={label} helpText={helpText} />
|
||||
<div className="control select">
|
||||
<div className={classNames(
|
||||
"control select",
|
||||
loadingClass
|
||||
)}>
|
||||
<select
|
||||
ref={input => {
|
||||
this.field = input;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
const nameRegex = /^([A-z0-9.\-_@]|[^ ]([A-z0-9.\-_@ ]*[A-z0-9.\-_@]|[^\s])?)$/;
|
||||
const nameRegex = /^[A-Za-z0-9\.\-_][A-Za-z0-9\.\-_@]*$/;
|
||||
|
||||
export const isNameValid = (name: string) => {
|
||||
return nameRegex.test(name);
|
||||
|
||||
@@ -5,6 +5,7 @@ describe("test name validation", () => {
|
||||
it("should return false", () => {
|
||||
// invalid names taken from ValidationUtilTest.java
|
||||
const invalidNames = [
|
||||
"@test",
|
||||
" test 123",
|
||||
" test 123 ",
|
||||
"test 123 ",
|
||||
@@ -35,10 +36,9 @@ describe("test name validation", () => {
|
||||
"Test123-git",
|
||||
"Test_user-123.git",
|
||||
"test@scm-manager.de",
|
||||
"test 123",
|
||||
"test123",
|
||||
"tt",
|
||||
"t",
|
||||
|
||||
"valid_name",
|
||||
"another1",
|
||||
"stillValid",
|
||||
|
||||
Reference in New Issue
Block a user