Let CollectionView take a jsonarywrapper as collection attribute
authorFrank Bessou <frank.bessou@logilab.fr>
Tue, 09 May 2017 10:29:46 +0200
changeset 187 94c1c16ec8a0
parent 186 e44bcf04b4fd
child 188 8cc2ed471ffb
Let CollectionView take a jsonarywrapper as collection attribute
src/components/BaseViews.js
src/components/Entities.js
src/components/Entity.js
--- a/src/components/BaseViews.js	Wed May 10 10:56:10 2017 +0200
+++ b/src/components/BaseViews.js	Tue May 09 10:29:46 2017 +0200
@@ -22,7 +22,7 @@
     return (
         <ul className="list-group">
             {
-                props.collection.data.mapItems(
+                props.collection.mapItems(
                     item => (
                         <li className="list-group-item" key={item.getLink('item').href}>
                             <CollectionItemLink item={item} />
@@ -35,7 +35,7 @@
 }
 
 CollectionView.propTypes = {
-    collection: PropTypesResourceModel.isRequired,
+    collection: PropTypeJsonaryWrapper.isRequired,
 };
 
 export function ActionsDropDown({target, ignore = []}) {
--- a/src/components/Entities.js	Wed May 10 10:56:10 2017 +0200
+++ b/src/components/Entities.js	Tue May 09 10:29:46 2017 +0200
@@ -45,7 +45,7 @@
 
     function renderEntities() {
         if (props.entities.data.length() > 0) {
-            return <CollectionView collection={props.entities} />;
+            return <CollectionView collection={props.entities.data} />;
         }
 
         return <div className="text-mutted">
--- a/src/components/Entity.js	Wed May 10 10:56:10 2017 +0200
+++ b/src/components/Entity.js	Tue May 09 10:29:46 2017 +0200
@@ -122,7 +122,7 @@
                     </div>
             );
         } else {
-            return <CollectionView collection={this.state.related} />;
+            return <CollectionView collection={this.state.related.data} />;
         }
     }