feat(host/pool): clearer memory info (#2771)

Fixes #2750
This commit is contained in:
Olivier Lambert 2018-03-16 14:19:59 +01:00 committed by Julien Fontanet
parent ca1a46f980
commit 16e7257e3b
3 changed files with 37 additions and 19 deletions

View File

@ -538,7 +538,7 @@ const messages = {
srNoVdis: 'No VDIs in this storage', srNoVdis: 'No VDIs in this storage',
// ----- Pool general ----- // ----- Pool general -----
poolTitleRamUsage: 'Pool RAM usage:', poolTitleRamUsage: 'Pool RAM usage:',
poolRamUsage: '{used} used on {total}', poolRamUsage: '{used} used on {total} ({free} free)',
poolMaster: 'Master:', poolMaster: 'Master:',
displayAllHosts: 'Display all hosts of this pool', displayAllHosts: 'Display all hosts of this pool',
displayAllStorages: 'Display all storages of this pool', displayAllStorages: 'Display all storages of this pool',
@ -609,7 +609,9 @@ const messages = {
// ----- host stat tab ----- // ----- host stat tab -----
statLoad: 'Load average', statLoad: 'Load average',
// ----- host advanced tab ----- // ----- host advanced tab -----
memoryHostState: 'RAM Usage: {memoryUsed}', hostTitleRamUsage: 'Host RAM usage:',
memoryHostState:
'RAM: {memoryUsed} used on {memoryTotal} ({memoryFree} free)',
hardwareHostSettingsLabel: 'Hardware', hardwareHostSettingsLabel: 'Hardware',
hostAddress: 'Address', hostAddress: 'Address',
hostStatus: 'Status', hostStatus: 'Status',

View File

@ -10,7 +10,7 @@ import { addTag, removeTag } from 'xo'
import { BlockLink } from 'link' import { BlockLink } from 'link'
import { Container, Row, Col } from 'grid' import { Container, Row, Col } from 'grid'
import { FormattedRelative } from 'react-intl' import { FormattedRelative } from 'react-intl'
import { formatSize } from 'utils' import { formatSize, formatSizeShort } from 'utils'
import Usage, { UsageElement } from 'usage' import Usage, { UsageElement } from 'usage'
import { getObject } from 'selectors' import { getObject } from 'selectors'
import { import {
@ -113,9 +113,7 @@ export default ({
<br /> <br />
<Row> <Row>
<Col className='text-xs-center'> <Col className='text-xs-center'>
<h5> <h5>{_('hostTitleRamUsage')}</h5>
{_('memoryHostState', { memoryUsed: formatSize(memoryUsed) })}
</h5>
</Col> </Col>
</Row> </Row>
<Row> <Row>
@ -137,16 +135,31 @@ export default ({
</Usage> </Usage>
</Col> </Col>
</Row> </Row>
{pool && <Row>
host.id === pool.master && ( <Col className='text-xs-center'>
<Row className='text-xs-center'> <h5>
<Col> {_('memoryHostState', {
<h3> memoryUsed: formatSizeShort(memoryUsed),
<span className='tag tag-pill tag-info'>{_('pillMaster')}</span> memoryTotal: formatSizeShort(host.memory.size),
</h3> memoryFree: formatSizeShort(host.memory.size - host.memory.usage),
</Col> })}
</Row> </h5>
)} </Col>
</Row>
<Row>
{pool &&
host.id === pool.master && (
<Row className='text-xs-center'>
<Col>
<h3>
<span className='tag tag-pill tag-info'>
{_('pillMaster')}
</span>
</h3>
</Col>
</Row>
)}
</Row>
<Row> <Row>
<Col> <Col>
<h2 className='text-xs-center'> <h2 className='text-xs-center'>

View File

@ -9,7 +9,7 @@ import { addTag, removeTag } from 'xo'
import Link, { BlockLink } from 'link' import Link, { BlockLink } from 'link'
import { Container, Row, Col } from 'grid' import { Container, Row, Col } from 'grid'
import Usage, { UsageElement } from 'usage' import Usage, { UsageElement } from 'usage'
import { formatSize } from 'utils' import { formatSize, formatSizeShort } from 'utils'
import Tooltip from 'tooltip' import Tooltip from 'tooltip'
export default ({ hosts, nVms, pool, srs }) => ( export default ({ hosts, nVms, pool, srs }) => (
@ -68,8 +68,11 @@ export default ({ hosts, nVms, pool, srs }) => (
<Col className='text-xs-center'> <Col className='text-xs-center'>
<h5> <h5>
{_('poolRamUsage', { {_('poolRamUsage', {
used: formatSize(sumBy(hosts, 'memory.usage')), used: formatSizeShort(sumBy(hosts, 'memory.usage')),
total: formatSize(sumBy(hosts, 'memory.size')), total: formatSizeShort(sumBy(hosts, 'memory.size')),
free: formatSizeShort(
sumBy(hosts, host => host.memory.size - host.memory.usage)
),
})} })}
</h5> </h5>
</Col> </Col>