From ba5d2a89d905f5216ea9e0b0aa18e44c5d986e43 Mon Sep 17 00:00:00 2001 From: Koustav Das <78158736+Koustavd18@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:44:45 +0530 Subject: [PATCH] fix: hot tier refresh (#429) --- src/hooks/useHotTier.ts | 1 + src/pages/Stream/Views/Manage/Management.tsx | 1 + src/pages/Stream/Views/Manage/Settings.tsx | 57 +++++++++++++++----- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/hooks/useHotTier.ts b/src/hooks/useHotTier.ts index ecd928e1..a38e6204 100644 --- a/src/hooks/useHotTier.ts +++ b/src/hooks/useHotTier.ts @@ -63,6 +63,7 @@ export const useHotTier = (streamName: string, hasSettingsAccess: boolean) => { return { getHotTierInfoError, getHotTierInfoLoading, + refetchHotTierInfo, updateHotTier, deleteHotTier, isDeleting, diff --git a/src/pages/Stream/Views/Manage/Management.tsx b/src/pages/Stream/Views/Manage/Management.tsx index 9c993a9e..42b7d871 100644 --- a/src/pages/Stream/Views/Manage/Management.tsx +++ b/src/pages/Stream/Views/Manage/Management.tsx @@ -44,6 +44,7 @@ const Management = (props: { schemaLoading: boolean }) => { isLoading={isHotTierLoading || isRetentionLoading} updateRetentionConfig={getRetentionConfig.updateLogStreamRetention} updateHotTierInfo={hotTierFetch.updateHotTier} + refetchHotTierInfo={hotTierFetch.refetchHotTierInfo} deleteHotTierInfo={hotTierFetch.deleteHotTier} isDeleting={hotTierFetch.isDeleting} isUpdating={hotTierFetch.isUpdating} diff --git a/src/pages/Stream/Views/Manage/Settings.tsx b/src/pages/Stream/Views/Manage/Settings.tsx index d291851e..f53ba9d0 100644 --- a/src/pages/Stream/Views/Manage/Settings.tsx +++ b/src/pages/Stream/Views/Manage/Settings.tsx @@ -1,4 +1,4 @@ -import { Box, Button, Divider, Loader, Modal, NumberInput, Stack, TextInput } from '@mantine/core'; +import { Box, Button, Divider, Group, Loader, Modal, NumberInput, px, Stack, TextInput } from '@mantine/core'; import classes from '../../styles/Management.module.css'; import { Text } from '@mantine/core'; import { useAppStore } from '@/layouts/MainLayout/providers/AppProvider'; @@ -6,14 +6,17 @@ import { useForm } from '@mantine/form'; import _ from 'lodash'; import { useCallback, useEffect, useState } from 'react'; import { useStreamStore } from '../../providers/StreamProvider'; -import { IconCheck, IconTrash, IconX } from '@tabler/icons-react'; +import { IconCheck, IconX, IconReload } from '@tabler/icons-react'; import { sanitizeBytes, convertGibToBytes } from '@/utils/formatBytes'; import timeRangeUtils from '@/utils/timeRangeUtils'; import ErrorView from './ErrorView'; import RestrictedView from '@/components/Misc/RestrictedView'; +import IconButton from '@/components/Button/IconButton'; const { formatDateWithTimezone } = timeRangeUtils; +const renderRefreshIcon = () => ; + const Header = () => { return ( @@ -168,6 +171,7 @@ const DeleteHotTierModal = (props: { const HotTierConfig = (props: { updateHotTierInfo: ({ size }: { size: string }) => void; + refetchHotTierInfo: () => void; deleteHotTierInfo: ({ onSuccess }: { onSuccess: () => void }) => void; isDeleting: boolean; isUpdating: boolean; @@ -228,21 +232,23 @@ const HotTierConfig = (props: { /> Hot Tier Storage Size - {!hotTierNotSet && streamType === 'UserDefined' ? ( - + {!hotTierNotSet ? ( + + + ) : null} - - - Oldest Record: - - {_.isEmpty(oldestEntry) ? 'No Entries Stored' : formatDateWithTimezone(oldestEntry)} - - + - + {streamType === 'UserDefined' ? ( {humanizedUsedSize} used | {humanizedAvailableSize} available @@ -265,7 +271,7 @@ const HotTierConfig = (props: { @@ -289,6 +295,18 @@ const HotTierConfig = (props: { {props.isUpdating && } + + {!hotTierNotSet && streamType === 'UserDefined' ? ( + + + + + + ) : null} +