mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* fix sorting for index management * PR feedback
This commit is contained in:
parent
498c054f89
commit
2b85a2ada9
1 changed files with 9 additions and 1 deletions
|
@ -17,7 +17,15 @@ const unitMagnitude = {
|
|||
};
|
||||
const byteSort = (fieldName) => (item) => {
|
||||
const rawValue = item[fieldName];
|
||||
const [ , number, unit] = rawValue.match(/(.*)([kmgtp]b)/);
|
||||
// raw value can be missing if index is closed
|
||||
if (!rawValue) {
|
||||
return 0;
|
||||
}
|
||||
const matchResult = rawValue.match(/(.*)([kmgtp]b)/);
|
||||
if (!matchResult) {
|
||||
return 0;
|
||||
}
|
||||
const [ , number, unit] = matchResult;
|
||||
return +number * Math.pow(1024, unitMagnitude[unit]);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue