From 20048eb35c342346719dc678471b2da9ad647ee2 Mon Sep 17 00:00:00 2001 From: Alex Windett Date: Thu, 26 Jan 2017 14:23:29 +0000 Subject: [PATCH 1/3] updating props index name to be more generic as it will be used for another container --- .../src/components/people-list/table/index.js | 10 ++++---- .../people-list/table/person-delete.js | 6 ++--- .../people-list/table/person-role.js | 6 ++--- .../people-list/table/person-status.js | 6 ++--- .../components/people-list/table/tooltip.js | 6 ++--- frontend/src/containers/org/people.js | 2 +- frontend/src/state/reducers/orgs.js | 25 +++++++++---------- 7 files changed, 30 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/people-list/table/index.js b/frontend/src/components/people-list/table/index.js index 9dbde524..39196a55 100644 --- a/frontend/src/components/people-list/table/index.js +++ b/frontend/src/components/people-list/table/index.js @@ -15,7 +15,7 @@ const PeopleTable = (props) => { handleMemberUpdate, people = [], orgUI = {}, - orgIndex, + parentIndex, removeMember } = props; @@ -42,7 +42,7 @@ const PeopleTable = (props) => { handleMemberUpdate={handleMemberUpdate} handleStatusTooltip={handleStatusTooltip} membersStatusOptions={orgUI.members_status} - orgIndex={orgIndex} + parentIndex={parentIndex} person={person} personIndex={index} toggledID={orgUI.member_status_tooltip} @@ -54,7 +54,7 @@ const PeopleTable = (props) => { handleMemberUpdate={handleMemberUpdate} handleRoleTooltip={handleRoleTooltip} membersRolesOptions={orgUI.members_roles} - orgIndex={orgIndex} + parentIndex={parentIndex} person={person} personIndex={index} toggledID={orgUI.member_role_tooltip} @@ -63,7 +63,7 @@ const PeopleTable = (props) => { const remove = (person) => ( @@ -90,8 +90,8 @@ PeopleTable.propTypes = { handleMemberUpdate: React.PropTypes.func, handleRoleTooltip: React.PropTypes.func, handleStatusTooltip: React.PropTypes.func, - orgIndex: React.PropTypes.number, orgUI: React.PropTypes.object, + parentIndex: React.PropTypes.number, people: React.PropTypes.array, removeMember: React.PropTypes.func, }; diff --git a/frontend/src/components/people-list/table/person-delete.js b/frontend/src/components/people-list/table/person-delete.js index 87f592fc..c648591c 100644 --- a/frontend/src/components/people-list/table/person-delete.js +++ b/frontend/src/components/people-list/table/person-delete.js @@ -18,13 +18,13 @@ const PersonDelete = (props) => { const { personIndex, - orgIndex, + parentIndex, removeMember } = props; const _onClick = () => removeMember({ personIndex, - orgIndex + parentIndex }); return ( @@ -35,7 +35,7 @@ const PersonDelete = (props) => { }; PersonDelete.propTypes = { - orgIndex: React.PropTypes.number, + parentIndex: React.PropTypes.number, personIndex: React.PropTypes.number, removeMember: React.PropTypes.func, }; diff --git a/frontend/src/components/people-list/table/person-role.js b/frontend/src/components/people-list/table/person-role.js index 85531679..58e97431 100644 --- a/frontend/src/components/people-list/table/person-role.js +++ b/frontend/src/components/people-list/table/person-role.js @@ -57,7 +57,7 @@ const PersonRole = (props) => { personIndex, handleRoleTooltip, handleMemberUpdate, - orgIndex + parentIndex } = props; const toggled = toggledID === person.uuid; @@ -82,7 +82,7 @@ const PersonRole = (props) => { ? { personIndex, handleStatusTooltip, handleMemberUpdate, - orgIndex + parentIndex } = props; const toggled = toggledID === person.uuid; @@ -82,7 +82,7 @@ const PersonStatus = (props) => { ? { const _options = options.map( (option, i) => { @@ -33,7 +33,7 @@ module.exports = ({ [`${personAttr}`]: option }, personIndex, - orgIndex, + parentIndex, }; const _onClick = () => handleSelect(payload); @@ -64,7 +64,7 @@ module.exports = ({ module.exports.propTypes = { handleSelect: React.PropTypes.func, options: React.PropTypes.array, - orgIndex: React.PropTypes.number, + parentIndex: React.PropTypes.number, person: React.PropTypes.object, personAttr: React.PropTypes.string, personIndex: React.PropTypes.number, diff --git a/frontend/src/containers/org/people.js b/frontend/src/containers/org/people.js index 55726513..991275f0 100644 --- a/frontend/src/containers/org/people.js +++ b/frontend/src/containers/org/people.js @@ -38,7 +38,7 @@ const mapStateToProps = (state, { }) => ({ people: peopleByOrgIdSelector(params.org)(state), orgUI: orgUISelector(state), - orgIndex: orgIndexSelector(params.org)(state), + parentIndex: orgIndexSelector(params.org)(state), platformMembers: membersSelector(state) }); diff --git a/frontend/src/state/reducers/orgs.js b/frontend/src/state/reducers/orgs.js index 25f6a7aa..e5d034d7 100644 --- a/frontend/src/state/reducers/orgs.js +++ b/frontend/src/state/reducers/orgs.js @@ -50,11 +50,10 @@ module.exports = handleActions({ }, [handleMemberUpdate.toString()]: (state, action) => { const { - orgIndex, + parentIndex, person, personIndex, } = action.payload; - return { ...state, ui: { @@ -63,39 +62,39 @@ module.exports = handleActions({ member_role_tooltip: false }, data: [ - ...state.data.slice(0, orgIndex), + ...state.data.slice(0, parentIndex), { - ...state.data[orgIndex], + ...state.data[parentIndex], members: [ - ...state.data[orgIndex].members.slice(0, personIndex), + ...state.data[parentIndex].members.slice(0, personIndex), { ...person, }, - ...state.data[orgIndex].members.slice(personIndex + 1) + ...state.data[parentIndex].members.slice(personIndex + 1) ] }, - ...state.data.slice(orgIndex + 1), + ...state.data.slice(parentIndex + 1), ] }; }, [removeMember.toString()]: (state, action) => { const { - orgIndex, + parentIndex, personIndex, } = action.payload; return { ...state, data: [ - ...state.data.slice(0, orgIndex), + ...state.data.slice(0, parentIndex), { - ...state.data[orgIndex], + ...state.data[parentIndex], members: [ - ...state.data[orgIndex].members.slice(0, personIndex), - ...state.data[orgIndex].members.slice(personIndex + 1) + ...state.data[parentIndex].members.slice(0, personIndex), + ...state.data[parentIndex].members.slice(personIndex + 1) ] }, - ...state.data.slice(orgIndex + 1), + ...state.data.slice(parentIndex + 1), ] }; }, From 46070b9b1b912ae7e41deefbac35a3e47b6999ac Mon Sep 17 00:00:00 2001 From: Alex Windett Date: Thu, 26 Jan 2017 14:34:06 +0000 Subject: [PATCH 2/3] updating UI props name to be more generic for future use --- frontend/src/components/people-list/index.js | 10 +++++----- frontend/src/components/people-list/table/index.js | 14 +++++++------- frontend/src/containers/org/people.js | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/people-list/index.js b/frontend/src/components/people-list/index.js index aa1dea90..f07be5c4 100644 --- a/frontend/src/components/people-list/index.js +++ b/frontend/src/components/people-list/index.js @@ -14,7 +14,7 @@ const buttonStyle = { const People = (props) => { const { - orgUI = {}, + UI = {}, handleToggle, people } = props; @@ -24,7 +24,7 @@ const People = (props) => {