chore: reformat with Prettier
This commit is contained in:
parent
48727740c4
commit
cc4ab94428
@ -88,7 +88,10 @@ const parseDuration = milliseconds => {
|
|||||||
|
|
||||||
@connect(({ lang }) => ({ lang }))
|
@connect(({ lang }) => ({ lang }))
|
||||||
export class FormattedDuration extends Component {
|
export class FormattedDuration extends Component {
|
||||||
_parseDuration = createSelector(() => this.props.duration, parseDuration)
|
_parseDuration = createSelector(
|
||||||
|
() => this.props.duration,
|
||||||
|
parseDuration
|
||||||
|
)
|
||||||
|
|
||||||
_humanizeDuration = createSelector(
|
_humanizeDuration = createSelector(
|
||||||
() => this.props.duration,
|
() => this.props.duration,
|
||||||
|
@ -170,7 +170,10 @@ class GenericSelect extends React.Component {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
_getObjectsById = createSelector(this._getObjects, getObjectsById)
|
_getObjectsById = createSelector(
|
||||||
|
this._getObjects,
|
||||||
|
getObjectsById
|
||||||
|
)
|
||||||
|
|
||||||
_getOptions = createSelector(
|
_getOptions = createSelector(
|
||||||
() => this.props.xoContainers,
|
() => this.props.xoContainers,
|
||||||
@ -402,8 +405,9 @@ export const SelectSr = makeStoreSelect(
|
|||||||
.sort()
|
.sort()
|
||||||
.groupBy('$container')
|
.groupBy('$container')
|
||||||
|
|
||||||
const getContainerIds = createSelector(getSrsByContainer, srsByContainer =>
|
const getContainerIds = createSelector(
|
||||||
keys(srsByContainer)
|
getSrsByContainer,
|
||||||
|
srsByContainer => keys(srsByContainer)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getContainers = createSelector(
|
const getContainers = createSelector(
|
||||||
@ -429,8 +433,9 @@ export const SelectVm = makeStoreSelect(
|
|||||||
.sort()
|
.sort()
|
||||||
.groupBy('$container')
|
.groupBy('$container')
|
||||||
|
|
||||||
const getContainerIds = createSelector(getVmsByContainer, vmsByContainer =>
|
const getContainerIds = createSelector(
|
||||||
keys(vmsByContainer)
|
getVmsByContainer,
|
||||||
|
vmsByContainer => keys(vmsByContainer)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getPools = createGetObjectsOfType('pool')
|
const getPools = createGetObjectsOfType('pool')
|
||||||
@ -440,8 +445,10 @@ export const SelectVm = makeStoreSelect(
|
|||||||
.pick(getContainerIds)
|
.pick(getContainerIds)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getContainers = createSelector(getPools, getHosts, (pools, hosts) =>
|
const getContainers = createSelector(
|
||||||
pools.concat(hosts)
|
getPools,
|
||||||
|
getHosts,
|
||||||
|
(pools, hosts) => pools.concat(hosts)
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -462,7 +469,12 @@ export const SelectVmSnapshot = makeStoreSelect(
|
|||||||
.groupBy('$snapshot_of')
|
.groupBy('$snapshot_of')
|
||||||
|
|
||||||
const getVms = createGetObjectsOfType('VM')
|
const getVms = createGetObjectsOfType('VM')
|
||||||
.pick(createSelector(getSnapshotsByVms, keys))
|
.pick(
|
||||||
|
createSelector(
|
||||||
|
getSnapshotsByVms,
|
||||||
|
keys
|
||||||
|
)
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -484,8 +496,10 @@ export const SelectHostVm = makeStoreSelect(
|
|||||||
.filter(getPredicate)
|
.filter(getPredicate)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getObjects = createSelector(getHosts, getVms, (hosts, vms) =>
|
const getObjects = createSelector(
|
||||||
hosts.concat(vms)
|
getHosts,
|
||||||
|
getVms,
|
||||||
|
(hosts, vms) => hosts.concat(vms)
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -505,8 +519,9 @@ export const SelectVmTemplate = makeStoreSelect(
|
|||||||
.groupBy('$container')
|
.groupBy('$container')
|
||||||
const getPools = createGetObjectsOfType('pool')
|
const getPools = createGetObjectsOfType('pool')
|
||||||
.pick(
|
.pick(
|
||||||
createSelector(getVmTemplatesByPool, vmTemplatesByPool =>
|
createSelector(
|
||||||
keys(vmTemplatesByPool)
|
getVmTemplatesByPool,
|
||||||
|
vmTemplatesByPool => keys(vmTemplatesByPool)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.sort()
|
.sort()
|
||||||
@ -529,8 +544,9 @@ export const SelectNetwork = makeStoreSelect(
|
|||||||
.groupBy('$pool')
|
.groupBy('$pool')
|
||||||
const getPools = createGetObjectsOfType('pool')
|
const getPools = createGetObjectsOfType('pool')
|
||||||
.pick(
|
.pick(
|
||||||
createSelector(getNetworksByPool, networksByPool =>
|
createSelector(
|
||||||
keys(networksByPool)
|
getNetworksByPool,
|
||||||
|
networksByPool => keys(networksByPool)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.sort()
|
.sort()
|
||||||
@ -553,7 +569,10 @@ export const SelectPif = makeStoreSelect(
|
|||||||
.groupBy('$host')
|
.groupBy('$host')
|
||||||
const getHosts = createGetObjectsOfType('host')
|
const getHosts = createGetObjectsOfType('host')
|
||||||
.pick(
|
.pick(
|
||||||
createSelector(getPifsByHost, networksByPool => keys(networksByPool))
|
createSelector(
|
||||||
|
getPifsByHost,
|
||||||
|
networksByPool => keys(networksByPool)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
@ -616,7 +635,10 @@ export const SelectVdi = makeStoreSelect(
|
|||||||
)
|
)
|
||||||
const getVdis = createGetObjectsOfType('VDI')
|
const getVdis = createGetObjectsOfType('VDI')
|
||||||
.filter(
|
.filter(
|
||||||
createSelector(getSrs, getPredicate, (srs, predicate) =>
|
createSelector(
|
||||||
|
getSrs,
|
||||||
|
getPredicate,
|
||||||
|
(srs, predicate) =>
|
||||||
predicate
|
predicate
|
||||||
? vdi => srs[vdi.$SR] && predicate(vdi)
|
? vdi => srs[vdi.$SR] && predicate(vdi)
|
||||||
: vdi => srs[vdi.$SR]
|
: vdi => srs[vdi.$SR]
|
||||||
@ -661,7 +683,12 @@ export const SelectVgpuType = makeStoreSelect(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const getGpuGroups = createGetObjectsOfType('gpuGroup')
|
const getGpuGroups = createGetObjectsOfType('gpuGroup')
|
||||||
.pick(createSelector(getVgpuTypes, keys))
|
.pick(
|
||||||
|
createSelector(
|
||||||
|
getVgpuTypes,
|
||||||
|
keys
|
||||||
|
)
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -867,8 +894,13 @@ export class SelectResourceSetsVdi extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
_getVdis = createSelector(this._getSrs, srs =>
|
_getVdis = createSelector(
|
||||||
sortBy(map(flatten(map(srs, sr => sr.VDIs)), this._getObject), 'name_label')
|
this._getSrs,
|
||||||
|
srs =>
|
||||||
|
sortBy(
|
||||||
|
map(flatten(map(srs, sr => sr.VDIs)), this._getObject),
|
||||||
|
'name_label'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -30,8 +30,9 @@ export default class SmartBackupPreview extends Component {
|
|||||||
(vms, predicate) => filter(vms, predicate)
|
(vms, predicate) => filter(vms, predicate)
|
||||||
)
|
)
|
||||||
|
|
||||||
_getSampleOfMatchingVms = createSelector(this._getMatchingVms, vms =>
|
_getSampleOfMatchingVms = createSelector(
|
||||||
vms.slice(0, SAMPLE_SIZE_OF_MATCHING_VMS)
|
this._getMatchingVms,
|
||||||
|
vms => vms.slice(0, SAMPLE_SIZE_OF_MATCHING_VMS)
|
||||||
)
|
)
|
||||||
|
|
||||||
_getQueryString = createSelector(
|
_getQueryString = createSelector(
|
||||||
|
@ -67,8 +67,7 @@ export default class ChooseSrForEachVdisModal extends Component {
|
|||||||
value={mainSr}
|
value={mainSr}
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
{props.vdis != null &&
|
{props.vdis != null && mainSr != null && (
|
||||||
mainSr != null && (
|
|
||||||
<Collapsible
|
<Collapsible
|
||||||
buttonText={_('chooseSrForEachVdisModalSelectSr')}
|
buttonText={_('chooseSrForEachVdisModalSelectSr')}
|
||||||
collapsible={props.vdis.length >= 3}
|
collapsible={props.vdis.length >= 3}
|
||||||
|
@ -25,10 +25,16 @@ import { ejectCd, isSrWritable, setDefaultSr } from 'xo'
|
|||||||
return {
|
return {
|
||||||
pool: getPool,
|
pool: getPool,
|
||||||
poolMaster: createGetObject(
|
poolMaster: createGetObject(
|
||||||
createSelector(getPool, ({ master }) => master)
|
createSelector(
|
||||||
|
getPool,
|
||||||
|
({ master }) => master
|
||||||
|
)
|
||||||
),
|
),
|
||||||
vbds: createGetObjectsOfType('VBD').filter(
|
vbds: createGetObjectsOfType('VBD').filter(
|
||||||
createSelector(getPool, ({ id }) => vbd => vbd.$pool === id)
|
createSelector(
|
||||||
|
getPool,
|
||||||
|
({ id }) => vbd => vbd.$pool === id
|
||||||
|
)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -57,7 +63,9 @@ export default class InstallPoolPatchesModalBody extends Component {
|
|||||||
|
|
||||||
_ejectCds = () => Promise.all(this._getVmsWithCds().map(ejectCd))
|
_ejectCds = () => Promise.all(this._getVmsWithCds().map(ejectCd))
|
||||||
|
|
||||||
_getTooltip = createSelector(this._getVmsWithCds, vmIds =>
|
_getTooltip = createSelector(
|
||||||
|
this._getVmsWithCds,
|
||||||
|
vmIds =>
|
||||||
vmIds.map(vmId => (
|
vmIds.map(vmId => (
|
||||||
<p className='m-0' key={vmId}>
|
<p className='m-0' key={vmId}>
|
||||||
<Vm id={vmId} />
|
<Vm id={vmId} />
|
||||||
|
@ -34,7 +34,9 @@ import styles from './index.css'
|
|||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getVdis = createGetObjectsOfType('VDI').pick(
|
const getVdis = createGetObjectsOfType('VDI').pick(
|
||||||
createSelector(getVbds, vbds =>
|
createSelector(
|
||||||
|
getVbds,
|
||||||
|
vbds =>
|
||||||
mapPlus(vbds, (vbd, push) => {
|
mapPlus(vbds, (vbd, push) => {
|
||||||
if (!vbd.is_cd_drive && vbd.VDI) {
|
if (!vbd.is_cd_drive && vbd.VDI) {
|
||||||
push(vbd.VDI)
|
push(vbd.VDI)
|
||||||
@ -44,7 +46,12 @@ import styles from './index.css'
|
|||||||
)
|
)
|
||||||
|
|
||||||
const getVifs = createGetObjectsOfType('VIF')
|
const getVifs = createGetObjectsOfType('VIF')
|
||||||
.pick(createSelector(getVm, vm => vm.VIFs))
|
.pick(
|
||||||
|
createSelector(
|
||||||
|
getVm,
|
||||||
|
vm => vm.VIFs
|
||||||
|
)
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getPifs = createGetObjectsOfType('PIF')
|
const getPifs = createGetObjectsOfType('PIF')
|
||||||
@ -235,8 +242,7 @@ export default class MigrateVmModalBody extends BaseComponent {
|
|||||||
</Col>
|
</Col>
|
||||||
</SingleLineRow>
|
</SingleLineRow>
|
||||||
</div>
|
</div>
|
||||||
{host &&
|
{host && !doNotMigrateVdis && (
|
||||||
!doNotMigrateVdis && (
|
|
||||||
<div className={styles.groupBlock}>
|
<div className={styles.groupBlock}>
|
||||||
<SingleLineRow>
|
<SingleLineRow>
|
||||||
<Col size={12}>
|
<Col size={12}>
|
||||||
|
@ -41,11 +41,21 @@ const LINE_STYLE = { paddingBottom: '1em' }
|
|||||||
const getVms = createGetObjectsOfType('VM').pick((_, props) => props.vms)
|
const getVms = createGetObjectsOfType('VM').pick((_, props) => props.vms)
|
||||||
|
|
||||||
const getVbdsByVm = createGetObjectsOfType('VBD')
|
const getVbdsByVm = createGetObjectsOfType('VBD')
|
||||||
.pick(createSelector(getVms, vms => flatten(map(vms, vm => vm.$VBDs))))
|
.pick(
|
||||||
|
createSelector(
|
||||||
|
getVms,
|
||||||
|
vms => flatten(map(vms, vm => vm.$VBDs))
|
||||||
|
)
|
||||||
|
)
|
||||||
.groupBy('VM')
|
.groupBy('VM')
|
||||||
|
|
||||||
const getVifsByVM = createGetObjectsOfType('VIF')
|
const getVifsByVM = createGetObjectsOfType('VIF')
|
||||||
.pick(createSelector(getVms, vms => flatten(map(vms, vm => vm.VIFs))))
|
.pick(
|
||||||
|
createSelector(
|
||||||
|
getVms,
|
||||||
|
vms => flatten(map(vms, vm => vm.VIFs))
|
||||||
|
)
|
||||||
|
)
|
||||||
.groupBy('$VM')
|
.groupBy('$VM')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -146,7 +146,9 @@ class DefaultCard extends Component {
|
|||||||
_getHostMetrics = createGetHostMetrics(this._getHosts)
|
_getHostMetrics = createGetHostMetrics(this._getHosts)
|
||||||
|
|
||||||
_getVmMetrics = createCollectionWrapper(
|
_getVmMetrics = createCollectionWrapper(
|
||||||
createSelector(this._getVms, vms => {
|
createSelector(
|
||||||
|
this._getVms,
|
||||||
|
vms => {
|
||||||
const metrics = {
|
const metrics = {
|
||||||
vcpus: 0,
|
vcpus: 0,
|
||||||
running: 0,
|
running: 0,
|
||||||
@ -162,11 +164,14 @@ class DefaultCard extends Component {
|
|||||||
} else metrics.other++
|
} else metrics.other++
|
||||||
})
|
})
|
||||||
return metrics
|
return metrics
|
||||||
})
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
_getSrMetrics = createCollectionWrapper(
|
_getSrMetrics = createCollectionWrapper(
|
||||||
createSelector(this._getSrs, srs => {
|
createSelector(
|
||||||
|
this._getSrs,
|
||||||
|
srs => {
|
||||||
const metrics = {
|
const metrics = {
|
||||||
srTotal: 0,
|
srTotal: 0,
|
||||||
srUsage: 0,
|
srUsage: 0,
|
||||||
@ -176,7 +181,8 @@ class DefaultCard extends Component {
|
|||||||
metrics.srTotal += sr.size
|
metrics.srTotal += sr.size
|
||||||
})
|
})
|
||||||
return metrics
|
return metrics
|
||||||
})
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
_getTopSrs = createTop(this._getSrs, [sr => sr.physical_usage / sr.size], 5)
|
_getTopSrs = createTop(this._getSrs, [sr => sr.physical_usage / sr.size], 5)
|
||||||
|
@ -28,11 +28,14 @@ import styles from './index.css'
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getMissingPatches = createSelector(getPoolHosts, hosts => {
|
const getMissingPatches = createSelector(
|
||||||
|
getPoolHosts,
|
||||||
|
hosts => {
|
||||||
return Promise.all(map(hosts, host => getHostMissingPatches(host))).then(
|
return Promise.all(map(hosts, host => getHostMissingPatches(host))).then(
|
||||||
patches => uniq(map(flatten(patches), 'name'))
|
patches => uniq(map(flatten(patches), 'name'))
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const getHostMetrics = createGetHostMetrics(getPoolHosts)
|
const getHostMetrics = createGetHostMetrics(getPoolHosts)
|
||||||
|
|
||||||
|
@ -38,7 +38,10 @@ import styles from './index.css'
|
|||||||
(_, props) => props.item,
|
(_, props) => props.item,
|
||||||
(pool, sr) => pool && pool.default_SR === sr.id
|
(pool, sr) => pool && pool.default_SR === sr.id
|
||||||
),
|
),
|
||||||
isShared: createSelector((_, props) => props.item, isSrShared),
|
isShared: createSelector(
|
||||||
|
(_, props) => props.item,
|
||||||
|
isSrShared
|
||||||
|
),
|
||||||
status: createSelector(
|
status: createSelector(
|
||||||
createGetObjectsOfType('PBD').filter((_, props) => pbd =>
|
createGetObjectsOfType('PBD').filter((_, props) => pbd =>
|
||||||
pbd.SR === props.item.id
|
pbd.SR === props.item.id
|
||||||
|
@ -50,11 +50,17 @@ const isRunning = host => host && host.power_state === 'Running'
|
|||||||
const getPool = createGetObject((state, props) => getHost(state, props).$pool)
|
const getPool = createGetObject((state, props) => getHost(state, props).$pool)
|
||||||
|
|
||||||
const getVmController = createGetObjectsOfType('VM-controller').find(
|
const getVmController = createGetObjectsOfType('VM-controller').find(
|
||||||
createSelector(getHost, ({ id }) => obj => obj.$container === id)
|
createSelector(
|
||||||
|
getHost,
|
||||||
|
({ id }) => obj => obj.$container === id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getHostVms = createGetObjectsOfType('VM').filter(
|
const getHostVms = createGetObjectsOfType('VM').filter(
|
||||||
createSelector(getHost, ({ id }) => obj => obj.$container === id)
|
createSelector(
|
||||||
|
getHost,
|
||||||
|
({ id }) => obj => obj.$container === id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getNumberOfVms = getHostVms.count()
|
const getNumberOfVms = getHostVms.count()
|
||||||
@ -71,25 +77,35 @@ const isRunning = host => host && host.power_state === 'Running'
|
|||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getPifs = createGetObjectsOfType('PIF')
|
const getPifs = createGetObjectsOfType('PIF')
|
||||||
.pick(createSelector(getHost, host => host.$PIFs))
|
.pick(
|
||||||
|
createSelector(
|
||||||
|
getHost,
|
||||||
|
host => host.$PIFs
|
||||||
|
)
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getNetworks = createGetObjectsOfType('network').pick(
|
const getNetworks = createGetObjectsOfType('network').pick(
|
||||||
createSelector(getPifs, pifs => map(pifs, pif => pif.$network))
|
createSelector(
|
||||||
|
getPifs,
|
||||||
|
pifs => map(pifs, pif => pif.$network)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getPrivateNetworks = createFilter(
|
const getPrivateNetworks = createFilter(
|
||||||
createGetObjectsOfType('network'),
|
createGetObjectsOfType('network'),
|
||||||
createSelector(getPool, pool => network =>
|
createSelector(
|
||||||
network.$pool === pool.id && isEmpty(network.PIFs)
|
getPool,
|
||||||
|
pool => network => network.$pool === pool.id && isEmpty(network.PIFs)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getHostPatches = createSelector(
|
const getHostPatches = createSelector(
|
||||||
createGetObjectsOfType('pool_patch'),
|
createGetObjectsOfType('pool_patch'),
|
||||||
createGetObjectsOfType('host_patch').pick(
|
createGetObjectsOfType('host_patch').pick(
|
||||||
createSelector(getHost, host =>
|
createSelector(
|
||||||
isString(host.patches[0]) ? host.patches : []
|
getHost,
|
||||||
|
host => (isString(host.patches[0]) ? host.patches : [])
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
(poolsPatches, hostsPatches) =>
|
(poolsPatches, hostsPatches) =>
|
||||||
@ -101,8 +117,9 @@ const isRunning = host => host && host.power_state === 'Running'
|
|||||||
|
|
||||||
const doesNeedRestart = createDoesHostNeedRestart(getHost)
|
const doesNeedRestart = createDoesHostNeedRestart(getHost)
|
||||||
|
|
||||||
const getMemoryUsed = createSelector(getHostVms, vms =>
|
const getMemoryUsed = createSelector(
|
||||||
sum(map(vms, vm => vm.memory.size))
|
getHostVms,
|
||||||
|
vms => sum(map(vms, vm => vm.memory.size))
|
||||||
)
|
)
|
||||||
|
|
||||||
return (state, props) => {
|
return (state, props) => {
|
||||||
|
@ -42,7 +42,10 @@ const getPackId = ({ author, name }) => `${author}\0${name}`
|
|||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getPcis = createGetObjectsOfType('PCI').pick(
|
const getPcis = createGetObjectsOfType('PCI').pick(
|
||||||
createSelector(getPgpus, pgpus => map(pgpus, 'pci'))
|
createSelector(
|
||||||
|
getPgpus,
|
||||||
|
pgpus => map(pgpus, 'pci')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -121,10 +121,16 @@ export default connectStore(() => {
|
|||||||
(_, props) => props.host.$PBDs
|
(_, props) => props.host.$PBDs
|
||||||
)
|
)
|
||||||
const srs = createGetObjectsOfType('SR').pick(
|
const srs = createGetObjectsOfType('SR').pick(
|
||||||
createSelector(pbds, pbds => map(pbds, pbd => pbd.SR))
|
createSelector(
|
||||||
|
pbds,
|
||||||
|
pbds => map(pbds, pbd => pbd.SR)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const storages = createSelector(pbds, srs, (pbds, srs) =>
|
const storages = createSelector(
|
||||||
|
pbds,
|
||||||
|
srs,
|
||||||
|
(pbds, srs) =>
|
||||||
map(pbds, pbd => {
|
map(pbds, pbd => {
|
||||||
const sr = srs[pbd.SR]
|
const sr = srs[pbd.SR]
|
||||||
const { physical_usage: usage, size } = sr
|
const { physical_usage: usage, size } = sr
|
||||||
|
@ -82,7 +82,10 @@ export default class Menu extends Component {
|
|||||||
isEmpty
|
isEmpty
|
||||||
)
|
)
|
||||||
|
|
||||||
_getNoResourceSets = createSelector(() => this.props.resourceSets, isEmpty)
|
_getNoResourceSets = createSelector(
|
||||||
|
() => this.props.resourceSets,
|
||||||
|
isEmpty
|
||||||
|
)
|
||||||
|
|
||||||
get height() {
|
get height() {
|
||||||
return this.refs.content.offsetHeight
|
return this.refs.content.offsetHeight
|
||||||
|
@ -44,20 +44,36 @@ import TabPatches from './tab-patches'
|
|||||||
|
|
||||||
const getNetworks = createGetObjectsOfType('network')
|
const getNetworks = createGetObjectsOfType('network')
|
||||||
.filter(
|
.filter(
|
||||||
createSelector(getPool, ({ id }) => network => network.$pool === id)
|
createSelector(
|
||||||
|
getPool,
|
||||||
|
({ id }) => network => network.$pool === id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getHosts = createGetObjectsOfType('host')
|
const getHosts = createGetObjectsOfType('host')
|
||||||
.filter(createSelector(getPool, ({ id }) => obj => obj.$pool === id))
|
.filter(
|
||||||
|
createSelector(
|
||||||
|
getPool,
|
||||||
|
({ id }) => obj => obj.$pool === id
|
||||||
|
)
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getPoolSrs = createGetObjectsOfType('SR')
|
const getPoolSrs = createGetObjectsOfType('SR')
|
||||||
.filter(createSelector(getPool, ({ id }) => sr => sr.$pool === id))
|
.filter(
|
||||||
|
createSelector(
|
||||||
|
getPool,
|
||||||
|
({ id }) => sr => sr.$pool === id
|
||||||
|
)
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
const getNumberOfVms = createGetObjectsOfType('VM').count(
|
const getNumberOfVms = createGetObjectsOfType('VM').count(
|
||||||
createSelector(getPool, ({ id }) => obj => obj.$pool === id)
|
createSelector(
|
||||||
|
getPool,
|
||||||
|
({ id }) => obj => obj.$pool === id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getLogs = createGetObjectMessages(getPool)
|
const getLogs = createGetObjectMessages(getPool)
|
||||||
|
@ -171,7 +171,12 @@ class ToggleDefaultLockingMode extends Component {
|
|||||||
|
|
||||||
@connectStore(() => {
|
@connectStore(() => {
|
||||||
const pif = createGetObject()
|
const pif = createGetObject()
|
||||||
const host = createGetObject(createSelector(pif, pif => pif.$host))
|
const host = createGetObject(
|
||||||
|
createSelector(
|
||||||
|
pif,
|
||||||
|
pif => pif.$host
|
||||||
|
)
|
||||||
|
)
|
||||||
const disableUnplug = createSelector(
|
const disableUnplug = createSelector(
|
||||||
pif,
|
pif,
|
||||||
pif =>
|
pif =>
|
||||||
|
@ -47,11 +47,17 @@ import TabXosan from './tab-xosan'
|
|||||||
)
|
)
|
||||||
|
|
||||||
const getPbds = createGetObjectsOfType('PBD').pick(
|
const getPbds = createGetObjectsOfType('PBD').pick(
|
||||||
createSelector(getSr, sr => sr.$PBDs)
|
createSelector(
|
||||||
|
getSr,
|
||||||
|
sr => sr.$PBDs
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const getSrHosts = createGetObjectsOfType('host').pick(
|
const getSrHosts = createGetObjectsOfType('host').pick(
|
||||||
createSelector(getPbds, pbds => map(pbds, pbd => pbd.host))
|
createSelector(
|
||||||
|
getPbds,
|
||||||
|
pbds => map(pbds, pbd => pbd.host)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
@ -69,7 +75,12 @@ import TabXosan from './tab-xosan'
|
|||||||
.pick(getVdiIds)
|
.pick(getVdiIds)
|
||||||
.sort()
|
.sort()
|
||||||
const getUnmanagedVdis = createGetObjectsOfType('VDI-unmanaged')
|
const getUnmanagedVdis = createGetObjectsOfType('VDI-unmanaged')
|
||||||
.pick(createSelector(getSr, sr => sr.VDIs))
|
.pick(
|
||||||
|
createSelector(
|
||||||
|
getSr,
|
||||||
|
sr => sr.VDIs
|
||||||
|
)
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
|
@ -41,7 +41,10 @@ const UnhealthyVdiChains = flowRight(
|
|||||||
})),
|
})),
|
||||||
connectStore(() => ({
|
connectStore(() => ({
|
||||||
vdis: createGetObjectsOfType('VDI').pick(
|
vdis: createGetObjectsOfType('VDI').pick(
|
||||||
createSelector((_, props) => props.chains, keys)
|
createSelector(
|
||||||
|
(_, props) => props.chains,
|
||||||
|
keys
|
||||||
|
)
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
)(({ chains, vdis }) =>
|
)(({ chains, vdis }) =>
|
||||||
|
@ -79,7 +79,10 @@ const COLUMNS = [
|
|||||||
const getVbds = createGetObjectsOfType('VBD')
|
const getVbds = createGetObjectsOfType('VBD')
|
||||||
.pick((_, props) => props.item.$VBDs)
|
.pick((_, props) => props.item.$VBDs)
|
||||||
.sort()
|
.sort()
|
||||||
const getVmIds = createSelector(getVbds, vbds => map(vbds, 'VM'))
|
const getVmIds = createSelector(
|
||||||
|
getVbds,
|
||||||
|
vbds => map(vbds, 'VM')
|
||||||
|
)
|
||||||
const getVms = createGetObjectsOfType('VM').pick(getVmIds)
|
const getVms = createGetObjectsOfType('VM').pick(getVmIds)
|
||||||
const getVmControllers = createGetObjectsOfType('VM-controller').pick(
|
const getVmControllers = createGetObjectsOfType('VM-controller').pick(
|
||||||
getVmIds
|
getVmIds
|
||||||
|
@ -171,7 +171,10 @@ const GROUPED_ACTIONS = [
|
|||||||
const getPendingTasksByPool = getPendingTasks.sort().groupBy('$pool')
|
const getPendingTasksByPool = getPendingTasks.sort().groupBy('$pool')
|
||||||
|
|
||||||
const getPools = createGetObjectsOfType('pool').pick(
|
const getPools = createGetObjectsOfType('pool').pick(
|
||||||
createSelector(getPendingTasksByPool, keys)
|
createSelector(
|
||||||
|
getPendingTasksByPool,
|
||||||
|
keys
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -202,7 +205,10 @@ export default class Tasks extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getTasks = createSelector(
|
_getTasks = createSelector(
|
||||||
createSelector(() => this.state.pools, resolveIds),
|
createSelector(
|
||||||
|
() => this.state.pools,
|
||||||
|
resolveIds
|
||||||
|
),
|
||||||
() => this.props.pendingTasksByPool,
|
() => this.props.pendingTasksByPool,
|
||||||
(poolIds, pendingTasksByPool) =>
|
(poolIds, pendingTasksByPool) =>
|
||||||
isEmpty(poolIds)
|
isEmpty(poolIds)
|
||||||
@ -213,7 +219,10 @@ export default class Tasks extends Component {
|
|||||||
_getFinishedTasks = createFilter(
|
_getFinishedTasks = createFilter(
|
||||||
() => this.state.finishedTasks,
|
() => this.state.finishedTasks,
|
||||||
createSelector(
|
createSelector(
|
||||||
createSelector(() => this.state.pools, resolveIds),
|
createSelector(
|
||||||
|
() => this.state.pools,
|
||||||
|
resolveIds
|
||||||
|
),
|
||||||
poolIds =>
|
poolIds =>
|
||||||
isEmpty(poolIds) ? null : ({ $poolId }) => poolIds.includes($poolId)
|
isEmpty(poolIds) ? null : ({ $poolId }) => poolIds.includes($poolId)
|
||||||
)
|
)
|
||||||
|
@ -40,7 +40,10 @@ export default connectStore(() => {
|
|||||||
const getAttachedVgpu = createFinder(getVgpus, vgpu => vgpu.currentlyAttached)
|
const getAttachedVgpu = createFinder(getVgpus, vgpu => vgpu.currentlyAttached)
|
||||||
|
|
||||||
const getVgpuTypes = createGetObjectsOfType('vgpuType').pick(
|
const getVgpuTypes = createGetObjectsOfType('vgpuType').pick(
|
||||||
createSelector(getVgpus, vgpus => map(vgpus, 'vgpuType'))
|
createSelector(
|
||||||
|
getVgpus,
|
||||||
|
vgpus => map(vgpus, 'vgpuType')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -498,8 +498,9 @@ class NewVif extends BaseComponent {
|
|||||||
const getVifs = createGetObjectsOfType('VIF').pick(
|
const getVifs = createGetObjectsOfType('VIF').pick(
|
||||||
(_, props) => props.vm.VIFs
|
(_, props) => props.vm.VIFs
|
||||||
)
|
)
|
||||||
const getNetworksId = createSelector(getVifs, vifs =>
|
const getNetworksId = createSelector(
|
||||||
map(vifs, vif => vif.$network)
|
getVifs,
|
||||||
|
vifs => map(vifs, vif => vif.$network)
|
||||||
)
|
)
|
||||||
const getNetworks = createGetObjectsOfType('network').pick(getNetworksId)
|
const getNetworks = createGetObjectsOfType('network').pick(getNetworksId)
|
||||||
|
|
||||||
|
@ -270,8 +270,9 @@ const XOSAN_INDIVIDUAL_ACTIONS = [
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const getPoolPredicate = createSelector(getXosanSrs, srs => pool =>
|
const getPoolPredicate = createSelector(
|
||||||
every(srs, sr => sr.$pool !== pool.id)
|
getXosanSrs,
|
||||||
|
srs => pool => every(srs, sr => sr.$pool !== pool.id)
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user