adding in check for member/people length to be greater then 0

This commit is contained in:
Alex Windett 2017-01-25 14:11:31 +00:00
parent 9e302e093a
commit 2093530f17
2 changed files with 12 additions and 6 deletions

View File

@ -16,6 +16,7 @@ const People = (props) => {
const { const {
orgUI = {}, orgUI = {},
handleToggle, handleToggle,
people
} = props; } = props;
return ( return (
@ -36,7 +37,9 @@ const People = (props) => {
<Row> <Row>
<Column xs={12}> <Column xs={12}>
<PeopleTable {...props} /> { people.length > 0
? <PeopleTable {...props} />
: <h3>There is nobody in this orgnaisation</h3> }
</Column> </Column>
</Row> </Row>
</div> </div>
@ -46,6 +49,7 @@ const People = (props) => {
People.propTypes = { People.propTypes = {
handleToggle: React.PropTypes.func, handleToggle: React.PropTypes.func,
orgUI: React.PropTypes.object, orgUI: React.PropTypes.object,
people: React.PropTypes.array
}; };
module.exports = People; module.exports = People;

View File

@ -129,12 +129,14 @@ const instancesByProjectId = (projectId) => createSelector(
const peopleByOrgId = (orgId) => createSelector( const peopleByOrgId = (orgId) => createSelector(
[members, orgById(orgId)], (members, org) => { [members, orgById(orgId)], (members, org) => {
const matched = []; const matched = [];
org.members.filter((m) => { if (Object.keys(org.members).length > 0) {
matched.push({ org.members.filter((m) => {
...find(members, ['uuid', m.uuid]), matched.push({
...m ...find(members, ['uuid', m.uuid]),
...m
});
}); });
}); }
return matched; return matched;
} }
); );