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' ;
22import classes from '../../styles/Management.module.css' ;
33import { Text } from '@mantine/core' ;
44import { useAppStore } from '@/layouts/MainLayout/providers/AppProvider' ;
55import { useForm } from '@mantine/form' ;
66import _ from 'lodash' ;
77import { useCallback , useEffect , useState } from 'react' ;
88import { useStreamStore } from '../../providers/StreamProvider' ;
9- import { IconCheck , IconTrash , IconX } from '@tabler/icons-react' ;
9+ import { IconCheck , IconX , IconReload } from '@tabler/icons-react' ;
1010import { sanitizeBytes , convertGibToBytes } from '@/utils/formatBytes' ;
1111import timeRangeUtils from '@/utils/timeRangeUtils' ;
1212import ErrorView from './ErrorView' ;
1313import RestrictedView from '@/components/Misc/RestrictedView' ;
14+ import IconButton from '@/components/Button/IconButton' ;
1415
1516const { formatDateWithTimezone } = timeRangeUtils ;
1617
18+ const renderRefreshIcon = ( ) => < IconReload size = { px ( '1rem' ) } stroke = { 1.5 } /> ;
19+
1720const Header = ( ) => {
1821 return (
1922 < Stack className = { classes . headerContainer } style = { { minHeight : '3rem' , maxHeight : '3rem' } } >
@@ -168,6 +171,7 @@ const DeleteHotTierModal = (props: {
168171
169172const HotTierConfig = ( props : {
170173 updateHotTierInfo : ( { size } : { size : string } ) => void ;
174+ refetchHotTierInfo : ( ) => void ;
171175 deleteHotTierInfo : ( { onSuccess } : { onSuccess : ( ) => void } ) => void ;
172176 isDeleting : boolean ;
173177 isUpdating : boolean ;
@@ -228,21 +232,23 @@ const HotTierConfig = (props: {
228232 />
229233 < Stack style = { { flexDirection : 'row' , justifyContent : 'space-between' } } gap = { 8 } >
230234 < 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 >
233244 ) : null }
234245 </ 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' } } >
242247 < Stack style = { { width : hotTierNotSet ? '100%' : '50%' } } gap = { isDirty || hotTierNotSet ? 16 : 4 } >
243- < Stack style = { { } } gap = { 12 } >
248+ < Stack gap = { 12 } >
244249 { streamType === 'UserDefined' ? (
245250 < NumberInput
251+ w = { hotTierNotSet ? '100%' : '50%' }
246252 classNames = { { label : classes . fieldDescription } }
247253 placeholder = "Size in GiB"
248254 key = "size"
@@ -257,15 +263,15 @@ const HotTierConfig = (props: {
257263 ) : null }
258264 < Text
259265 className = { classes . fieldDescription }
260- ta = "end "
266+ ta = "start "
261267 style = { { ...( isDirty || hotTierNotSet ? { display : 'none' } : { } ) } } >
262268 { humanizedUsedSize } used | { humanizedAvailableSize } available
263269 </ Text >
264270 </ Stack >
265271 < Stack
266272 style = { {
267273 flexDirection : 'row' ,
268- justifyContent : 'flex-end ' ,
274+ justifyContent : 'flex-start ' ,
269275 ...( ! isDirty || hotTierNotSet ? { display : 'none' } : { } ) ,
270276 } }
271277 gap = { 12 } >
@@ -289,6 +295,18 @@ const HotTierConfig = (props: {
289295 </ Stack >
290296 { props . isUpdating && < Loader size = "sm" /> }
291297 </ 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+
292310 < Stack style = { { alignItems : 'flex-end' , ...( ! hotTierNotSet ? { display : 'none' } : { } ) } } >
293311 < Box >
294312 < Button onClick = { onUpdate } disabled = { localSizeValue <= 0 } loading = { props . isUpdating } >
@@ -297,6 +315,15 @@ const HotTierConfig = (props: {
297315 </ Box >
298316 </ Stack >
299317 </ 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 >
300327 </ Stack >
301328 </ Stack >
302329 ) ;
@@ -310,6 +337,7 @@ const Settings = (props: {
310337 isLoading : boolean ;
311338 updateRetentionConfig : ( { config } : { config : any } ) => void ;
312339 updateHotTierInfo : ( { size } : { size : string } ) => void ;
340+ refetchHotTierInfo : ( ) => void ;
313341 deleteHotTierInfo : ( { onSuccess } : { onSuccess : ( ) => void } ) => void ;
314342 isDeleting : boolean ;
315343 isUpdating : boolean ;
@@ -333,6 +361,7 @@ const Settings = (props: {
333361 ) : (
334362 < >
335363 < HotTierConfig
364+ refetchHotTierInfo = { props . refetchHotTierInfo }
336365 updateHotTierInfo = { props . updateHotTierInfo }
337366 deleteHotTierInfo = { props . deleteHotTierInfo }
338367 isDeleting = { props . isDeleting }
0 commit comments