+ client: modify added filters
This commit is contained in:
committed by
Simon Zolin
parent
0b8cba7384
commit
b3bca39de4
@@ -1,7 +1,7 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import { Trans } from 'react-i18next';
|
||||
import PropTypes from 'prop-types';
|
||||
import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, UNSAFE_PORTS } from '../helpers/constants';
|
||||
import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants';
|
||||
import { createOnBlurHandler } from './helpers';
|
||||
|
||||
export const renderField = (props, elementType) => {
|
||||
@@ -270,4 +270,11 @@ export const answer = (value) => {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const isValidUrl = (value) => {
|
||||
if (value && !R_URL_REQUIRES_PROTOCOL.test(value)) {
|
||||
return <Trans>form_error_url_format</Trans>;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const toNumber = value => value && parseInt(value, 10);
|
||||
|
||||
Reference in New Issue
Block a user