This is an automated email from the ASF dual-hosted git repository.
gian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push:
new 9b5c216 Fix datasource availability sorting (#7451)
9b5c216 is described below
commit 9b5c216684ae2ffdbe0be1be160a16f9cc54a769
Author: Qi Shu <[email protected]>
AuthorDate: Sun Apr 14 10:09:57 2019 -0700
Fix datasource availability sorting (#7451)
* Fix availability sorting
* Style change
---
web-console/src/views/datasource-view.tsx | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/web-console/src/views/datasource-view.tsx
b/web-console/src/views/datasource-view.tsx
index 2b13b96..a9061a0 100644
--- a/web-console/src/views/datasource-view.tsx
+++ b/web-console/src/views/datasource-view.tsx
@@ -386,7 +386,12 @@ GROUP BY 1`);
Header: 'Availability',
id: 'availability',
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) => {
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')
},
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]