-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: implement pagination for transaction log queries #5281
feat: implement pagination for transaction log queries #5281
Conversation
CodSpeed Performance ReportMerging #5281 will degrade performances by 45.18%Comparing Summary
Benchmarks breakdown
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @dhlidongming
Are you using the Transactions table in your developments?
const { | ||
data: TransactionData, | ||
isLoading, | ||
refetch, | ||
} = useGetTransactionsQuery({ | ||
id: currentFlowId, | ||
params: { | ||
page: pageIndex, | ||
size: pageSize, | ||
}, | ||
mode: "union", | ||
}); | ||
|
||
const data = { | ||
rows: TransactionData?.rows ?? [], | ||
columns: TransactionData?.columns ?? [], | ||
pagination: { | ||
page: TransactionData?.pagination?.page ?? 1, | ||
size: TransactionData?.pagination?.size ?? 10, | ||
total: TransactionData?.pagination?.total ?? 0, | ||
pages: TransactionData?.pagination?.pages ?? 0, | ||
}, | ||
}; | ||
|
||
useEffect(() => { | ||
if (data) { | ||
if (TransactionData) { | ||
const { columns, rows } = data; | ||
setColumns(columns.map((col) => ({ ...col, editable: true }))); | ||
setRows(rows); | ||
} | ||
if (open) refetch(); | ||
}, [data, open, isLoading]); | ||
}, [TransactionData]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the variables named TransactionData
be data
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ogabrielluiz Thank you for pointing that out.I have removed the redundant TransactionData
variable and updated the code accordingly.
@ogabrielluiz Yes, we need to use the Transactions table to view the execution logs of various components to determine if the Agent is running correctly.
|
0611411
to
8c32ef1
Compare
That's good to know. We are planning on improving logs and stuff like that. We'll use this PR as an example that people are still using the transactions. Thanks @dhlidongming ! |
…nation with Page[TransactionTable].
… check for 'items' in JSON response instead of direct equality to an empty list.
- Updated TransactionReadResponse to use 'id' as an alias for 'transaction_id'. - Introduced a new function, transform_transaction_table, to convert TransactionTable instances to TransactionReadResponse, supporting both single and list inputs. - Improved import structure for better readability in crud.py.
…ion retrieval - Updated the get_transactions function to utilize the new transform_transaction_table function, enhancing the transformation of TransactionTable instances during pagination. - Improved the import structure by adding the necessary import for transform_transaction_table.
…eval - Added 'params' to VertexTuple for better clarity in transaction logging. - Modified assertions in test_delete_folder_with_flows_with_transaction_and_build to check for 'items' in the JSON response instead of direct equality to an empty list, ensuring more accurate test validation.
- Integrated fastapi_pagination into the main application by adding the add_pagination function to the FastAPI instance. - Removed the redundant add_pagination call from the flows module to streamline the pagination setup.
ff280e1
to
7bdd67d
Compare
This PR introduces pagination to the transactions log using
fastapi-pagination
on the backend andPaginatorComponent
on the frontend.These changes aim to enhance retrieval speed, reduce memory consumption, and prevent potential lags during frequent debugging sessions.