mirror of https://github.com/apache/druid.git
Fix datasource availability sorting (#7451)
* Fix availability sorting * Style change
This commit is contained in:
parent
7a38d28cf3
commit
9b5c216684
|
@ -386,7 +386,12 @@ GROUP BY 1`);
|
||||||
Header: 'Availability',
|
Header: 'Availability',
|
||||||
id: 'availability',
|
id: 'availability',
|
||||||
filterable: false,
|
filterable: false,
|
||||||
accessor: (row) => row.num_available_segments / row.num_segments,
|
accessor: (row) => {
|
||||||
|
return {
|
||||||
|
num_available: row.num_available_segments,
|
||||||
|
num_total: row.num_segments
|
||||||
|
};
|
||||||
|
},
|
||||||
Cell: (row) => {
|
Cell: (row) => {
|
||||||
const { datasource, num_available_segments, num_segments, disabled } = row.original;
|
const { datasource, num_available_segments, num_segments, disabled } = row.original;
|
||||||
|
|
||||||
|
@ -415,6 +420,11 @@ GROUP BY 1`);
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sortMethod: (d1, d2) => {
|
||||||
|
const percentAvailable1 = d1.num_available / d1.num_total;
|
||||||
|
const percentAvailable2 = d2.num_available / d2.num_total;
|
||||||
|
return (percentAvailable1 - percentAvailable2) || (d1.num_total - d2.num_total);
|
||||||
|
},
|
||||||
show: tableColumnSelectionHandler.showColumn('Availability')
|
show: tableColumnSelectionHandler.showColumn('Availability')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue