mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-02 16:19:08 +00:00
change default sort on logs tables closes #1907
This commit is contained in:
@@ -129,7 +129,7 @@ export function queryRequest(data: Q) {
|
||||
eq(requestAuditLog.resourceId, resources.resourceId)
|
||||
) // TODO: Is this efficient?
|
||||
.where(getWhere(data))
|
||||
.orderBy(desc(requestAuditLog.timestamp), desc(requestAuditLog.id));
|
||||
.orderBy(desc(requestAuditLog.timestamp));
|
||||
}
|
||||
|
||||
export function countRequestQuery(data: Q) {
|
||||
|
||||
@@ -640,7 +640,7 @@ export default function GeneralPage() {
|
||||
}}
|
||||
defaultSort={{
|
||||
id: "timestamp",
|
||||
desc: false
|
||||
desc: true
|
||||
}}
|
||||
// Server-side pagination props
|
||||
totalCount={totalCount}
|
||||
|
||||
@@ -493,7 +493,7 @@ export default function GeneralPage() {
|
||||
}}
|
||||
defaultSort={{
|
||||
id: "timestamp",
|
||||
desc: false
|
||||
desc: true
|
||||
}}
|
||||
// Server-side pagination props
|
||||
totalCount={totalCount}
|
||||
|
||||
@@ -778,7 +778,7 @@ export default function GeneralPage() {
|
||||
}}
|
||||
defaultSort={{
|
||||
id: "timestamp",
|
||||
desc: false
|
||||
desc: true
|
||||
}}
|
||||
// Server-side pagination props
|
||||
totalCount={totalCount}
|
||||
|
||||
@@ -257,7 +257,10 @@ export function LogDataTable<TData, TValue>({
|
||||
? {}
|
||||
: { getPaginationRowModel: getPaginationRowModel() }),
|
||||
onSortingChange: setSorting,
|
||||
getSortedRowModel: getSortedRowModel(),
|
||||
// Disable client-side sorting for server-side pagination since data is already sorted on server
|
||||
...(isServerPagination
|
||||
? {}
|
||||
: { getSortedRowModel: getSortedRowModel() }),
|
||||
onColumnFiltersChange: setColumnFilters,
|
||||
getFilteredRowModel: getFilteredRowModel(),
|
||||
onGlobalFilterChange: setGlobalFilter,
|
||||
@@ -269,6 +272,7 @@ export function LogDataTable<TData, TValue>({
|
||||
}
|
||||
: {}),
|
||||
initialState: {
|
||||
sorting: defaultSort ? [defaultSort] : [],
|
||||
pagination: {
|
||||
pageSize: pageSize,
|
||||
pageIndex: currentPage
|
||||
|
||||
Reference in New Issue
Block a user