Remove AddRelated component
authorFrank Bessou <frank.bessou@logilab.fr>
Thu, 18 May 2017 10:06:12 +0200
changeset 212 7d6ca8b951d5
parent 211 e406f2aea20d
child 213 0f0820dd5631
Remove AddRelated component
src/components/Entity.js
--- a/src/components/Entity.js	Wed May 17 17:56:14 2017 +0200
+++ b/src/components/Entity.js	Thu May 18 10:06:12 2017 +0200
@@ -2,7 +2,6 @@
 import {PropTypes} from 'prop-types';
 import {FormWrapper} from './Form';
 
-import Api from '../Api';
 import HypermediaClient from '../services/hypermedia';
 import {PropTypeJsonaryWrapper} from '../jsonaryutils';
 import {ActionsDropDown, CollectionView} from './BaseViews';
@@ -205,35 +204,3 @@
 EntityForm.contextTypes = {
     router: PropTypes.object,
 };
-
-export class AddRelated extends EntityForm {
-
-    constructor(props, context) {
-        super(props, context);
-        this.etype = props.match.params.etype;
-        this.rtype = props.match.params.rtype;
-        this.targetEid = props.match.params.eid;
-    }
-
-    componentDidMount() {
-        Api.getRelatedSchema(this.etype, this.rtype, 'creation')
-            .then(schema => this.setState({schema: schema}));
-    }
-
-    onSubmit({formData}) {
-        const path = `/${this.etype}/${this.targetEid}`;
-        Api.relateEntity(this.etype, this.targetEid, this.rtype, formData)
-            .then(this.context.router.history.push(path));
-    }
-
-}
-
-AddRelated.propTypes = {
-    match: PropTypes.shape({
-        params: PropTypes.shape({
-            etype: PropTypes.string.isRequired,
-            rtype: PropTypes.string.isRequired,
-            eid: PropTypes.number.isRequired,
-        }).isRequired,
-    }),
-};