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