diff --git a/scm-ui/src/permissions/components/table/PermissionRowEditable.js b/scm-ui/src/permissions/components/table/PermissionRowEditable.js index 7666fa92b1..6bed2bd799 100644 --- a/scm-ui/src/permissions/components/table/PermissionRowEditable.js +++ b/scm-ui/src/permissions/components/table/PermissionRowEditable.js @@ -4,17 +4,16 @@ import type { Permission } from "../../types/Permissions"; import { Checkbox, InputField } from "../../../components/forms/index"; import { DeleteButton, SubmitButton } from "../../../components/buttons/index"; import { translate } from "react-i18next"; -import { Select } from "../../../components/forms"; +import { Select } from "../../../components/forms/index"; type Props = { + submitForm: Permission => void, permission: Permission, t: string => string }; type State = { - name: string, - type: string, - groupPermission: boolean + permission: Permission }; class PermissionRowEditable extends React.Component { @@ -22,9 +21,12 @@ class PermissionRowEditable extends React.Component { super(props); this.state = { - name: "", - type: "READ", - groupPermission: false + permission: { + name: "", + type: "READ", + groupPermission: false, + _links: {} + } }; } @@ -32,15 +34,21 @@ class PermissionRowEditable extends React.Component { const { permission } = this.props; if (permission) { this.setState({ - name: permission.name, - type: permission.type, - groupPermission: permission.groupPermission + permission: { + name: permission.name, + type: permission.type, + groupPermission: permission.groupPermission, + _links: permission._links + } }); } } - + submit = (event: Event) => { + event.preventDefault(); + this.props.submitForm(this.state.permission); + }; render() { - const { name, type, groupPermission } = this.state; + const { permission } = this.state; const { t } = this.props; const types = ["READ", "OWNER", "GROUP"]; @@ -52,25 +60,30 @@ class PermissionRowEditable extends React.Component {