1
- import { Group , Stack , Text } from '@mantine/core' ;
1
+ import { Group , Loader , Stack , Text } from '@mantine/core' ;
2
2
import classes from '../../styles/Management.module.css' ;
3
3
import { useStreamStore } from '../../providers/StreamProvider' ;
4
4
import _ from 'lodash' ;
5
5
import { useAppStore } from '@/layouts/MainLayout/providers/AppProvider' ;
6
6
import UpdateTimePartitionLimit from './UpdateTimePartitionLimit' ;
7
7
import UpdateCustomPartitionField from './UpdateCustomPartitionField' ;
8
8
import timeRangeUtils from '@/utils/timeRangeUtils' ;
9
+ import ErrorView from './ErrorView' ;
9
10
10
11
const { formatDateWithTimezone } = timeRangeUtils ;
11
12
@@ -42,7 +43,7 @@ const InfoItem = (props: { title: string; value: string; fullWidth?: boolean })
42
43
) ;
43
44
} ;
44
45
45
- const InfoData = ( ) => {
46
+ const InfoData = ( props : { isLoading : boolean } ) => {
46
47
const [ info ] = useStreamStore ( ( store ) => store . info ) ;
47
48
const [ currentStream ] = useAppStore ( ( store ) => store . currentStream ) ;
48
49
@@ -59,33 +60,44 @@ const InfoData = () => {
59
60
60
61
return (
61
62
< Stack style = { { flex : 1 } } >
62
- < Stack style = { { flex : 1 , padding : '1.5rem' , justifyContent : 'space-between' } } >
63
- < Stack gap = { 0 } style = { { flexDirection : 'row ', justifyContent : 'space-between ' } } >
64
- < InfoItem title = "Name" value = { currentStream || '' } / >
65
- < InfoItem title = "Created At" value = { createdAtWithTz } />
66
- < InfoItem title = "First Event At" value = { firstEventAtWithTz } / >
63
+ { props . isLoading ? (
64
+ < Stack style = { { flex : 1 , width : '100% ', alignItems : 'center' , justifyContent : 'center ' } } >
65
+ < Stack style = { { alignItems : 'center' } } >
66
+ < Loader />
67
+ </ Stack >
67
68
</ Stack >
68
- < Stack gap = { 0 } style = { { flexDirection : 'row' , justifyContent : 'space-between' } } >
69
- < InfoItem title = "Schema Type" value = { staticSchemaFlag } />
70
- < InfoItem title = "Time Partition Field" value = { timePartition } />
71
- < UpdateTimePartitionLimit timePartition = { timePartition } currentStream = { currentStream ? currentStream : '' } />
69
+ ) : (
70
+ < Stack style = { { flex : 1 , padding : '1.5rem' , justifyContent : 'space-between' } } >
71
+ < Stack gap = { 0 } style = { { flexDirection : 'row' , justifyContent : 'space-between' } } >
72
+ < InfoItem title = "Name" value = { currentStream || '' } />
73
+ < InfoItem title = "Created At" value = { createdAtWithTz } />
74
+ < InfoItem title = "First Event At" value = { firstEventAtWithTz } />
75
+ </ Stack >
76
+ < Stack gap = { 0 } style = { { flexDirection : 'row' , justifyContent : 'space-between' } } >
77
+ < InfoItem title = "Schema Type" value = { staticSchemaFlag } />
78
+ < InfoItem title = "Time Partition Field" value = { timePartition } />
79
+ < UpdateTimePartitionLimit
80
+ timePartition = { timePartition }
81
+ currentStream = { currentStream ? currentStream : '' }
82
+ />
83
+ </ Stack >
84
+ < Stack gap = { 0 } style = { { flexDirection : 'row' , justifyContent : 'space-between' } } >
85
+ < UpdateCustomPartitionField
86
+ currentStream = { currentStream ? currentStream : '' }
87
+ timePartition = { timePartition }
88
+ />
89
+ </ Stack >
72
90
</ Stack >
73
- < Stack gap = { 0 } style = { { flexDirection : 'row' , justifyContent : 'space-between' } } >
74
- < UpdateCustomPartitionField
75
- currentStream = { currentStream ? currentStream : '' }
76
- timePartition = { timePartition }
77
- />
78
- </ Stack >
79
- </ Stack >
91
+ ) }
80
92
</ Stack >
81
93
) ;
82
94
} ;
83
95
84
- const Info = ( ) => {
96
+ const Info = ( props : { isLoading : boolean ; isError : boolean } ) => {
85
97
return (
86
98
< Stack className = { classes . sectionContainer } gap = { 0 } >
87
99
< Header />
88
- < InfoData />
100
+ { props . isError ? < ErrorView /> : < InfoData isLoading = { props . isLoading } /> }
89
101
</ Stack >
90
102
) ;
91
103
} ;
0 commit comments