feat(xo-web/render-xo-item): add pool name to templates (#3896)

Fixes #3894
This commit is contained in:
Rajaa.BARHTAOUI 2019-01-23 14:58:05 +01:00 committed by Pierre Donias
parent 6545e47193
commit b246e84c48
2 changed files with 12 additions and 1 deletions

View File

@ -8,6 +8,7 @@
- [Plugins] New field to filter displayed plugins (PR [#3832](https://github.com/vatesfr/xen-orchestra/pull/3871)) - [Plugins] New field to filter displayed plugins (PR [#3832](https://github.com/vatesfr/xen-orchestra/pull/3871))
- Ability to copy ID of "unknown item"s [#3833](https://github.com/vatesfr/xen-orchestra/issues/3833) (PR [#3856](https://github.com/vatesfr/xen-orchestra/pull/3856)) - Ability to copy ID of "unknown item"s [#3833](https://github.com/vatesfr/xen-orchestra/issues/3833) (PR [#3856](https://github.com/vatesfr/xen-orchestra/pull/3856))
- [Cloud-Init] switch config drive type to `nocloud` to prepare for the passing of network config (PR [#3877](https://github.com/vatesfr/xen-orchestra/pull/3877)) - [Cloud-Init] switch config drive type to `nocloud` to prepare for the passing of network config (PR [#3877](https://github.com/vatesfr/xen-orchestra/pull/3877))
- [UI] Show pool name next to templates' names [#3894](https://github.com/vatesfr/xen-orchestra/issues/3894) (PR [#3896](https://github.com/vatesfr/xen-orchestra/pull/3896))
### Bug fixes ### Bug fixes

View File

@ -170,12 +170,19 @@ Vm.defaultProps = {
export const VmTemplate = decorate([ export const VmTemplate = decorate([
connectStore(() => { connectStore(() => {
const getObject = createGetObject() const getObject = createGetObject()
const getPool = createGetObject(
createSelector(
getObject,
vm => get(() => vm.$pool)
)
)
return (state, props) => ({ return (state, props) => ({
// FIXME: props.self ugly workaround to get object as a self user // FIXME: props.self ugly workaround to get object as a self user
template: getObject(state, props, props.self), template: getObject(state, props, props.self),
pool: getPool(state, props),
}) })
}), }),
({ id, template }) => { ({ id, template, pool }) => {
if (template === undefined) { if (template === undefined) {
return unknowItem(id, 'template') return unknowItem(id, 'template')
} }
@ -183,6 +190,9 @@ export const VmTemplate = decorate([
return ( return (
<span> <span>
<Icon icon='vm' /> {template.name_label} <Icon icon='vm' /> {template.name_label}
{pool !== undefined && (
<span className='text-muted'>{` - ${pool.name_label}`}</span>
)}
</span> </span>
) )
}, },