feat(sr): also display unmanaged VDIs (#2131)

This commit is contained in:
Olivier Lambert
2017-05-03 17:07:03 +02:00
committed by Julien Fontanet
parent 46e95fe7eb
commit 87087d55aa
5 changed files with 26 additions and 3 deletions

View File

@@ -24,6 +24,8 @@ var messages = {
onError: 'On error', onError: 'On error',
successful: 'Successful', successful: 'Successful',
filterNoSnapshots: 'Full disks only', filterNoSnapshots: 'Full disks only',
filterOnlyBaseCopy: 'Base copy only',
filterOnlyRegularDisks: 'Regular disks only',
filterOnlySnapshots: 'Snapshots only', filterOnlySnapshots: 'Snapshots only',
// ----- Copiable component ----- // ----- Copiable component -----

View File

@@ -18,7 +18,7 @@
} }
.usage-element-highlight { .usage-element-highlight {
background-color: $brand-primary; background-color: $brand-warning;
} }
.usage-element-others { .usage-element-others {

View File

@@ -77,6 +77,12 @@ import TabXosan from './tab-xosan'
) )
).groupBy('VDI') ).groupBy('VDI')
// -----------------------------------------------------------------------------
const getVdisUnmanaged = createGetObjectsOfType('VDI-unmanaged').pick(
createSelector(getSr, sr => sr.VDIs)
).sort()
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
const getVdiSnapshots = createGetObjectsOfType('VDI-snapshot').pick( const getVdiSnapshots = createGetObjectsOfType('VDI-snapshot').pick(
@@ -136,6 +142,7 @@ import TabXosan from './tab-xosan'
pbds: getPbds(state, props), pbds: getPbds(state, props),
logs: getLogs(state, props), logs: getLogs(state, props),
vdis: getVdis(state, props), vdis: getVdis(state, props),
vdisUnmanaged: getVdisUnmanaged(state, props),
vdiSnapshots: getVdiSnapshots(state, props), vdiSnapshots: getVdiSnapshots(state, props),
vdisToVmIds: getVdisToVmIds(state, props), vdisToVmIds: getVdisToVmIds(state, props),
sr sr
@@ -216,6 +223,7 @@ export default class Sr extends Component {
'pbds', 'pbds',
'sr', 'sr',
'vdis', 'vdis',
'vdisUnmanaged',
'vdiSnapshots', 'vdiSnapshots',
'vdisToVmIds' 'vdisToVmIds'
])) ]))

View File

@@ -76,17 +76,19 @@ const COLUMNS = [
const FILTERS = { const FILTERS = {
filterNoSnapshots: 'type:!VDI-snapshot', filterNoSnapshots: 'type:!VDI-snapshot',
filterOnlyBaseCopy: 'type:VDI-unmanaged',
filterOnlyRegularDisks: 'type:!VDI-unmanaged type:!VDI-snapshot',
filterOnlySnapshots: 'type:VDI-snapshot' filterOnlySnapshots: 'type:VDI-snapshot'
} }
// =================================================================== // ===================================================================
export default ({ vdis, vdiSnapshots, vdisToVmIds }) => ( export default ({ vdis, vdisUnmanaged, vdiSnapshots, vdisToVmIds }) => (
<Container> <Container>
<Row> <Row>
<Col> <Col>
{!isEmpty(vdis) {!isEmpty(vdis)
? <SortedTable collection={vdis.concat(vdiSnapshots)} userData={vdisToVmIds} columns={COLUMNS} filters={FILTERS} /> ? <SortedTable collection={vdis.concat(vdiSnapshots, vdisUnmanaged)} userData={vdisToVmIds} columns={COLUMNS} filters={FILTERS} />
: <h4 className='text-xs-center'>{_('srNoVdis')}</h4> : <h4 className='text-xs-center'>{_('srNoVdis')}</h4>
} }
</Col> </Col>

View File

@@ -12,6 +12,7 @@ import Usage, { UsageElement } from 'usage'
export default ({ export default ({
sr, sr,
vdis, vdis,
vdisUnmanaged,
vdisToVmIds vdisToVmIds
}) => <Container> }) => <Container>
<Row className='text-xs-center'> <Row className='text-xs-center'>
@@ -34,6 +35,16 @@ export default ({
<Row> <Row>
<Col smallOffset={1} mediumSize={10}> <Col smallOffset={1} mediumSize={10}>
<Usage total={sr.size}> <Usage total={sr.size}>
{map(vdisUnmanaged, vdi => <UsageElement
highlight
key={vdi.id}
tooltip={<span>
{vdi.name_label}
<br />
{vdisToVmIds[vdi.id] && renderXoItemFromId(vdisToVmIds[vdi.id])}
</span>}
value={vdi.usage}
/>)}
{map(vdis, vdi => <UsageElement {map(vdis, vdi => <UsageElement
key={vdi.id} key={vdi.id}
tooltip={<span> tooltip={<span>