// @flow import React from "react"; 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"; type Props = { permission: Permission, t: string => string }; type State = { name: string, type: string, groupPermission: boolean }; class PermissionRowEditable extends React.Component { constructor(props: Props) { super(props); this.state = { name: "", type: "READ", groupPermission: false }; } componentDidMount() { const { permission } = this.props; if (permission) { this.setState({ name: permission.name, type: permission.type, groupPermission: permission.groupPermission }); } } render() { const { name, type, groupPermission } = this.state; const { t } = this.props; const types = ["READ", "OWNER", "GROUP"]; const deleteButton = this.props.permission._links.delete ? ( ) : null; return (