mirror of
https://github.com/yldio/copilot.git
synced 2024-11-13 06:40: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.propTypes = {
|
||||||
people: React.PropTypes.arrayOf(PropTypes.person)
|
people: React.PropTypes.arrayOf(PropTypes.person)
|
||||||
// toggleCollapsed: React.PropTypes.func
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state, {
|
const mapStateToProps = (state, {
|
||||||
|
@ -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",
|
||||||
|
@ -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
|
|
||||||
};
|
};
|
||||||
|
@ -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'),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
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(
|
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 = {
|
||||||
|
Loading…
Reference in New Issue
Block a user