1
- import { Box , Button , Divider , Loader , Modal , NumberInput , Stack , TextInput } from '@mantine/core' ;
1
+ import { Box , Button , Divider , Group , Loader , Modal , NumberInput , px , Stack , TextInput } from '@mantine/core' ;
2
2
import classes from '../../styles/Management.module.css' ;
3
3
import { Text } from '@mantine/core' ;
4
4
import { useAppStore } from '@/layouts/MainLayout/providers/AppProvider' ;
5
5
import { useForm } from '@mantine/form' ;
6
6
import _ from 'lodash' ;
7
7
import { useCallback , useEffect , useState } from 'react' ;
8
8
import { useStreamStore } from '../../providers/StreamProvider' ;
9
- import { IconCheck , IconTrash , IconX } from '@tabler/icons-react' ;
9
+ import { IconCheck , IconX , IconReload } from '@tabler/icons-react' ;
10
10
import { sanitizeBytes , convertGibToBytes } from '@/utils/formatBytes' ;
11
11
import timeRangeUtils from '@/utils/timeRangeUtils' ;
12
12
import ErrorView from './ErrorView' ;
13
13
import RestrictedView from '@/components/Misc/RestrictedView' ;
14
+ import IconButton from '@/components/Button/IconButton' ;
14
15
15
16
const { formatDateWithTimezone } = timeRangeUtils ;
16
17
18
+ const renderRefreshIcon = ( ) => < IconReload size = { px ( '1rem' ) } stroke = { 1.5 } /> ;
19
+
17
20
const Header = ( ) => {
18
21
return (
19
22
< Stack className = { classes . headerContainer } style = { { minHeight : '3rem' , maxHeight : '3rem' } } >
@@ -168,6 +171,7 @@ const DeleteHotTierModal = (props: {
168
171
169
172
const HotTierConfig = ( props : {
170
173
updateHotTierInfo : ( { size } : { size : string } ) => void ;
174
+ refetchHotTierInfo : ( ) => void ;
171
175
deleteHotTierInfo : ( { onSuccess } : { onSuccess : ( ) => void } ) => void ;
172
176
isDeleting : boolean ;
173
177
isUpdating : boolean ;
@@ -228,21 +232,23 @@ const HotTierConfig = (props: {
228
232
/>
229
233
< Stack style = { { flexDirection : 'row' , justifyContent : 'space-between' } } gap = { 8 } >
230
234
< Text className = { classes . fieldTitle } > Hot Tier Storage Size</ Text >
231
- { ! hotTierNotSet && streamType === 'UserDefined' ? (
232
- < IconTrash onClick = { openDeleteModal } stroke = { 1.2 } size = "1.2rem" className = { classes . deleteIcon } />
235
+ { ! hotTierNotSet ? (
236
+ < Group style = { { justifyContent : 'end' } } >
237
+ < IconButton
238
+ size = { 38 }
239
+ renderIcon = { renderRefreshIcon }
240
+ onClick = { props . refetchHotTierInfo }
241
+ tooltipLabel = "Refresh now"
242
+ />
243
+ </ Group >
233
244
) : null }
234
245
</ Stack >
235
- < Stack style = { { flexDirection : 'row' , justifyContent : 'space-between' , height : '3.8rem' } } >
236
- < Stack gap = { 4 } style = { { ...( hotTierNotSet ? { display : 'none' } : { } ) } } >
237
- < Text className = { classes . fieldDescription } > Oldest Record:</ Text >
238
- < Text className = { classes . fieldDescription } >
239
- { _ . isEmpty ( oldestEntry ) ? 'No Entries Stored' : formatDateWithTimezone ( oldestEntry ) }
240
- </ Text >
241
- </ Stack >
246
+ < Stack style = { { flexDirection : 'row' , height : '6.8rem' } } >
242
247
< Stack style = { { width : hotTierNotSet ? '100%' : '50%' } } gap = { isDirty || hotTierNotSet ? 16 : 4 } >
243
- < Stack style = { { } } gap = { 12 } >
248
+ < Stack gap = { 12 } >
244
249
{ streamType === 'UserDefined' ? (
245
250
< NumberInput
251
+ w = { hotTierNotSet ? '100%' : '50%' }
246
252
classNames = { { label : classes . fieldDescription } }
247
253
placeholder = "Size in GiB"
248
254
key = "size"
@@ -257,15 +263,15 @@ const HotTierConfig = (props: {
257
263
) : null }
258
264
< Text
259
265
className = { classes . fieldDescription }
260
- ta = "end "
266
+ ta = "start "
261
267
style = { { ...( isDirty || hotTierNotSet ? { display : 'none' } : { } ) } } >
262
268
{ humanizedUsedSize } used | { humanizedAvailableSize } available
263
269
</ Text >
264
270
</ Stack >
265
271
< Stack
266
272
style = { {
267
273
flexDirection : 'row' ,
268
- justifyContent : 'flex-end ' ,
274
+ justifyContent : 'flex-start ' ,
269
275
...( ! isDirty || hotTierNotSet ? { display : 'none' } : { } ) ,
270
276
} }
271
277
gap = { 12 } >
@@ -289,6 +295,18 @@ const HotTierConfig = (props: {
289
295
</ Stack >
290
296
{ props . isUpdating && < Loader size = "sm" /> }
291
297
</ Stack >
298
+
299
+ { ! hotTierNotSet && streamType === 'UserDefined' ? (
300
+ < Stack
301
+ style = { { alignItems : 'flex-start' , paddingTop : '0.8rem' , ...( hotTierNotSet ? { display : 'none' } : { } ) } } >
302
+ < Box >
303
+ < Button variant = "outline" onClick = { openDeleteModal } >
304
+ Delete
305
+ </ Button >
306
+ </ Box >
307
+ </ Stack >
308
+ ) : null }
309
+
292
310
< Stack style = { { alignItems : 'flex-end' , ...( ! hotTierNotSet ? { display : 'none' } : { } ) } } >
293
311
< Box >
294
312
< Button onClick = { onUpdate } disabled = { localSizeValue <= 0 } loading = { props . isUpdating } >
@@ -297,6 +315,15 @@ const HotTierConfig = (props: {
297
315
</ Box >
298
316
</ Stack >
299
317
</ Stack >
318
+ < Divider orientation = "vertical" size = { 2 } style = { { ...( hotTierNotSet ? { display : 'none' } : { } ) } } />
319
+ < Stack
320
+ gap = { 4 }
321
+ style = { { ...( hotTierNotSet ? { display : 'none' } : { display : 'flex' , justifyContent : 'flex-start' } ) } } >
322
+ < Text style = { { fontSize : '11.2px' } } > Oldest Record:</ Text >
323
+ < Text className = { classes . fieldDescription } >
324
+ { _ . isEmpty ( oldestEntry ) ? 'No Entries Stored' : formatDateWithTimezone ( oldestEntry ) }
325
+ </ Text >
326
+ </ Stack >
300
327
</ Stack >
301
328
</ Stack >
302
329
) ;
@@ -310,6 +337,7 @@ const Settings = (props: {
310
337
isLoading : boolean ;
311
338
updateRetentionConfig : ( { config } : { config : any } ) => void ;
312
339
updateHotTierInfo : ( { size } : { size : string } ) => void ;
340
+ refetchHotTierInfo : ( ) => void ;
313
341
deleteHotTierInfo : ( { onSuccess } : { onSuccess : ( ) => void } ) => void ;
314
342
isDeleting : boolean ;
315
343
isUpdating : boolean ;
@@ -333,6 +361,7 @@ const Settings = (props: {
333
361
) : (
334
362
< >
335
363
< HotTierConfig
364
+ refetchHotTierInfo = { props . refetchHotTierInfo }
336
365
updateHotTierInfo = { props . updateHotTierInfo }
337
366
deleteHotTierInfo = { props . deleteHotTierInfo }
338
367
isDeleting = { props . isDeleting }
0 commit comments