1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-29 13:20:06 +02:00

updating props index name to be more generic as it will be used for another container

This commit is contained in:
Alex Windett 2017-01-26 14:23:29 +00:00
parent 8f6e4d5f32
commit 20048eb35c
7 changed files with 30 additions and 31 deletions

View File

@ -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) => (
<PersonDelete
orgIndex={orgIndex}
parentIndex={parentIndex}
personIndex={index}
removeMember={removeMember}
/>
@ -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,
};

View File

@ -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,
};

View File

@ -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) => {
? <Tooltip
handleSelect={handleOptionSelect}
options={membersRolesOptions}
orgIndex={orgIndex}
parentIndex={parentIndex}
person={_person}
personAttr="role"
personIndex={personIndex}
@ -96,7 +96,7 @@ PersonRole.propTypes = {
handleMemberUpdate: React.PropTypes.func,
handleRoleTooltip: React.PropTypes.func,
membersRolesOptions: React.PropTypes.array,
orgIndex: React.PropTypes.number,
parentIndex: React.PropTypes.number,
person: React.PropTypes.object,
personIndex: React.PropTypes.number,
toggledID: React.PropTypes.oneOfType([

View File

@ -57,7 +57,7 @@ const PersonStatus = (props) => {
personIndex,
handleStatusTooltip,
handleMemberUpdate,
orgIndex
parentIndex
} = props;
const toggled = toggledID === person.uuid;
@ -82,7 +82,7 @@ const PersonStatus = (props) => {
? <Tooltip
handleSelect={handleOptionSelect}
options={membersStatusOptions}
orgIndex={orgIndex}
parentIndex={parentIndex}
person={_person}
personAttr="status"
personIndex={personIndex}
@ -96,7 +96,7 @@ PersonStatus.propTypes = {
handleMemberUpdate: React.PropTypes.func,
handleStatusTooltip: React.PropTypes.func,
membersStatusOptions: React.PropTypes.array,
orgIndex: React.PropTypes.number,
parentIndex: React.PropTypes.number,
person: React.PropTypes.object,
personIndex: React.PropTypes.number,
toggledID: React.PropTypes.oneOfType([

View File

@ -20,7 +20,7 @@ module.exports = ({
personAttr,
personIndex,
options = [],
orgIndex,
parentIndex,
}) => {
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,

View File

@ -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)
});

View File

@ -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),
]
};
},