From 14a65a439b145cbad5a8678c78dcb3f8cfbf78a0 Mon Sep 17 00:00:00 2001 From: Janno Stern Date: Fri, 17 Jan 2025 08:53:31 +0200 Subject: [PATCH] Fix chat history query params --- GUI/src/components/DataTable/index.tsx | 27 ++++++++++++------------ GUI/src/pages/Chat/ChatHistory/index.tsx | 4 ++++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/GUI/src/components/DataTable/index.tsx b/GUI/src/components/DataTable/index.tsx index de568fb4..943c35db 100644 --- a/GUI/src/components/DataTable/index.tsx +++ b/GUI/src/components/DataTable/index.tsx @@ -1,4 +1,4 @@ -import React, {CSSProperties, FC, ReactNode, useId} from 'react'; +import React, { CSSProperties, FC, ReactNode, useId } from 'react'; import { ColumnDef, useReactTable, @@ -13,13 +13,11 @@ import { PaginationState, TableMeta, Row, - RowData, ColumnFiltersState, + RowData, + ColumnFiltersState, ColumnPinningState, } from '@tanstack/react-table'; -import { - RankingInfo, - rankItem, -} from '@tanstack/match-sorter-utils'; +import { RankingInfo, rankItem } from '@tanstack/match-sorter-utils'; import { MdUnfoldMore, MdExpandMore, @@ -116,7 +114,7 @@ const DataTable: FC = ({ disableHead, pagesCount, meta, - selectedRow + selectedRow, }) => { const id = useId(); const { t } = useTranslation(); @@ -183,6 +181,9 @@ const DataTable: FC = ({ }; const pageIndexes = getShownPageIndexes(); + const searchParamsWithoutPage = new URLSearchParams(searchParams); + searchParamsWithoutPage.delete('page'); + return ( <>
@@ -257,9 +258,9 @@ const DataTable: FC = ({ {tableBodyPrefix} {table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => ( = ({ <>
  • { table.setPageIndex(0); setSearchParams((params) => { @@ -344,7 +345,7 @@ const DataTable: FC = ({ })} > table.setPageIndex(index)} aria-label={t('global.gotoPage') + index} aria-current={ @@ -362,7 +363,7 @@ const DataTable: FC = ({ table.getPageCount() - 2 &&
  • ...
  • }
  • { table.setPageIndex(table.getPageCount() - 1); setSearchParams((params) => { diff --git a/GUI/src/pages/Chat/ChatHistory/index.tsx b/GUI/src/pages/Chat/ChatHistory/index.tsx index 260546c8..bb41441e 100644 --- a/GUI/src/pages/Chat/ChatHistory/index.tsx +++ b/GUI/src/pages/Chat/ChatHistory/index.tsx @@ -628,6 +628,7 @@ const ChatHistory: FC = () => { getAllEndedChats.mutate({ startDate: start, endDate: format(new Date(endDate), 'yyyy-MM-dd'), + customerSupportIds: passedCustomerSupportIds, pagination, sorting, search, @@ -659,6 +660,7 @@ const ChatHistory: FC = () => { getAllEndedChats.mutate({ startDate: format(new Date(startDate), 'yyyy-MM-dd'), endDate: end, + customerSupportIds: passedCustomerSupportIds, pagination, sorting, search, @@ -734,6 +736,7 @@ const ChatHistory: FC = () => { getAllEndedChats.mutate({ startDate: format(new Date(startDate), 'yyyy-MM-dd'), endDate: format(new Date(endDate), 'yyyy-MM-dd'), + customerSupportIds: passedCustomerSupportIds, pagination: state, sorting, search, @@ -744,6 +747,7 @@ const ChatHistory: FC = () => { getAllEndedChats.mutate({ startDate: format(new Date(startDate), 'yyyy-MM-dd'), endDate: format(new Date(endDate), 'yyyy-MM-dd'), + customerSupportIds: passedCustomerSupportIds, pagination, sorting: state, search,