diff --git a/src/views/components/representatives/representatives.js b/src/views/components/representatives/representatives.js
index 08d38513..f0c7d123 100644
--- a/src/views/components/representatives/representatives.js
+++ b/src/views/components/representatives/representatives.js
@@ -47,220 +47,201 @@ export default function Representatives({
const { t } = useTranslation()
const denominator = quorumTotal || totalWeight
- const columns = [
- {
- field: 'status',
- headerName: '',
- width: 20,
- renderCell: (p) => ,
- valueGetter: (p) => p.row.is_online
- },
- {
- field: 'alias',
- headerName: t('representatives.alias', 'Alias'),
- width: 200
- },
- {
- field: 'account',
- headerName: t('common.account', { count: 1, defaultValue: 'Account' }),
- renderCell: (p) => (
- {p.row.account}
- ),
- width: 160
- },
- {
- field: 'weight',
- headerName: t('common.weight', 'Weight'),
- width: 140,
- valueFormatter: (p) =>
- p.value
- ? `${BigNumber(p.value)
- .shiftedBy(-30)
- .toFormat(0)}`
- : null,
- valueGetter: (p) => p.row.account_meta.weight
- },
- {
- field: 'weight_pct',
- headerName: '%',
- width: 80,
- valueFormatter: (p) =>
- p.value
- ? `${p.value.toFixed(2)}%`
- : null,
- valueGetter: (p) =>
- p.row.account_meta.weight
- ? BigNumber(p.row.account_meta.weight)
- .dividedBy(denominator)
- .multipliedBy(100)
- : null
- },
- {
- field: 'confs_behind',
- headerName: t('common.confirmations_behind', 'Confs Behind'),
- width: 145,
- valueFormatter: (p) =>
- p.value
- ? BigNumber(p.value).toFormat()
- : null,
- valueGetter: (p) => p.row.telemetry.cemented_behind
- },
- {
- field: 'uptime',
- headerName: t('common.uptime', 'Uptime'),
- width: 150,
- renderCell: (p) => ,
- valueGetter: (p) => (p.row.last_online || 0) - (p.row.last_offline || 0)
- },
- {
- field: 'version',
- headerName: t('common.version', 'Version'),
- width: 110,
- valueGetter: (p) => p.row.version
- },
- {
- field: 'bandwidth_cap',
- headerName: t('common.bandwidth_limit_short', 'BW Limit'),
- width: 120,
- valueFormatter: (p) => {
- if (p.api.getRow(p.id).telemetry.bandwidth_cap === 0) return t('common.unlimited', 'Unlimited')
- return p.api.getRow(p.id).telemetry.bandwidth_cap
- ? bytesToSize({ bytes: p.api.getRow(p.id).telemetry.bandwidth_cap, t }).label
- : null
- },
- valueGetter: (p) => {
- if (p.row.telemetry.bandwidth_cap === 0) return Infinity
- return p.row.telemetry.bandwidth_cap
- ? bytesToSize({ bytes: p.row.telemetry.bandwidth_cap, t }).value
- : null
- }
- },
- {
- field: 'peer_count',
- headerName: t('common.peers', 'Peers'),
- width: 100,
- valueGetter: (p) => p.row.telemetry.peer_count
- },
- {
- field: 'port',
- headerName: t('common.port', 'Port'),
- valueGetter: (p) => p.row.telemetry.port
- },
- {
- field: 'blocks_behind',
- headerName: t('common.blocks_behind', 'Blocks Behind'),
- width: 145,
- valueFormatter: (p) =>
- p.value
- ? BigNumber(p.value).toFormat()
- : null,
- valueGetter: (p) => p.row.telemetry.block_behind
- },
- {
- field: 'cemented_count',
- headerName: t('common.conf_short', 'Conf.'),
- width: 140,
- valueFormatter: (p) =>
- p.value
- ? BigNumber(p.value).toFormat()
- : null,
- valueGetter: (p) => p.row.telemetry.cemented_count
- },
- {
- field: 'block_count',
- headerName: t('common.blocks', 'Blocks'),
- width: 140,
- valueFormatter: (p) =>
- p.value
- ? BigNumber(p.value).toFormat()
- : null,
- valueGetter: (p) => p.row.telemetry.block_count
- },
- {
- field: 'unchecked_count',
- headerName: t('common.unchecked_count', 'Unchecked'),
- width: 140,
- valueFormatter: (p) =>
- p.value
- ? BigNumber(p.value).toFormat()
- : null,
- valueGetter: (p) => p.row.telemetry.unchecked_count
- },
- {
- field: 'cpu_cores',
- headerName: t('representatives.cpu_cores', 'CPU Cores'),
- width: 130,
- valueGetter: (p) => p.row.representative_meta.cpu_cores
- },
- {
- field: 'cpu_model',
- hide: true,
- headerName: t('representatives.cpu_model', 'CPU Model'),
- valueGetter: (p) => p.row.representative_meta.cpu_model
- },
- {
- field: 'watt_hour',
- width: 120,
- headerName: t('representatives.tdp', 'TDP (wH)')
- },
- {
- field: 'protocol_version',
- headerName: t('representatives.protocol_version', 'Protocol'),
- width: 110,
- valueGetter: (p) => p.row.telemetry.protocol_version
- },
- {
- field: 'last_seen',
- width: 130,
- headerName: t('representatives.last_seen', 'Last Seen'),
- renderCell: (p) =>
- p.row.is_online ? (
-
- ) : (
- timeago.format(p.row.last_seen * 1000, 'nano_short')
- ),
- valueGetter: (p) => Math.floor(Date.now() / 1000) - p.row.last_seen
- },
- {
- field: 'asname',
- headerName: t('representatives.host_asn', 'Host ASN'),
- width: 130,
- valueGetter: (p) => p.row.network.asname
- },
- {
- field: 'country',
- headerName: t('common.country', 'Country'),
- width: 130,
- valueGetter: (p) => p.row.network.country
- },
- {
- field: 'address',
- headerName: t('common.address', 'Address'),
- width: 320,
- valueGetter: (p) => p.row.telemetry.address
+ const columns = [
+ {
+ field: 'status',
+ headerName: '',
+ width: 20,
+ renderCell: (p) => ,
+ valueGetter: (p) => p.row.is_online
+ },
+ {
+ field: 'alias',
+ headerName: t('representatives.alias', 'Alias'),
+ width: 200
+ },
+ {
+ field: 'account',
+ headerName: t('common.account', { count: 1, defaultValue: 'Account' }),
+ renderCell: (p) => {p.row.account},
+ width: 160
+ },
+ {
+ field: 'weight',
+ headerName: t('common.weight', 'Weight'),
+ width: 140,
+ valueFormatter: (p) =>
+ p.value ? `${BigNumber(p.value).shiftedBy(-30).toFormat(0)}` : null,
+ valueGetter: (p) => p.row.account_meta.weight
+ },
+ {
+ field: 'weight_pct',
+ headerName: '%',
+ width: 80,
+ valueFormatter: (p) => (p.value ? `${p.value.toFixed(2)}%` : null),
+ valueGetter: (p) =>
+ p.row.account_meta.weight
+ ? BigNumber(p.row.account_meta.weight)
+ .dividedBy(denominator)
+ .multipliedBy(100)
+ : null
+ },
+ {
+ field: 'confs_behind',
+ headerName: t('common.confirmations_behind', 'Confs Behind'),
+ width: 145,
+ valueFormatter: (p) => (p.value ? BigNumber(p.value).toFormat() : null),
+ valueGetter: (p) => p.row.telemetry.cemented_behind
+ },
+ {
+ field: 'uptime',
+ headerName: t('common.uptime', 'Uptime'),
+ width: 150,
+ renderCell: (p) => (
+
+ ),
+ valueGetter: (p) => (p.row.last_online || 0) - (p.row.last_offline || 0)
+ },
+ {
+ field: 'version',
+ headerName: t('common.version', 'Version'),
+ width: 110,
+ valueGetter: (p) => p.row.version
+ },
+ {
+ field: 'bandwidth_cap',
+ headerName: t('common.bandwidth_limit_short', 'BW Limit'),
+ width: 120,
+ valueFormatter: (p) => {
+ if (p.api.getRow(p.id).telemetry.bandwidth_cap === 0)
+ return t('common.unlimited', 'Unlimited')
+ return p.api.getRow(p.id).telemetry.bandwidth_cap
+ ? bytesToSize({
+ bytes: p.api.getRow(p.id).telemetry.bandwidth_cap,
+ t
+ }).label
+ : null
+ },
+ valueGetter: (p) => {
+ if (p.row.telemetry.bandwidth_cap === 0) return Infinity
+ return p.row.telemetry.bandwidth_cap
+ ? bytesToSize({ bytes: p.row.telemetry.bandwidth_cap, t }).value
+ : null
}
- ]
- return (
-
- row.account}
- rows={accounts.toJS()}
- initialState={{
- sorting: {
- sortModel: [{ field: 'weight', sort: 'desc' }]
- }
- }}
- />
-
- )
- }
+ },
+ {
+ field: 'peer_count',
+ headerName: t('common.peers', 'Peers'),
+ width: 100,
+ valueGetter: (p) => p.row.telemetry.peer_count
+ },
+ {
+ field: 'port',
+ headerName: t('common.port', 'Port'),
+ valueGetter: (p) => p.row.telemetry.port
+ },
+ {
+ field: 'blocks_behind',
+ headerName: t('common.blocks_behind', 'Blocks Behind'),
+ width: 145,
+ valueFormatter: (p) => (p.value ? BigNumber(p.value).toFormat() : null),
+ valueGetter: (p) => p.row.telemetry.block_behind
+ },
+ {
+ field: 'cemented_count',
+ headerName: t('common.conf_short', 'Conf.'),
+ width: 140,
+ valueFormatter: (p) => (p.value ? BigNumber(p.value).toFormat() : null),
+ valueGetter: (p) => p.row.telemetry.cemented_count
+ },
+ {
+ field: 'block_count',
+ headerName: t('common.blocks', 'Blocks'),
+ width: 140,
+ valueFormatter: (p) => (p.value ? BigNumber(p.value).toFormat() : null),
+ valueGetter: (p) => p.row.telemetry.block_count
+ },
+ {
+ field: 'unchecked_count',
+ headerName: t('common.unchecked_count', 'Unchecked'),
+ width: 140,
+ valueFormatter: (p) => (p.value ? BigNumber(p.value).toFormat() : null),
+ valueGetter: (p) => p.row.telemetry.unchecked_count
+ },
+ {
+ field: 'cpu_cores',
+ headerName: t('representatives.cpu_cores', 'CPU Cores'),
+ width: 130,
+ valueGetter: (p) => p.row.representative_meta.cpu_cores
+ },
+ {
+ field: 'cpu_model',
+ hide: true,
+ headerName: t('representatives.cpu_model', 'CPU Model'),
+ valueGetter: (p) => p.row.representative_meta.cpu_model
+ },
+ {
+ field: 'watt_hour',
+ width: 120,
+ headerName: t('representatives.tdp', 'TDP (wH)')
+ },
+ {
+ field: 'protocol_version',
+ headerName: t('representatives.protocol_version', 'Protocol'),
+ width: 110,
+ valueGetter: (p) => p.row.telemetry.protocol_version
+ },
+ {
+ field: 'last_seen',
+ width: 130,
+ headerName: t('representatives.last_seen', 'Last Seen'),
+ renderCell: (p) =>
+ p.row.is_online ? (
+
+ ) : (
+ timeago.format(p.row.last_seen * 1000, 'nano_short')
+ ),
+ valueGetter: (p) => Math.floor(Date.now() / 1000) - p.row.last_seen
+ },
+ {
+ field: 'asname',
+ headerName: t('representatives.host_asn', 'Host ASN'),
+ width: 130,
+ valueGetter: (p) => p.row.network.asname
+ },
+ {
+ field: 'country',
+ headerName: t('common.country', 'Country'),
+ width: 130,
+ valueGetter: (p) => p.row.network.country
+ },
+ {
+ field: 'address',
+ headerName: t('common.address', 'Address'),
+ width: 320,
+ valueGetter: (p) => p.row.telemetry.address
+ }
+ ]
+ return (
+
+ row.account}
+ rows={accounts.toJS()}
+ initialState={{
+ sorting: {
+ sortModel: [{ field: 'weight', sort: 'desc' }]
+ }
+ }}
+ />
+
+ )
}
Representatives.propTypes = {