fix(xo-web/dashboard/overview): missing patches not fetched (#2772)

Fixes #2768
This commit is contained in:
badrAZ 2018-03-16 16:37:57 +01:00 committed by Pierre Donias
parent ca51d59815
commit 89e25c9b81

View File

@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import { Portal } from 'react-overlays' import { Portal } from 'react-overlays'
import { forEach, isEmpty, keys, map, noop } from 'lodash' import { forEach, isEmpty, keys, map } from 'lodash'
import _ from './intl' import _ from './intl'
import ActionButton from './action-button' import ActionButton from './action-button'
@ -76,9 +76,6 @@ const ActionButton_ = ({ children, labelId, ...props }) => (
// =================================================================== // ===================================================================
@connectStore({
hostsById: createGetObjectsOfType('host').groupBy('id'),
})
class HostsPatchesTable extends Component { class HostsPatchesTable extends Component {
constructor (props) { constructor (props) {
super(props) super(props)
@ -94,21 +91,15 @@ class HostsPatchesTable extends Component {
) )
_subscribeMissingPatches = (hosts = this.props.hosts) => { _subscribeMissingPatches = (hosts = this.props.hosts) => {
const { hostsById } = this.props const unsubs = map(hosts, host =>
subscribeHostMissingPatches(host, patches =>
const unsubs = map( this.setState({
hosts, missingPatches: {
host => ...this.state.missingPatches,
hostsById [host.id]: patches.length,
? subscribeHostMissingPatches(hostsById[host.id][0], patches => },
this.setState({ })
missingPatches: { )
...this.state.missingPatches,
[host.id]: patches.length,
},
})
)
: noop
) )
if (this.unsubscribeMissingPatches !== undefined) { if (this.unsubscribeMissingPatches !== undefined) {