setting up redux store for members and creating selector for members

This commit is contained in:
Alex Windett 2017-01-23 11:48:20 +00:00
parent c1d1661a22
commit 1651dc7fcc
6 changed files with 22 additions and 14 deletions

View File

@ -55,7 +55,6 @@ const People = (props) => {
People.propTypes = { People.propTypes = {
people: React.PropTypes.arrayOf(PropTypes.person) people: React.PropTypes.arrayOf(PropTypes.person)
// toggleCollapsed: React.PropTypes.func
}; };
const mapStateToProps = (state, { const mapStateToProps = (state, {

View File

@ -218,9 +218,10 @@
"uuid": "e12ad7db-91b2-4154-83dd-40dcfc700dcc", "uuid": "e12ad7db-91b2-4154-83dd-40dcfc700dcc",
"id": "biz-tech", "id": "biz-tech",
"name": "BizTech", "name": "BizTech",
"members": [{ "members": [
"uuid": "fd853d8f-e1dd-49b5-b7b3-ae9adfea1e2f" "fd853d8f-e1dd-49b5-b7b3-ae9adfea1e2f",
}] "6deddbaa-3b94-4373-8cf7-97129507a872"
]
}, { }, {
"owner": "b94033c1-3665-4c36-afab-d9c3d0b51c01", "owner": "b94033c1-3665-4c36-afab-d9c3d0b51c01",
"uuid": "551f316d-e414-480f-9787-b4c408db3edd", "uuid": "551f316d-e414-480f-9787-b4c408db3edd",

View File

@ -61,10 +61,6 @@ const Sections = React.PropTypes.arrayOf(
React.PropTypes.string React.PropTypes.string
); );
const Person = React.PropTypes.shape({
...BaseObject
});
module.exports = { module.exports = {
account: Account, account: Account,
link: Link, link: Link,
@ -75,6 +71,5 @@ module.exports = {
instance: Instance, instance: Instance,
metric: Metric, metric: Metric,
metricType: MetricType, metricType: MetricType,
dataset: Dataset, dataset: Dataset
person: Person
}; };

View File

@ -14,6 +14,7 @@ module.exports = () => {
monitors: require('@state/reducers/monitors'), monitors: require('@state/reducers/monitors'),
orgs: require('@state/reducers/orgs'), orgs: require('@state/reducers/orgs'),
projects: require('@state/reducers/projects'), projects: require('@state/reducers/projects'),
services: require('@state/reducers/services') services: require('@state/reducers/services'),
members: require('@state/reducers/members'),
}); });
}; };

View File

@ -0,0 +1,9 @@
const ReduxActions = require('redux-actions');
const {
handleActions
} = ReduxActions;
module.exports = handleActions({
'x': (state) => state // somehow handleActions needs at least one reducer
}, {});

View File

@ -112,9 +112,12 @@ const instancesByProjectId = (projectId) => createSelector(
); );
const peopleByOrgId = (orgId) => createSelector( const peopleByOrgId = (orgId) => createSelector(
// [members, orgById(orgId)], (members, org) => org.members [members, orgById(orgId)], (members, org) => {
const matched = [];
[members, orgById(orgId)], (members, org) => org.members org.members.filter((UUID) =>
matched.push(find(members, ['uuid', UUID])));
return matched;
}
); );
module.exports = { module.exports = {