Remove EntityAttribute component
authorFrank Bessou <frank.bessou@logilab.fr>
Thu, 27 Apr 2017 15:54:13 +0200
changeset 146 93e839b8c619
parent 145 a58c5d2d5428
child 147 62686dc26af0
Remove EntityAttribute component
src/components/Entity.js
--- a/src/components/Entity.js	Tue May 02 11:49:26 2017 +0200
+++ b/src/components/Entity.js	Thu Apr 27 15:54:13 2017 +0200
@@ -14,28 +14,18 @@
 import {WorkflowActions} from './Workflow';
 import {AttributeValue} from './Attribute';
 
-function EntityAttribute({attribute}) {
-    return (
-        <tr>
-            <th>{attribute.schemas().title() || attribute.parentKey()}</th>
-            <td><AttributeValue attribute={attribute} /></td>
-        </tr>
-    );
-}
-EntityAttribute.propTypes = {
-    attribute: PropTypeJsonaryWrapper.isRequired,
-};
-
 function EntityAttributes(props) {
     const {data} = props;
-    const properties = data.schemas().definedProperties();
-
+    const schema = data.schemas();
+    const properties = schema.definedProperties();
     const attributes = properties.map(
         (name)  => {
+            const attribute = data.property(name);
             return (
-                <EntityAttribute key={name}
-                    attribute={data.property(name)}
-                />
+                <tr key={name}>
+                    <th>{attribute.schemas().title() || name}</th>
+                    <td><AttributeValue attribute={attribute} /></td>
+                </tr>
             );
         });
     return (