mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Revert "[Infrastructure UI] Hosts: Right align table number columns and fix spacing between value and unit (#148180)"
This reverts commit 871e7bbed1
.
This commit is contained in:
parent
b7624367b6
commit
825f2e5b76
5 changed files with 9 additions and 15 deletions
|
@ -11,14 +11,14 @@ import { createBytesFormatter } from './bytes';
|
|||
describe('createDataFormatter', () => {
|
||||
it('should format bytes as bytesDecimal', () => {
|
||||
const formatter = createBytesFormatter(InfraWaffleMapDataFormat.bytesDecimal);
|
||||
expect(formatter(1000000)).toBe('1 MB');
|
||||
expect(formatter(1000000)).toBe('1MB');
|
||||
});
|
||||
it('should format bytes as bitsDecimal', () => {
|
||||
const formatter = createBytesFormatter(InfraWaffleMapDataFormat.bitsDecimal);
|
||||
expect(formatter(1000000)).toBe('8 Mbit');
|
||||
expect(formatter(1000000)).toBe('8Mbit');
|
||||
});
|
||||
it('should format bytes as abbreviatedNumber', () => {
|
||||
const formatter = createBytesFormatter(InfraWaffleMapDataFormat.abbreviatedNumber);
|
||||
expect(formatter(1000000)).toBe('1 M');
|
||||
expect(formatter(1000000)).toBe('1M');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -47,7 +47,7 @@ export const createBytesFormatter = (format: InfraWaffleMapDataFormat) => (bytes
|
|||
// is greater then the max label then use the max label.
|
||||
const power = Math.min(Math.floor(Math.log(Math.abs(value)) / Math.log(base)), labels.length - 1);
|
||||
if (power < 0) {
|
||||
return `${formatNumber(value)} ${labels[0]}`;
|
||||
return `${formatNumber(value)}${labels[0]}`;
|
||||
}
|
||||
return `${formatNumber(value / Math.pow(base, power))} ${labels[power]}`;
|
||||
return `${formatNumber(value / Math.pow(base, power))}${labels[power]}`;
|
||||
};
|
||||
|
|
|
@ -74,7 +74,6 @@ export const HostsTableColumns: Array<EuiBasicTableColumn<HostNodeRow>> = [
|
|||
render: (cpuCores: SnapshotNodeMetric) => (
|
||||
<>{formatMetric('cpuCores', cpuCores?.value ?? cpuCores?.max)}</>
|
||||
),
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.infra.hostsTable.diskLatencyColumnHeader', {
|
||||
|
@ -83,7 +82,6 @@ export const HostsTableColumns: Array<EuiBasicTableColumn<HostNodeRow>> = [
|
|||
field: 'diskLatency.avg',
|
||||
sortable: true,
|
||||
render: (avg: number) => <>{formatMetric('diskLatency', avg)}</>,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.infra.hostsTable.averageTxColumnHeader', {
|
||||
|
@ -92,7 +90,6 @@ export const HostsTableColumns: Array<EuiBasicTableColumn<HostNodeRow>> = [
|
|||
field: 'tx.avg',
|
||||
sortable: true,
|
||||
render: (avg: number) => <>{formatMetric('tx', avg)}</>,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.infra.hostsTable.averageRxColumnHeader', {
|
||||
|
@ -101,7 +98,6 @@ export const HostsTableColumns: Array<EuiBasicTableColumn<HostNodeRow>> = [
|
|||
field: 'rx.avg',
|
||||
sortable: true,
|
||||
render: (avg: number) => <>{formatMetric('rx', avg)}</>,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.infra.hostsTable.averageMemoryTotalColumnHeader', {
|
||||
|
@ -110,7 +106,6 @@ export const HostsTableColumns: Array<EuiBasicTableColumn<HostNodeRow>> = [
|
|||
field: 'memoryTotal.avg',
|
||||
sortable: true,
|
||||
render: (avg: number) => <>{formatMetric('memoryTotal', avg)}</>,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.infra.hostsTable.averageMemoryUsageColumnHeader', {
|
||||
|
@ -119,6 +114,5 @@ export const HostsTableColumns: Array<EuiBasicTableColumn<HostNodeRow>> = [
|
|||
field: 'memory.avg',
|
||||
sortable: true,
|
||||
render: (avg: number) => <>{formatMetric('memory', avg)}</>,
|
||||
align: 'right',
|
||||
},
|
||||
];
|
||||
|
|
|
@ -55,7 +55,7 @@ exports[`ConditionalToolTip renders correctly 1`] = `
|
|||
class="euiFlexItem emotion-euiFlexItem-growZero"
|
||||
data-test-subj="conditionalTooltipContent-value"
|
||||
>
|
||||
8 Mbit/s
|
||||
8Mbit/s
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
@ -71,7 +71,7 @@ exports[`ConditionalToolTip renders correctly 1`] = `
|
|||
class="euiFlexItem emotion-euiFlexItem-growZero"
|
||||
data-test-subj="conditionalTooltipContent-value"
|
||||
>
|
||||
8 Mbit/s
|
||||
8Mbit/s
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('createFormatterForMetric()', () => {
|
|||
field: 'host.network.egress.bytes',
|
||||
};
|
||||
const format = createFormatterForMetric(metric);
|
||||
expect(format(103929292)).toBe('831.4 Mbit/s');
|
||||
expect(format(103929292)).toBe('831.4Mbit/s');
|
||||
});
|
||||
it('should just work for bytes', () => {
|
||||
const metric: MetricsExplorerMetric = {
|
||||
|
@ -38,6 +38,6 @@ describe('createFormatterForMetric()', () => {
|
|||
field: 'host.network.egress.bytes',
|
||||
};
|
||||
const format = createFormatterForMetric(metric);
|
||||
expect(format(103929292)).toBe('103.9 MB');
|
||||
expect(format(103929292)).toBe('103.9MB');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue