@@ -33,6 +33,7 @@ import {useAlert} from '../../contexts/alert.context'
33
33
import { useBasicBackdrop } from '../../contexts/backdrop.context'
34
34
import Loader from '../helpers/loader.helper.component'
35
35
import { useConfirmation } from '../../contexts/confirmation.context'
36
+ import { CircularProgress } from '@mui/material'
36
37
37
38
const App : React . FC = ( ) => {
38
39
const NO_FILTER = 'NoFilter'
@@ -61,6 +62,7 @@ const App: React.FC = () => {
61
62
const [ initialTransactionLoadComplete , setInitialTransactionLoadComplete ] =
62
63
useState ( false )
63
64
const [ loading , setLoading ] = useState ( false )
65
+ const [ filterLoading , setFilterLoading ] = useState ( false )
64
66
const { closeReRunDialog, showReRunDialog} =
65
67
useTransactionRerunConfirmationDialog ( )
66
68
const { showAlert, hideAlert} = useAlert ( )
@@ -145,6 +147,9 @@ const App: React.FC = () => {
145
147
const fetchTransactionLogs = useCallback (
146
148
async ( timestampFilter ?: string , filteredResults ?: boolean ) => {
147
149
try {
150
+ if ( filteredResults ) {
151
+ setFilterLoading ( true )
152
+ }
148
153
const fetchParams = getFilters ( timestampFilter )
149
154
150
155
setHttpError ( null )
@@ -198,6 +203,10 @@ const App: React.FC = () => {
198
203
} catch ( error ) {
199
204
console . error ( 'Error fetching logs:' , error )
200
205
setHttpError ( error )
206
+ } finally {
207
+ if ( filteredResults ) {
208
+ setFilterLoading ( false )
209
+ }
201
210
}
202
211
} ,
203
212
[
@@ -617,15 +626,21 @@ const App: React.FC = () => {
617
626
< Box sx = { { mt : 3 } } >
618
627
< Card elevation = { 4 } >
619
628
< CardContent >
620
- < TransactionLogTable
621
- transactions = { filteredTransactions }
622
- loadMore = { loadMore }
623
- loading = { loading }
624
- initialTransactionLoadComplete = { initialTransactionLoadComplete }
625
- onRowClick = { handleRowClick }
626
- onSelectedChange = { setSelectedTransactions }
627
- onAutoUpdateChange = { handleAutoUpdateChange }
628
- />
629
+ { filterLoading ? (
630
+ < Box display = "flex" justifyContent = "center" alignItems = "center" p = { 3 } >
631
+ < CircularProgress />
632
+ </ Box >
633
+ ) : (
634
+ < TransactionLogTable
635
+ transactions = { filteredTransactions }
636
+ loadMore = { loadMore }
637
+ loading = { loading }
638
+ initialTransactionLoadComplete = { initialTransactionLoadComplete }
639
+ onRowClick = { handleRowClick }
640
+ onSelectedChange = { setSelectedTransactions }
641
+ onAutoUpdateChange = { handleAutoUpdateChange }
642
+ />
643
+ ) }
629
644
</ CardContent >
630
645
</ Card >
631
646
</ Box >
0 commit comments