mirror of
https://github.com/yldio/copilot.git
synced 2024-11-10 21:30:06 +02:00
setting up redux store for members and creating selector for members
This commit is contained in:
parent
c1d1661a22
commit
1651dc7fcc
@ -55,7 +55,6 @@ const People = (props) => {
|
||||
|
||||
People.propTypes = {
|
||||
people: React.PropTypes.arrayOf(PropTypes.person)
|
||||
// toggleCollapsed: React.PropTypes.func
|
||||
};
|
||||
|
||||
const mapStateToProps = (state, {
|
||||
|
@ -218,9 +218,10 @@
|
||||
"uuid": "e12ad7db-91b2-4154-83dd-40dcfc700dcc",
|
||||
"id": "biz-tech",
|
||||
"name": "BizTech",
|
||||
"members": [{
|
||||
"uuid": "fd853d8f-e1dd-49b5-b7b3-ae9adfea1e2f"
|
||||
}]
|
||||
"members": [
|
||||
"fd853d8f-e1dd-49b5-b7b3-ae9adfea1e2f",
|
||||
"6deddbaa-3b94-4373-8cf7-97129507a872"
|
||||
]
|
||||
}, {
|
||||
"owner": "b94033c1-3665-4c36-afab-d9c3d0b51c01",
|
||||
"uuid": "551f316d-e414-480f-9787-b4c408db3edd",
|
||||
|
@ -61,10 +61,6 @@ const Sections = React.PropTypes.arrayOf(
|
||||
React.PropTypes.string
|
||||
);
|
||||
|
||||
const Person = React.PropTypes.shape({
|
||||
...BaseObject
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
account: Account,
|
||||
link: Link,
|
||||
@ -75,6 +71,5 @@ module.exports = {
|
||||
instance: Instance,
|
||||
metric: Metric,
|
||||
metricType: MetricType,
|
||||
dataset: Dataset,
|
||||
person: Person
|
||||
dataset: Dataset
|
||||
};
|
||||
|
@ -14,6 +14,7 @@ module.exports = () => {
|
||||
monitors: require('@state/reducers/monitors'),
|
||||
orgs: require('@state/reducers/orgs'),
|
||||
projects: require('@state/reducers/projects'),
|
||||
services: require('@state/reducers/services')
|
||||
services: require('@state/reducers/services'),
|
||||
members: require('@state/reducers/members'),
|
||||
});
|
||||
};
|
||||
|
9
frontend/src/state/reducers/members.js
Normal file
9
frontend/src/state/reducers/members.js
Normal 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
|
||||
}, {});
|
@ -112,9 +112,12 @@ const instancesByProjectId = (projectId) => createSelector(
|
||||
);
|
||||
|
||||
const peopleByOrgId = (orgId) => createSelector(
|
||||
// [members, orgById(orgId)], (members, org) => org.members
|
||||
|
||||
[members, orgById(orgId)], (members, org) => org.members
|
||||
[members, orgById(orgId)], (members, org) => {
|
||||
const matched = [];
|
||||
org.members.filter((UUID) =>
|
||||
matched.push(find(members, ['uuid', UUID])));
|
||||
return matched;
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = {
|
||||
|
Loading…
Reference in New Issue
Block a user