feat(xo-web/host/network): add PIF speed (#3901)

Fixes #3887
This commit is contained in:
Rajaa.BARHTAOUI
2019-01-30 10:11:39 +01:00
committed by Pierre Donias
parent 93985e1a51
commit af00adcfcc
4 changed files with 10 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
- [Login] Add OTP authentication [#2044](https://github.com/vatesfr/xen-orchestra/issues/2044) (PR [#3879](https://github.com/vatesfr/xen-orchestra/pull/3879))
- [Notifications] New notification page to provide important information about XOA (PR [#3904](https://github.com/vatesfr/xen-orchestra/pull/3904))
- [VM] Ability to export a VM with zstd compression [#3773](https://github.com/vatesfr/xen-orchestra/issues/3773) (PR [#3891](https://github.com/vatesfr/xen-orchestra/pull/3891))
- [Host/network] Display PIF speed [#3887](https://github.com/vatesfr/xen-orchestra/issues/3887) (PR [#3901](https://github.com/vatesfr/xen-orchestra/pull/3901))
### Bug fixes

View File

@@ -506,6 +506,7 @@ const TRANSFORMS = {
// A physical PIF cannot be unplugged
physical: Boolean(obj.physical),
vlan: +obj.VLAN,
speed: metrics && +metrics.speed,
$host: link(obj, 'host'),
$network: link(obj, 'network'),
}

View File

@@ -811,6 +811,7 @@ const messages = {
pifModeLabel: 'Mode',
pifMacLabel: 'MAC',
pifMtuLabel: 'MTU',
pifSpeedLabel: 'Speed',
pifStatusLabel: 'Status',
pifStatusConnected: 'Connected',
pifStatusDisconnected: 'Disconnected',

View File

@@ -2,6 +2,7 @@ import _ from 'intl'
import ActionButton from 'action-button'
import Component from 'base-component'
import copy from 'copy-to-clipboard'
import humanFormat from 'human-format'
import React from 'react'
import Icon from 'icon'
import SingleLineRow from 'single-line-row'
@@ -264,6 +265,12 @@ const PIF_COLUMNS = [
name: _('pifMtuLabel'),
sortCriteria: 'mtu',
},
{
itemRenderer: ({ speed }) =>
speed !== undefined && humanFormat(speed * 1e6, { unit: 'b/s' }), // 1e6: convert Mb to b
name: _('pifSpeedLabel'),
sortCriteria: 'speed',
},
{
itemRenderer: (pif, userData) => (
<PifItemLock pif={pif} networks={userData.networks} />