"@material-ui/core": "1.4.0",
"@material-ui/icons": "1.1.0",
"@types/lodash": "4.14.112",
- "@types/redux-form": "^7.4.1",
+ "@types/redux-form": "7.4.1",
"axios": "0.18.0",
"classnames": "2.2.6",
"lodash": "4.17.10",
"@types/react-router-dom": "4.2.7",
"@types/react-router-redux": "5.0.15",
"@types/redux-devtools": "3.0.44",
- "@types/redux-form": "^7.4.1",
+ "@types/redux-form": "7.4.1",
"axios-mock-adapter": "1.15.0",
"enzyme": "3.3.0",
"enzyme-adapter-react-16": "1.1.1",
"jest-localstorage-mock": "2.2.0",
"redux-devtools": "3.4.1",
- "redux-form": "^7.4.2",
+ "redux-form": "7.4.2",
"typescript": "2.9.2"
},
"moduleNameMapper": {
//
// SPDX-License-Identifier: AGPL-3.0
-import require from '../require';
-import maxLength from '../max-length';
+import { require } from '../require';
+import { maxLength } from '../max-length';
-export const NAME = [require, maxLength(255)];
-export const DESCRIPTION = [maxLength(255)];
+export const PROJECT_NAME_VALIDATION = [require, maxLength(255)];
+export const PROJECT_DESCRIPTION_VALIDATION = [maxLength(255)];
}
// TODO types for maxLength
-const maxLength: any = (maxLengthValue = DEFAULT_MAX_VALUE, errorMessage = ERROR_MESSAGE) => {
+export const maxLength: any = (maxLengthValue = DEFAULT_MAX_VALUE, errorMessage = ERROR_MESSAGE) => {
return (value: string) => {
if (value) {
- return value && value && value.length <= maxLengthValue ? undefined : `${errorMessage || ERROR_MESSAGE} ${maxLengthValue}`;
+ return value && value.length <= maxLengthValue ? undefined : `${errorMessage || ERROR_MESSAGE} ${maxLengthValue}`;
}
return undefined;
};
};
-
-export default maxLength;
export const ERROR_MESSAGE = 'This field is required.';
-interface RequireProps {
+interface RequiredProps {
value: string;
}
// TODO types for require
-const require: any = (value: string, errorMessage = ERROR_MESSAGE) => {
- return value && value.toString().length > 0 ? undefined : ERROR_MESSAGE;
+export const require: any = (value: string) => {
+ return value && value.length > 0 ? undefined : ERROR_MESSAGE;
};
-
-export default require;
import DialogTitle from '@material-ui/core/DialogTitle';
import { Button, StyleRulesCallback, WithStyles, withStyles, CircularProgress } from '@material-ui/core';
-import { NAME, DESCRIPTION } from '../../validators/create-project/create-project-validator';
+import { PROJECT_NAME_VALIDATION, PROJECT_DESCRIPTION_VALIDATION } from '../../validators/create-project/create-project-validator';
type CssRules = "button" | "lastButton" | "formContainer" | "textField" | "dialog" | "dialogTitle" | "createProgress" | "dialogActions";
<Field name="name"
component={this.renderTextField}
floatinglabeltext="Project Name"
- validate={NAME}
+ validate={PROJECT_NAME_VALIDATION}
className={classes.textField}
label="Project Name"/>
<Field name="description"
component={this.renderTextField}
floatinglabeltext="Description - optional"
- validate={DESCRIPTION}
+ validate={PROJECT_DESCRIPTION_VALIDATION}
className={classes.textField}
label="Description - optional"/>
</DialogContent>