feat(xo-web/render-xo-item): contextualize VDI (#3285)

See #3021
This commit is contained in:
Rajaa.BARHTAOUI 2018-12-03 15:27:58 +01:00 committed by Pierre Donias
parent 8cd66af3f8
commit 8a760823b8
2 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,7 @@
### Enhancements
- [Users] Display user groups [#3719](https://github.com/vatesfr/xen-orchestra/issues/3719) (PR [#3740](https://github.com/vatesfr/xen-orchestra/pull/3740))
- [VDI] Display VDI's SR [3021](https://github.com/vatesfr/xen-orchestra/issues/3021) (PR [#3285](https://github.com/vatesfr/xen-orchestra/pull/3285))
### Bug fixes

View File

@ -229,12 +229,17 @@ Sr.defaultProps = {
export const Vdi = decorate([
connectStore(() => {
const getObject = createGetObject()
const getSr = createGetObject((state, props) => {
const vdi = getObject(state, props, props.self)
return vdi && vdi.$SR
})
// FIXME: props.self ugly workaround to get object as a self user
return (state, props) => ({
vdi: getObject(state, props, props.self),
sr: getSr(state, props),
})
}),
({ vdi }) => {
({ sr, vdi }) => {
if (vdi === undefined) {
return UNKNOWN_ITEM
}
@ -242,7 +247,9 @@ export const Vdi = decorate([
return (
<span>
<Icon icon='disk' /> {vdi.name_label}
{vdi.name_description && <span> ({vdi.name_description})</span>}
{sr !== undefined && (
<span className='text-muted'> - {sr.name_label}</span>
)}
</span>
)
},