mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
This commit is contained in:
parent
38606de526
commit
32faf87490
1 changed files with 17 additions and 11 deletions
|
@ -15,7 +15,15 @@ function formatData(txt) {
|
||||||
return numeral(txt).format(DATA_FORMAT);
|
return numeral(txt).format(DATA_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatValues([key, value]) {
|
export function formatValues(obj) {
|
||||||
|
if (!obj) {
|
||||||
|
// catch case that formatValues is called without a value.
|
||||||
|
// caused by very rare race condition when loading jobs list after deleting a job.
|
||||||
|
return ['', ''];
|
||||||
|
}
|
||||||
|
|
||||||
|
const [key, value] = obj;
|
||||||
|
|
||||||
// time
|
// time
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'finished_time':
|
case 'finished_time':
|
||||||
|
@ -28,8 +36,7 @@ export function formatValues([key, value]) {
|
||||||
case 'latest_empty_bucket_timestamp':
|
case 'latest_empty_bucket_timestamp':
|
||||||
case 'latest_sparse_bucket_timestamp':
|
case 'latest_sparse_bucket_timestamp':
|
||||||
case 'latest_bucket_timestamp':
|
case 'latest_bucket_timestamp':
|
||||||
value = timeFormatter(value);
|
return [key, timeFormatter(value)];
|
||||||
break;
|
|
||||||
|
|
||||||
// data
|
// data
|
||||||
case 'established_model_memory':
|
case 'established_model_memory':
|
||||||
|
@ -38,8 +45,7 @@ export function formatValues([key, value]) {
|
||||||
case 'model_bytes_exceeded':
|
case 'model_bytes_exceeded':
|
||||||
case 'model_bytes_memory_limit':
|
case 'model_bytes_memory_limit':
|
||||||
case 'peak_model_bytes':
|
case 'peak_model_bytes':
|
||||||
value = formatData(value);
|
return [key, formatData(value)];
|
||||||
break;
|
|
||||||
|
|
||||||
// numbers
|
// numbers
|
||||||
case 'processed_record_count':
|
case 'processed_record_count':
|
||||||
|
@ -57,8 +63,7 @@ export function formatValues([key, value]) {
|
||||||
case 'total_partition_field_count':
|
case 'total_partition_field_count':
|
||||||
case 'bucket_allocation_failures_count':
|
case 'bucket_allocation_failures_count':
|
||||||
case 'search_count':
|
case 'search_count':
|
||||||
value = toLocaleString(value);
|
return [key, toLocaleString(value)];
|
||||||
break;
|
|
||||||
|
|
||||||
// numbers rounded to 3 decimal places
|
// numbers rounded to 3 decimal places
|
||||||
case 'average_search_time_per_bucket_ms':
|
case 'average_search_time_per_bucket_ms':
|
||||||
|
@ -69,14 +74,15 @@ export function formatValues([key, value]) {
|
||||||
case 'average_bucket_processing_time_ms':
|
case 'average_bucket_processing_time_ms':
|
||||||
case 'exponential_average_bucket_processing_time_ms':
|
case 'exponential_average_bucket_processing_time_ms':
|
||||||
case 'exponential_average_bucket_processing_time_per_hour_ms':
|
case 'exponential_average_bucket_processing_time_per_hour_ms':
|
||||||
value = typeof value === 'number' ? roundToDecimalPlace(value, 3).toLocaleString() : value;
|
return [
|
||||||
break;
|
key,
|
||||||
|
typeof value === 'number' ? roundToDecimalPlace(value, 3).toLocaleString() : value,
|
||||||
|
];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
|
||||||
}
|
|
||||||
return [key, value];
|
return [key, value];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// utility function to filter child object and arrays out of the supplied object.
|
// utility function to filter child object and arrays out of the supplied object.
|
||||||
// overrides can be supplied to allow either objects or arrays
|
// overrides can be supplied to allow either objects or arrays
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue