fix(xo-web): fix selectors (#4807)

This commit is contained in:
Rajaa.BARHTAOUI 2020-03-02 10:57:48 +01:00 committed by GitHub
parent 9ba77c9498
commit 32960332b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -89,13 +89,13 @@ class PatchesCard extends Component {
@injectIntl
class DefaultCard extends Component {
_getPoolWisePredicate = createSelector(
() => map(this.state.pools, 'id'),
createCollectionWrapper(() => map(this.state.pools, 'id')),
poolsIds => item => isEmpty(poolsIds) || includes(poolsIds, item.$pool)
)
_getPredicate = createSelector(
this._getPoolWisePredicate,
() => map(this.state.hosts, 'id'),
createCollectionWrapper(() => map(this.state.hosts, 'id')),
(poolWisePredicate, hostsIds) => item =>
isEmpty(hostsIds)
? poolWisePredicate(item)

View File

@ -18,6 +18,7 @@ import { Container, Row, Col } from 'grid'
import { connectStore, formatSize, noop } from 'utils'
import { concat, groupBy, isEmpty, map, mapValues, pick, some } from 'lodash'
import {
createCollectionWrapper,
createGetObjectsOfType,
createSelector,
getCheckPermissions,
@ -313,7 +314,7 @@ export default class SrDisks extends Component {
_getIsVdiAttached = createSelector(
createSelector(
() => this.props.vbds,
() => map(this.props.vdis, 'id'),
createCollectionWrapper(() => map(this.props.vdis, 'id')),
(vbds, vdis) => pick(groupBy(vbds, 'VDI'), vdis)
),
vbdsByVdi => mapValues(vbdsByVdi, vbds => some(vbds, 'attached'))