@@ -15,7 +15,7 @@ import { useElementHelper } from '@Pimcore/modules/element/hooks/use-element-hel
1515import { type ElementType } from '@Pimcore/types/enums/element/element-type'
1616import { formatDateTime } from '@Pimcore/utils/date-time'
1717import { Button } from '@sdk/components'
18- import { createColumnHelper } from '@tanstack/react-table'
18+ import { createColumnHelper , type SortingState } from '@tanstack/react-table'
1919import { isNil } from 'lodash'
2020import React , { useState } from 'react'
2121import { useTranslation } from 'react-i18next'
@@ -25,14 +25,17 @@ import { useStyles } from './table.styles'
2525
2626interface TableProps {
2727 items : BundleApplicationLoggerGetCollectionApiResponse [ 'items' ]
28+ isLoading ?: boolean
29+ sorting ?: SortingState
30+ onSortingChange ?: ( sorting : SortingState ) => void
2831}
2932
3033export interface BundleApplicationLoggerLogEntryWithActions extends BundleApplicationLoggerLogEntry {
3134 translatedPriority : string
3235 actions : React . ReactNode
3336}
3437
35- export const Table = ( { items } : TableProps ) : React . JSX . Element => {
38+ export const Table = ( { items, isLoading , sorting , onSortingChange } : TableProps ) : React . JSX . Element => {
3639 const { t } = useTranslation ( )
3740 const { openElement } = useElementHelper ( )
3841 const { styles } = useStyles ( )
@@ -56,14 +59,16 @@ export const Table = ({ items }: TableProps): React.JSX.Element => {
5659 const columns = [
5760 columnHelper . accessor ( 'date' , {
5861 header : t ( 'application-logger.columns.timestamp' ) ,
59- size : 80
62+ size : 80 ,
63+ enableSorting : true
6064 } ) ,
6165 columnHelper . accessor ( 'pid' , {
6266 header : t ( 'application-logger.columns.pid' ) ,
6367 size : 60
6468 } ) ,
6569 columnHelper . accessor ( 'message' , {
6670 header : t ( 'application-logger.columns.message' ) ,
71+ enableSorting : true ,
6772 cell : ( { getValue } ) => (
6873 < span className = { styles . cellTruncate } >
6974 { getValue ( ) }
@@ -72,10 +77,12 @@ export const Table = ({ items }: TableProps): React.JSX.Element => {
7277 } ) ,
7378 columnHelper . accessor ( 'translatedPriority' , {
7479 header : t ( 'application-logger.columns.type' ) ,
75- size : 60
80+ size : 60 ,
81+ enableSorting : true
7682 } ) ,
7783 columnHelper . accessor ( 'fileObject' , {
7884 header : t ( 'application-logger.columns.file-object' ) ,
85+ enableSorting : true ,
7986 cell : ( { row } ) : React . JSX . Element => {
8087 const column = row . original
8188 const fileObjectBasePath = '/admin/bundle/applicationlogger/log/show-file-object?filePath='
@@ -125,13 +132,16 @@ export const Table = ({ items }: TableProps): React.JSX.Element => {
125132 } ) ,
126133 columnHelper . accessor ( 'component' , {
127134 header : t ( 'application-logger.columns.component' ) ,
128- size : 100
135+ size : 100 ,
136+ enableSorting : true
129137 } ) ,
130138 columnHelper . accessor ( 'source' , {
131- header : t ( 'application-logger.columns.source' )
139+ header : t ( 'application-logger.columns.source' ) ,
140+ enableSorting : true
132141 } ) ,
133142 columnHelper . accessor ( 'actions' , {
134143 header : t ( 'application-logger.columns.details' ) ,
144+ enableSorting : false ,
135145 cell : ( { row } ) : React . JSX . Element => {
136146 const column = row . original
137147
@@ -160,9 +170,13 @@ export const Table = ({ items }: TableProps): React.JSX.Element => {
160170 autoWidth
161171 columns = { columns }
162172 data = { tableItems }
163- // isLoading={notesAndEventsFetching}
173+ enableSorting
174+ isLoading = { isLoading }
175+ manualSorting
164176 modifiedCells = { [ ] }
177+ onSortingChange = { onSortingChange }
165178 resizable
179+ sorting = { sorting }
166180 />
167181
168182 < DetailModal
0 commit comments