Fixes #13987 database schema search pagination (#13989)

* fix db schema search pagination

* reorder conditions

* added searchValue

Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>

---------

Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
dechoma 2023-11-21 06:25:01 +01:00 committed by GitHub
parent 64b00a2dca
commit d55100592d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,12 +128,14 @@ export const DatabaseSchemaTable = () => {
const handleSchemaPageChange = useCallback( const handleSchemaPageChange = useCallback(
({ currentPage, cursorType }: PagingHandlerParams) => { ({ currentPage, cursorType }: PagingHandlerParams) => {
if (cursorType) { if (searchValue) {
searchSchema(searchValue, currentPage);
} else if (cursorType) {
fetchDatabaseSchema({ [cursorType]: paging[cursorType] }); fetchDatabaseSchema({ [cursorType]: paging[cursorType] });
} }
handlePageChange(currentPage); handlePageChange(currentPage);
}, },
[paging, fetchDatabaseSchema] [paging, fetchDatabaseSchema, searchSchema, searchValue]
); );
const onSchemaSearch = (value: string) => { const onSchemaSearch = (value: string) => {
@ -195,6 +197,7 @@ export const DatabaseSchemaTable = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isNumberBased={Boolean(searchValue)}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleSchemaPageChange} pagingHandler={handleSchemaPageChange}