feat(xo-web/health/Orphan VDIs): display SR container (#3747)
See #3021
This commit is contained in:
parent
8a760823b8
commit
6f6f463592
@ -8,6 +8,7 @@
|
||||
|
||||
- [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))
|
||||
- [Health/Orphaned VDIs] Display SR's container [#3021](https://github.com/vatesfr/xen-orchestra/issues/3021) (PR [#3747](https://github.com/vatesfr/xen-orchestra/pull/3747))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
@ -192,7 +192,7 @@ export const Sr = decorate([
|
||||
container: getContainer(state, props),
|
||||
})
|
||||
}),
|
||||
({ sr, container, link, newTab }) => {
|
||||
({ sr, container, link, newTab, spaceLeft }) => {
|
||||
if (sr === undefined) {
|
||||
return UNKNOWN_ITEM
|
||||
}
|
||||
@ -203,7 +203,7 @@ export const Sr = decorate([
|
||||
{container !== undefined && (
|
||||
<span className='text-muted'> - {container.name_label}</span>
|
||||
)}
|
||||
{isSrWritable(sr) && (
|
||||
{spaceLeft && isSrWritable(sr) && (
|
||||
<span>{` (${formatSize(sr.size - sr.physical_usage)} free)`}</span>
|
||||
)}
|
||||
</LinkWrapper>
|
||||
@ -216,12 +216,14 @@ Sr.propTypes = {
|
||||
link: PropTypes.bool,
|
||||
newTab: PropTypes.bool,
|
||||
self: PropTypes.bool,
|
||||
spaceLeft: PropTypes.bool,
|
||||
}
|
||||
|
||||
Sr.defaultProps = {
|
||||
link: false,
|
||||
newTab: false,
|
||||
self: false,
|
||||
spaceLeft: true,
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
@ -10,6 +10,7 @@ import SortedTable from 'sorted-table'
|
||||
import Tooltip from 'tooltip'
|
||||
import Upgrade from 'xoa-upgrade'
|
||||
import xml2js from 'xml2js'
|
||||
import { Sr } from 'render-xo-item'
|
||||
import { SelectPool } from 'select-objects'
|
||||
import { Container, Row, Col } from 'grid'
|
||||
import { Card, CardHeader, CardBlock } from 'card'
|
||||
@ -42,10 +43,6 @@ const SrColContainer = connectStore(() => ({
|
||||
<Link to={`${container.type}s/${container.id}`}>{container.name_label}</Link>
|
||||
))
|
||||
|
||||
const VdiColSr = connectStore(() => ({
|
||||
sr: createGetObject(),
|
||||
}))(({ sr }) => <Link to={`srs/${sr.id}`}>{sr.name_label}</Link>)
|
||||
|
||||
const VmColContainer = connectStore(() => ({
|
||||
container: createGetObject(),
|
||||
}))(({ container }) => <span>{container.name_label}</span>)
|
||||
@ -160,7 +157,7 @@ const ORPHANED_VDI_COLUMNS = [
|
||||
},
|
||||
{
|
||||
name: _('vdiSr'),
|
||||
itemRenderer: vdi => <VdiColSr id={vdi.$SR} />,
|
||||
itemRenderer: vdi => <Sr id={vdi.$SR} link spaceLeft={false} />,
|
||||
},
|
||||
]
|
||||
|
||||
@ -392,7 +389,10 @@ const ALARM_ACTIONS = [
|
||||
.sort()
|
||||
const getUserSrs = createGetObjectsOfType('SR').filter([isSrWritable])
|
||||
const getVdiSrs = createGetObjectsOfType('SR').pick(
|
||||
createSelector(getOrphanVdiSnapshots, snapshots => map(snapshots, '$SR'))
|
||||
createSelector(
|
||||
getOrphanVdiSnapshots,
|
||||
snapshots => map(snapshots, '$SR')
|
||||
)
|
||||
)
|
||||
const getAlertMessages = createGetObjectsOfType('message').filter([
|
||||
message => message.name === 'ALARM',
|
||||
@ -412,13 +412,13 @@ export default class Health extends Component {
|
||||
pools: [],
|
||||
}
|
||||
|
||||
componentWillReceiveProps (props) {
|
||||
componentWillReceiveProps(props) {
|
||||
if (props.alertMessages !== this.props.alertMessages) {
|
||||
this._updateAlarms(props)
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
componentDidMount() {
|
||||
this._updateAlarms(this.props)
|
||||
}
|
||||
|
||||
@ -457,7 +457,10 @@ export default class Health extends Component {
|
||||
_getSrUrl = sr => `srs/${sr.id}`
|
||||
|
||||
_getPoolPredicate = createSelector(
|
||||
createSelector(() => this.state.pools, resolveIds),
|
||||
createSelector(
|
||||
() => this.state.pools,
|
||||
resolveIds
|
||||
),
|
||||
poolIds =>
|
||||
isEmpty(poolIds) ? undefined : item => includes(poolIds, item.$pool)
|
||||
)
|
||||
@ -481,7 +484,7 @@ export default class Health extends Component {
|
||||
|
||||
_getMessages = createFilter(() => this.state.messages, this._getPoolPredicate)
|
||||
|
||||
render () {
|
||||
render() {
|
||||
const { props, state } = this
|
||||
|
||||
const userSrs = this._getUserSrs()
|
||||
|
Loading…
Reference in New Issue
Block a user