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

View File

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