Skip to content

Commit fe31998

Browse files
authored
refresh accurate alerts context on stream change (#239)
1 parent cf37f66 commit fe31998

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/pages/Logs/StaticLogTable.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,24 @@ const {
4949
setCleanStoreForStreamChange,
5050
} = logsStoreReducers;
5151

52+
const TotalCount = (props: { totalCount: number }) => {
53+
return (
54+
<Tooltip label={props.totalCount}>
55+
<Text>{HumanizeNumber(props.totalCount)}</Text>
56+
</Tooltip>
57+
);
58+
};
59+
5260
const TotalLogsCount = () => {
5361
const [{ totalCount, perPage, pageData }] = useLogsStore((store) => store.tableOpts);
5462
const displayedCount = _.size(pageData);
5563
const showingCount = displayedCount < perPage ? displayedCount : perPage;
5664
if (typeof totalCount !== 'number' || typeof displayedCount !== 'number') return <Stack />;
5765

58-
const renderTotalCount = useCallback(
59-
() => (
60-
<Tooltip label={totalCount}>
61-
<Text>{HumanizeNumber(totalCount)}</Text>
62-
</Tooltip>
63-
),
64-
[totalCount],
65-
);
6666
return (
6767
<Stack style={{ alignItems: 'center', justifyContent: 'center', flexDirection: 'row' }} gap={6}>
6868
<Text>{`Showing ${showingCount} out of`}</Text>
69-
{renderTotalCount()}
69+
<TotalCount totalCount={totalCount}/>
7070
<Text>records</Text>
7171
</Stack>
7272
);

src/pages/Logs/providers/LogsProvider.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ const getCleanStoreForRefetch = (store: LogsStore) => {
570570
};
571571

572572
const setCleanStoreForStreamChange = (store: LogsStore) => {
573-
const { tableOpts, timeRange } = store;
573+
const { tableOpts, timeRange, alerts } = store;
574574
const { interval, type } = timeRange;
575575
const duration = _.find(FIXED_DURATIONS, (duration) => duration.name === timeRange.label);
576576
const updatedTimeRange = interval && type === 'fixed' ? { timeRange: getDefaultTimeRange(duration) } : {};
@@ -587,6 +587,7 @@ const setCleanStoreForStreamChange = (store: LogsStore) => {
587587
totalPages: 0,
588588
},
589589
...updatedTimeRange,
590+
alerts
590591
};
591592
};
592593

0 commit comments

Comments
 (0)