Rename ListView to CollectionView and OneLineView to CollectionItemLink
authorFrank Bessou <frank.bessou@logilab.fr>
Thu, 06 Apr 2017 10:49:21 +0200
changeset 86 52b73d0dacee
parent 85 3af45ba4cb13
child 87 e788bdc3ea46
Rename ListView to CollectionView and OneLineView to CollectionItemLink
src/components/BaseViews.js
src/components/Entities.js
src/components/Entity.js
test/index.js
--- a/src/components/BaseViews.js	Thu Apr 06 09:06:13 2017 +0200
+++ b/src/components/BaseViews.js	Thu Apr 06 10:49:21 2017 +0200
@@ -5,7 +5,7 @@
 import {PropTypeJsonaryWrapper} from '../jsonaryutils';
 import {appendPath} from '../utils';
 
-export function OneLineView({entity, etype}) {
+export function CollectionItemLink({entity, etype}) {
     // XXX Use schema link when it becomes available
     const id = entity.get('/id');
     return (
@@ -15,19 +15,19 @@
     );
 }
 
-OneLineView.propTypes = {
+CollectionItemLink.propTypes = {
     entity: PropTypeJsonaryWrapper.isRequired,
     etype: React.PropTypes.string.isRequired,
 };
 
-export function ListView(props) {
+export function CollectionView(props) {
     return (
         <ul className="list-group">
             {
                 props.entities.data.mapItems(
                     entity => (
                         <li className="list-group-item" key={entity.id}>
-                            <OneLineView entity={entity} etype={props.entities.etype} />
+                            <CollectionItemLink entity={entity} etype={props.entities.etype} />
                         </li>
                         )
                 )
@@ -36,7 +36,7 @@
     );
 }
 
-ListView.propTypes = {
+CollectionView.propTypes = {
     entities: PropTypesEntitiesModel.isRequired,
 };
 
--- a/src/components/Entities.js	Thu Apr 06 09:06:13 2017 +0200
+++ b/src/components/Entities.js	Thu Apr 06 10:49:21 2017 +0200
@@ -1,6 +1,6 @@
 import React from 'react';
 import {isEmpty} from 'lodash/lang';
-import {ActionsDropDown, ListView} from './BaseViews';
+import {ActionsDropDown, CollectionView} from './BaseViews';
 import Api from '../Api';
 import {PropTypesEntitiesModel} from '../model';
 
@@ -43,7 +43,7 @@
 
     function renderEntities() {
         if (!isEmpty(props.entities)) {
-            return <ListView entities={props.entities} />;
+            return <CollectionView entities={props.entities} />;
         }
 
         return <div className="text-mutted">
--- a/src/components/Entity.js	Thu Apr 06 09:06:13 2017 +0200
+++ b/src/components/Entity.js	Thu Apr 06 10:49:21 2017 +0200
@@ -8,7 +8,7 @@
 import {wrapEntityData, PropTypeJsonaryWrapper} from '../jsonaryutils'
 import {PropTypesEntityModel} from '../model';
 import {buildFormData} from '../utils';
-import {ActionsDropDown, OneLineView} from './BaseViews';
+import {ActionsDropDown, CollectionItemLink} from './BaseViews';
 import {WorkflowActions} from './Workflow';
 
 function EntityAttribute({attribute}) {
@@ -145,7 +145,7 @@
             relatedItems = this.state.related.map(
                 entity => (
                     <li className="list-group-item" key={entity.eid}>
-                        <OneLineView entity={entity} />
+                        <CollectionItemLink entity={entity} />
                     </li>
                 )
             );
--- a/test/index.js	Thu Apr 06 09:06:13 2017 +0200
+++ b/test/index.js	Thu Apr 06 10:49:21 2017 +0200
@@ -10,7 +10,7 @@
 import {buildFormData} from '../src/utils';
 import {Api} from '../src/Api';
 import defaultApi from '../src/Api';
-import {ActionLink, ActionsDropDown, OneLineView} from '../src/components/BaseViews';
+import {ActionLink, ActionsDropDown, CollectionItemLink} from '../src/components/BaseViews';
 import {EntityMeta} from '../src/components/Entity';
 import {wrapEntityData} from "../src/jsonaryutils";
 
@@ -120,7 +120,7 @@
 
 });
 
-describe('<OneLineView />', () => {
+describe('<CollectionItemLink />', () => {
     beforeEach(() => {
         sinon.stub(defaultApi, 'buildUrl').callsFake( x => `http://testing.com/${x}`);
     });
@@ -135,7 +135,7 @@
             cw_etype: 'user',
             dc_title: 'bob',
         };
-        const wrapper = shallow(<OneLineView entity={entity} />);
+        const wrapper = shallow(<CollectionItemLink entity={entity} />);
         expect(wrapper.is('Link')).to.be.equal(true);
         expect(wrapper.children().length).to.equal(1);
         const link = wrapper.render();
@@ -148,7 +148,7 @@
             eid: 123,
             cw_etype: 'CWUser',
         };
-        const wrapper = shallow(<OneLineView entity={entity} />);
+        const wrapper = shallow(<CollectionItemLink entity={entity} />);
         expect(wrapper.is('Link')).to.be.equal(true);
         expect(wrapper.children().length).to.equal(1);
         const link = wrapper.render();
@@ -164,7 +164,7 @@
             dc_title: 'bob',
             download_url: 'https://example.com/123/download',
         };
-        const wrapper = shallow(<OneLineView entity={entity} />);
+        const wrapper = shallow(<CollectionItemLink entity={entity} />);
         expect(wrapper.is('div')).to.be.equal(true);
         expect(wrapper.children().length).to.equal(3);
         const link = wrapper.render();
@@ -180,7 +180,7 @@
             dc_title: 'bob',
             workflow_state: 'jumping',
         };
-        const wrapper = shallow(<OneLineView entity={entity} />);
+        const wrapper = shallow(<CollectionItemLink entity={entity} />);
         expect(wrapper.is('div')).to.be.equal(true);
         expect(wrapper.children().length).to.equal(3);
         expect(wrapper.find('span').text()).to.be.equal('jumping');