[Enterprise Search] Render indexed_document_volume in MiB (#155250)

## Part of https://github.com/elastic/connectors-python/issues/735

## Summary

The field type for `indexed_document_volume` is `integer`, which can
only represent about 2GB worth of "bytes". To be able to support syncing
with larger datasets, `indexed_document_volume` is updated to store the
size in `MebiBytes`.

This PR makes sure the size is rendered correctly in UI.

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Chenhui Wang 2023-04-20 21:14:42 +08:00 committed by GitHub
parent 11721308fc
commit 5de52e84d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,7 +45,23 @@ export const SyncJobDocumentsPanel: React.FC<SyncJobDocumentsPanelProps> = (sync
name: i18n.translate('xpack.enterpriseSearch.content.index.syncJobs.documents.volume', {
defaultMessage: 'Volume',
}),
render: (volume: number) => new ByteSizeValue(volume).toString(),
render: (volume: number) =>
volume < 1
? i18n.translate(
'xpack.enterpriseSearch.content.index.syncJobs.documents.volume.lessThanOneMBLabel',
{
defaultMessage: 'Less than 1mb',
}
)
: i18n.translate(
'xpack.enterpriseSearch.content.index.syncJobs.documents.volume.aboutLabel',
{
defaultMessage: 'About {volume}',
values: {
volume: new ByteSizeValue(volume * 1024 * 1024).toString(),
},
}
),
},
];
return (