You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2023/02/23 19:55:01 UTC

[pinot] branch master updated: fix table sorting while filter is applied (#10226)

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 69420af19e fix table sorting while filter is applied (#10226)
69420af19e is described below

commit 69420af19eae2dc1759d354e56e5597199266d90
Author: Johan Adami <47...@users.noreply.github.com>
AuthorDate: Thu Feb 23 14:54:53 2023 -0500

    fix table sorting while filter is applied (#10226)
---
 pinot-controller/src/main/resources/app/components/Table.tsx | 6 +++++-
 pinot-controller/src/main/resources/app/utils/Utils.tsx      | 8 ++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/pinot-controller/src/main/resources/app/components/Table.tsx b/pinot-controller/src/main/resources/app/components/Table.tsx
index 8985d320c4..b145bfab6d 100644
--- a/pinot-controller/src/main/resources/app/components/Table.tsx
+++ b/pinot-controller/src/main/resources/app/components/Table.tsx
@@ -333,7 +333,8 @@ export default function CustomizedTables({
         }
         return false;
       });
-      setFinalData(filteredRescords);
+      let filteredData = {...initialData, records: filteredRescords};
+      setFinalData(Utils.tableFormat(filteredData));
     }
   }, [initialData, setFinalData]);
 
@@ -341,6 +342,9 @@ export default function CustomizedTables({
     clearTimeout(timeoutId.current);
     timeoutId.current = setTimeout(() => {
       filterSearchResults(search.toLowerCase());
+      // Table.tsx currently doesn't support sorting after filtering. So for now, we just
+      // remove the visual indicator of the sorted column until users sort again.
+      setColumnClicked('')
     }, 200);
 
     return () => {
diff --git a/pinot-controller/src/main/resources/app/utils/Utils.tsx b/pinot-controller/src/main/resources/app/utils/Utils.tsx
index 2153c9175b..582b897033 100644
--- a/pinot-controller/src/main/resources/app/utils/Utils.tsx
+++ b/pinot-controller/src/main/resources/app/utils/Utils.tsx
@@ -22,7 +22,7 @@ import React from 'react';
 import ReactDiffViewer, {DiffMethod} from 'react-diff-viewer';
 import { map, isEqual, findIndex, findLast } from 'lodash';
 import app_state from '../app_state';
-import { DISPLAY_SEGMENT_STATUS, SEGMENT_STATUS } from 'Models';
+import {DISPLAY_SEGMENT_STATUS, SEGMENT_STATUS, TableData} from 'Models';
 
 const sortArray = function (sortingArr, keyName, ascendingFlag) {
   if (ascendingFlag) {
@@ -47,13 +47,13 @@ const sortArray = function (sortingArr, keyName, ascendingFlag) {
   });
 };
 
-const tableFormat = (data) => {
+const tableFormat = (data: TableData): Array<{ [key: string]: any }> => {
   const rows = data.records;
   const header = data.columns;
 
-  const results = [];
+  const results: Array<{ [key: string]: any }> = [];
   rows.forEach((singleRow) => {
-    const obj = {};
+    const obj: { [key: string]: any } = {};
     singleRow.forEach((val: any, index: number) => {
       obj[header[index]+app_state.columnNameSeparator+index] = val;
     });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org