diff --git a/scm-ui/src/groups/components/GroupForm.js b/scm-ui/src/groups/components/GroupForm.js index cef8f0b1a1..097fd92e5c 100644 --- a/scm-ui/src/groups/components/GroupForm.js +++ b/scm-ui/src/groups/components/GroupForm.js @@ -5,18 +5,17 @@ import InputField from "../../components/forms/InputField"; import { SubmitButton } from "../../components/buttons"; import { translate } from "react-i18next"; import type { Group } from "../types/Group"; -import * as validator from "./groupValidation" +import * as validator from "./groupValidation"; type Props = { t: string => string, submitForm: Group => void -} +}; type State = { group: Group, - nameValidationError: boolean, - descriptionValidationError: boolean -} + nameValidationError: boolean +}; class GroupForm extends React.Component { constructor(props) { @@ -30,10 +29,9 @@ class GroupForm extends React.Component { }, _links: {}, members: [], - type: "", + type: "" }, - nameValidationError: false, - descriptionValidationError: false + nameValidationError: false }; } @@ -44,15 +42,15 @@ class GroupForm extends React.Component { isValid = () => { const group = this.state.group; - return !(this.state.nameValidationError || this.state.descriptionValidationError || group.name); - } + return !(this.state.nameValidationError || group.name); + }; submit = (event: Event) => { event.preventDefault(); if (this.isValid) { - this.props.submitForm(this.state.group) + this.props.submitForm(this.state.group); } - } + }; render() { const { t } = this.props; @@ -68,7 +66,7 @@ class GroupForm extends React.Component { label={t("group.description")} errorMessage="" onChange={this.handleDescriptionChange} - validationError={this.state.descriptionValidationError} + validationError={false} /> @@ -78,13 +76,13 @@ class GroupForm extends React.Component { handleGroupNameChange = (name: string) => { this.setState({ nameValidationError: !validator.isNameValid(name), - group: {...this.state.group, name} + group: { ...this.state.group, name } }); }; handleDescriptionChange = (description: string) => { this.setState({ - group: {...this.state.group, description } + group: { ...this.state.group, description } }); }; } diff --git a/scm-ui/src/groups/containers/AddGroup.js b/scm-ui/src/groups/containers/AddGroup.js index 6806478bdb..0089e3c4ce 100644 --- a/scm-ui/src/groups/containers/AddGroup.js +++ b/scm-ui/src/groups/containers/AddGroup.js @@ -13,9 +13,9 @@ type Props = { t: string => string, createGroup: (group: Group, callback?: () => void) => void, history: History -} +}; -type State = {} +type State = {}; class AddGroup extends React.Component { render() { @@ -30,21 +30,23 @@ class AddGroup extends React.Component { } groupCreated = () => { - console.log("pushing history") - this.props.history.push("/groups") - } + this.props.history.push("/groups"); + }; createGroup = (group: Group) => { - this.props.createGroup(group, this.groupCreated) + this.props.createGroup(group, this.groupCreated); }; } const mapDispatchToProps = dispatch => { return { - createGroup: (group: Group, callback?: () => void) => dispatch(createGroup(group, callback)) + createGroup: (group: Group, callback?: () => void) => + dispatch(createGroup(group, callback)) }; }; -const mapStateToProps = state => {}; +const mapStateToProps = state => { + return {} +}; export default connect( mapStateToProps,