fix(xo-web/xosan): install packs button condition (#2950)
This commit is contained in:
parent
2b95eb4e4d
commit
ecc62e4f54
@ -4,12 +4,7 @@ import Component from 'base-component'
|
||||
import { createGetObjectsOfType, createSelector } from 'selectors'
|
||||
import { map } from 'lodash'
|
||||
import { subscribeResourceCatalog } from 'xo'
|
||||
import {
|
||||
addSubscriptions,
|
||||
isLatestXosanPackInstalled,
|
||||
connectStore,
|
||||
findLatestPack,
|
||||
} from 'utils'
|
||||
import { isLatestXosanPackInstalled, connectStore, findLatestPack } from 'utils'
|
||||
|
||||
@connectStore(
|
||||
{
|
||||
@ -19,20 +14,19 @@ import {
|
||||
},
|
||||
{ withRef: true }
|
||||
)
|
||||
@addSubscriptions(() => ({
|
||||
catalog: subscribeResourceCatalog,
|
||||
}))
|
||||
export default class UpdateXosanPacksModal extends Component {
|
||||
state = {
|
||||
status: 'checking',
|
||||
componentDidMount () {
|
||||
this.componentWillUnmount = subscribeResourceCatalog(catalog =>
|
||||
this.setState({ catalog })
|
||||
)
|
||||
}
|
||||
|
||||
get value () {
|
||||
return this.state.pack
|
||||
return this._getStatus().pack
|
||||
}
|
||||
|
||||
_getStatus = createSelector(
|
||||
() => this.props.catalog,
|
||||
() => this.state.catalog,
|
||||
() => this.props.hosts,
|
||||
(catalog, hosts) => {
|
||||
if (catalog === undefined) {
|
||||
|
@ -92,7 +92,7 @@ export default class NewXosan extends Component {
|
||||
const hosts = filter(this.props.hosts, { $pool: pool.id })
|
||||
const pack = findLatestPack(catalog.xosan, map(hosts, 'version'))
|
||||
|
||||
if (isLatestXosanPackInstalled(pack, hosts)) {
|
||||
if (!isLatestXosanPackInstalled(pack, hosts)) {
|
||||
this.setState({
|
||||
needsUpdate: true,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user