diff --git a/package.json b/package.json
index 62ddf41c..59b29dbc 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,7 @@
},
"dependencies": {
"@emotion/react": "^11.11.1",
+ "@mantine/carousel": "^6.0.15",
"@mantine/core": "^6.0.15",
"@mantine/dates": "^6.0.15",
"@mantine/form": "^6.0.15",
@@ -25,6 +26,7 @@
"@types/js-cookie": "^3.0.3",
"axios": "^1.4.0",
"dayjs": "^1.11.8",
+ "embla-carousel-react": "7.1.0",
"http-status-codes": "^2.2.0",
"immer": "^10.0.2",
"js-cookie": "^3.0.5",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ac389350..165152a2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -8,6 +8,9 @@ dependencies:
'@emotion/react':
specifier: ^11.11.1
version: 11.11.1(@types/react@18.2.14)(react@18.2.0)
+ '@mantine/carousel':
+ specifier: ^6.0.15
+ version: 6.0.15(@mantine/core@6.0.15)(@mantine/hooks@6.0.15)(embla-carousel-react@7.1.0)(react@18.2.0)
'@mantine/core':
specifier: ^6.0.15
version: 6.0.15(@emotion/react@11.11.1)(@mantine/hooks@6.0.15)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)
@@ -41,6 +44,9 @@ dependencies:
dayjs:
specifier: ^1.11.8
version: 1.11.8
+ embla-carousel-react:
+ specifier: 7.1.0
+ version: 7.1.0(react@18.2.0)
http-status-codes:
specifier: ^2.2.0
version: 2.2.0
@@ -569,6 +575,21 @@ packages:
resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==}
dev: true
+ /@mantine/carousel@6.0.15(@mantine/core@6.0.15)(@mantine/hooks@6.0.15)(embla-carousel-react@7.1.0)(react@18.2.0):
+ resolution: {integrity: sha512-5eYPSi8Q6Ze9YDQ8iaNmBHI542PZlzj4SIxF900B1R0D9NckXbev/1pa16Z9ogKNwxttgYzmMq6GDKvfgGzR3A==}
+ peerDependencies:
+ '@mantine/core': 6.0.15
+ '@mantine/hooks': 6.0.15
+ embla-carousel-react: ^7.0.0
+ react: '>=16.8.0'
+ dependencies:
+ '@mantine/core': 6.0.15(@emotion/react@11.11.1)(@mantine/hooks@6.0.15)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)
+ '@mantine/hooks': 6.0.15(react@18.2.0)
+ '@mantine/utils': 6.0.15(react@18.2.0)
+ embla-carousel-react: 7.1.0(react@18.2.0)
+ react: 18.2.0
+ dev: false
+
/@mantine/core@6.0.15(@emotion/react@11.11.1)(@mantine/hooks@6.0.15)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-CN2UV2RXumxac75cWgUPMcHiE36T4ciIpFf20JwpazshnwFNu7scvy6GJDwUouf0zTBLnPMAD1S/B4mIRc3aQw==}
peerDependencies:
@@ -1531,6 +1552,19 @@ packages:
csstype: 3.1.2
dev: false
+ /embla-carousel-react@7.1.0(react@18.2.0):
+ resolution: {integrity: sha512-tbYRPRZSDNd2QLNqYDcArAakGIxtUbhS7tkP0dGXktXHGgcX+3ji3VrOUTOftBiujZrMV8kRxtrRUe/1soloIQ==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.1 || ^18.0.0
+ dependencies:
+ embla-carousel: 7.1.0
+ react: 18.2.0
+ dev: false
+
+ /embla-carousel@7.1.0:
+ resolution: {integrity: sha512-Bh8Pa8NWzgugLkf8sAGexQlBCNDFaej5BXiKgQdRJ1mUC9NWBrw9Z23YVPVGkguWoz5LMjZXXFVGCobl3UPt/Q==}
+ dev: false
+
/end-of-stream@1.4.4:
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
dependencies:
diff --git a/src/components/Header/RefreshInterval.tsx b/src/components/Header/RefreshInterval.tsx
index c8661a9f..84f8a34d 100644
--- a/src/components/Header/RefreshInterval.tsx
+++ b/src/components/Header/RefreshInterval.tsx
@@ -38,7 +38,9 @@ const RefreshInterval: FC = () => {
{selectedInterval ? ms(selectedInterval) : 'Off'}
-
+
{REFRESH_INTERVALS.map((interval) => {
if (interval === selectedInterval) return null;
diff --git a/src/components/Header/TimeRange.tsx b/src/components/Header/TimeRange.tsx
index 7ba42cc2..5104ee6a 100644
--- a/src/components/Header/TimeRange.tsx
+++ b/src/components/Header/TimeRange.tsx
@@ -15,6 +15,7 @@ const TimeRange: FC = () => {
state: { subLogQuery, subLogSelectedTimeRange },
} = useHeaderContext();
+ const [opened, setOpened] = useMountedState(false);
const [selectedRange, setSelectedRange] = useMountedState(subLogSelectedTimeRange.get().value);
useEffect(() => {
@@ -26,7 +27,7 @@ const TimeRange: FC = () => {
}, []);
const onDurationSelect = (duration: FixedDurations) => {
- subLogSelectedTimeRange.set((state)=>{
+ subLogSelectedTimeRange.set((state) => {
state.value = duration.name;
state.state = 'fixed';
});
@@ -36,6 +37,7 @@ const TimeRange: FC = () => {
query.startTime = now.subtract(duration.milliseconds, 'milliseconds').toDate();
query.endTime = now.toDate();
});
+ setOpened(false);
};
const { classes, cx } = useLogQueryStyles();
@@ -49,7 +51,7 @@ const TimeRange: FC = () => {
} = classes;
return (
-
@@ -81,7 +83,10 @@ const TimeRange: FC = () => {
);
};
-const CustomTimeRange: FC = () => {
+type CustomTimeRangeProps = {
+ setOpened: (opened: boolean) => void;
+};
+const CustomTimeRange: FC = ({ setOpened }) => {
const {
state: { subLogQuery, subLogSelectedTimeRange },
} = useHeaderContext();
@@ -105,10 +110,11 @@ const CustomTimeRange: FC = () => {
});
const startTime = dayjs(selectedRange.startTime).format('DD-MM-YY HH:mm');
const endTime = dayjs(selectedRange.endTime).format('DD-MM-YY HH:mm');
- subLogSelectedTimeRange.set((state)=>{
+ subLogSelectedTimeRange.set((state) => {
state.state = 'custom';
state.value = `${startTime} - ${endTime}`;
});
+ setOpened(false);
};
const { classes } = useLogQueryStyles();
diff --git a/src/components/Mantine/theme.tsx b/src/components/Mantine/theme.tsx
index f5e54f26..1f29a6cb 100644
--- a/src/components/Mantine/theme.tsx
+++ b/src/components/Mantine/theme.tsx
@@ -111,7 +111,7 @@ export const theme: MantineThemeOverride = {
}),
},
Table: {
- styles: ({ defaultRadius: _defaultRadius, colors, fontSizes, other: { fontWeights } }) => {
+ styles: ({ defaultRadius: _defaultRadius, colors }) => {
return {
root: {
background: colors.white,
@@ -127,15 +127,6 @@ export const theme: MantineThemeOverride = {
textAlign: 'left',
padding: 0,
},
-
- '& tr th .label': {
- display: 'flex',
- alignItems: 'center',
- fontSize: fontSizes.md,
- fontWeight: fontWeights.semibold,
- height: '100%',
- textAlign: 'left',
- },
},
};
},
diff --git a/src/hooks/useQueryLogs.ts b/src/hooks/useQueryLogs.ts
index af8b287f..7480cf4d 100644
--- a/src/hooks/useQueryLogs.ts
+++ b/src/hooks/useQueryLogs.ts
@@ -15,13 +15,13 @@ export const useQueryLogs = () => {
const [error, setError] = useMountedState(null);
const [loading, setLoading] = useMountedState(false);
const [pageLogData, setPageLogData] = useMountedState(null);
- const [querySearch, setQuerySearch] = useMountedState({
- search: '',
- filters: {},
- sort: {
- field: 'p_timestamp',
- order: SortOrder.DESCENDING
- }
+ const [querySearch, setQuerySearch] = useMountedState({
+ search: '',
+ filters: {},
+ sort: {
+ field: 'p_timestamp',
+ order: SortOrder.DESCENDING,
+ },
});
const [isPending, startTransition] = useTransition();
@@ -60,15 +60,15 @@ export const useQueryLogs = () => {
const { field, order } = sort;
- temp.sort(({[field]: aData}, {[field]: bData}) => {
- let res = 0
+ temp.sort(({ [field]: aData }, { [field]: bData }) => {
+ let res = 0;
if (aData === bData) res = 0;
else if (aData === null) res = -1;
else if (bData === null) res = 1;
else res = aData > bData ? 1 : -1;
- return res*order;
- })
+ return res * order;
+ });
return temp;
}
@@ -136,7 +136,6 @@ export const useQueryLogs = () => {
if (logsQueryRes.status === StatusCodes.OK) {
_dataRef.current = data;
-
return;
}
if (typeof data === 'string' && data.includes('Stream is not initialized yet')) {
diff --git a/src/layouts/MainLayout/Context.tsx b/src/layouts/MainLayout/Context.tsx
index 66a94405..fe53fd1b 100644
--- a/src/layouts/MainLayout/Context.tsx
+++ b/src/layouts/MainLayout/Context.tsx
@@ -35,10 +35,6 @@ export const FIXED_DURATIONS = [
name: 'last 7 days',
milliseconds: dayjs.duration({ days: 7 }).asMilliseconds(),
},
- {
- name: 'last 2 months',
- milliseconds: dayjs.duration({ months: 2 }).asMilliseconds(),
- },
] as const;
export const DEFAULT_FIXED_DURATIONS = FIXED_DURATIONS[0];
@@ -70,18 +66,18 @@ const MainLayoutPageProvider: FC = ({ children }) => {
startTime: now.subtract(DEFAULT_FIXED_DURATIONS.milliseconds, 'milliseconds').toDate(),
endTime: now.toDate(),
streamName: '',
- access:null
+ access: null,
});
const subLogSearch = useSubscribeState({
search: '',
filters: {},
sort: {
field: 'p_timestamp',
- order: SortOrder.DESCENDING
- }
+ order: SortOrder.DESCENDING,
+ },
});
const subLogSelectedTimeRange = useSubscribeState({
- state: "fixed",
+ state: 'fixed',
value: DEFAULT_FIXED_DURATIONS.name,
});
const subRefreshInterval = useSubscribeState(null);
@@ -95,7 +91,7 @@ const MainLayoutPageProvider: FC = ({ children }) => {
subLogSelectedTimeRange,
subNavbarTogle,
subCreateUserModalTogle,
- subLLMActive
+ subLLMActive,
};
const methods: HeaderContextMethods = {};
diff --git a/src/pages/Config/index.tsx b/src/pages/Config/index.tsx
index 5b54f092..1e145cf4 100644
--- a/src/pages/Config/index.tsx
+++ b/src/pages/Config/index.tsx
@@ -97,9 +97,12 @@ const Config: FC = () => {
};
useEffect(() => {
+ if(!subLogQuery.get().streamName) return;
getLogAlert(subLogQuery.get().streamName);
getLogRetention(subLogQuery.get().streamName);
+ }, []);
+ useEffect(() => {
const subQuery = subLogQuery.subscribe((value: any) => {
if (intialAlert) {
resetIntailAlertData();
diff --git a/src/pages/Logs/CarouselSlide.tsx b/src/pages/Logs/CarouselSlide.tsx
new file mode 100644
index 00000000..fbec9863
--- /dev/null
+++ b/src/pages/Logs/CarouselSlide.tsx
@@ -0,0 +1,107 @@
+import { useGetQueryCount } from '@/hooks/useGetQueryCount';
+import { useHeaderContext } from '@/layouts/MainLayout/Context';
+import { Box, Button, Tooltip } from '@mantine/core';
+import dayjs from 'dayjs';
+import { useEffect } from 'react';
+import { useLogsPageContext } from './Context';
+import useMountedState from '@/hooks/useMountedState';
+import { Carousel } from '@mantine/carousel';
+
+type FillCarouselProps = {
+ gapMinute: number;
+ endtime: Date;
+ id: number;
+};
+const FillCarousel = ({ gapMinute, endtime, id }: FillCarouselProps) => {
+ const {
+ state: { subLogQuery },
+ } = useHeaderContext();
+ const {
+ state: { subGapTime },
+ } = useLogsPageContext();
+ const [subID, setSubID] = useMountedState(null);
+
+ const { data: count, error, loading, getQueryCountData: getCount } = useGetQueryCount();
+
+ const parsedEndTime = dayjs(endtime).set('second', 0).set('millisecond', 0).toDate();
+
+ useEffect(() => {
+ getCount({
+ startTime: dayjs(parsedEndTime).subtract(gapMinute, 'minute').toDate(),
+ endTime: parsedEndTime,
+ streamName: subLogQuery.get().streamName,
+ access: subLogQuery.get().access,
+ });
+ const subID = subGapTime.subscribe((data) => {
+ if (data) {
+ setSubID(data.id);
+ }
+ });
+ return () => {
+ subID();
+ };
+ }, []);
+
+ useEffect(() => {
+ if (count && count[0].totalcurrentcount !== 0 && ((subGapTime.get()?.id ?? 0) > id || subGapTime.get() === null)) {
+ subGapTime.set({
+ startTime: dayjs(parsedEndTime).subtract(gapMinute, 'minute').toDate(),
+ endTime: parsedEndTime,
+ id: id,
+ });
+ }
+ }, [count]);
+
+ return (
+
+
+
+
+
+
+
+ );
+};
+
+export default FillCarousel;
diff --git a/src/pages/Logs/Column.tsx b/src/pages/Logs/Column.tsx
index a66a18fd..168b1ad0 100644
--- a/src/pages/Logs/Column.tsx
+++ b/src/pages/Logs/Column.tsx
@@ -110,11 +110,15 @@ const Column: FC = (props) => {
const { labelBtn, applyBtn, labelIcon, labelIconActive, searchInputStyle, filterText } = classes;
return (
-
+ |
- {capitalizeFirstLetter(columnName)}
+ {capitalizeFirstLetter(columnName)}
;
subViewLog: SubData;
+ subGapTime: SubData;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -29,10 +36,12 @@ interface LogsPageProviderProps {
const LogsPageProvider: FC = ({ children }) => {
const subLogStreamError = useSubscribeState(null);
const subViewLog = useSubscribeState(null);
+ const subGapTime = useSubscribeState(null);
const state: LogsPageContextState = {
subLogStreamError,
subViewLog,
+ subGapTime,
};
const methods: LogsPageContextMethods = {};
diff --git a/src/pages/Logs/CustomPagination.tsx b/src/pages/Logs/CustomPagination.tsx
deleted file mode 100644
index 52c2e0c2..00000000
--- a/src/pages/Logs/CustomPagination.tsx
+++ /dev/null
@@ -1,131 +0,0 @@
-import { useGetQueryCount } from '@/hooks/useGetQueryCount';
-import useMountedState from '@/hooks/useMountedState';
-import { useHeaderContext } from '@/layouts/MainLayout/Context';
-import { Group, Pagination, Tooltip } from '@mantine/core';
-
-import dayjs from 'dayjs';
-import { FC, useEffect } from 'react';
-
-type PaginationProps = {
- currentStartTime: Date | null;
- setCurrentStartTime: (date: Date | null) => void;
- pageLogData: any;
- goToPage: (page: number, limit: number) => void;
- setCurrentCount: (currentCount:number)=>void;
-};
-const CustomPagination: FC = (props) => {
- const { currentStartTime, pageLogData, goToPage, setCurrentStartTime,setCurrentCount } = props;
- const [nextStartTimeTemp, setNextStartTimeTemp] = useMountedState(null);
- const [nextStartTime, setNextStartTime] = useMountedState(null);
- const [prevStartTimeTemp, setPrevStartTimeTemp] = useMountedState(null);
- const [prevStartTime, setPrevStartTime] = useMountedState(null);
-
- const {
- state: { subLogQuery },
- } = useHeaderContext();
- const { data: queryCountResForNext, getQueryCountData: getQueryCountDataForNext } = useGetQueryCount();
- const { data: queryCountResForPrev, getQueryCountData: getQueryCountDataForPrev } = useGetQueryCount();
-
- useEffect(() => {
- if (currentStartTime) {
- setPrevStartTimeTemp(dayjs(currentStartTime).add(1, 'minute').toDate());
- setNextStartTimeTemp(dayjs(currentStartTime).subtract(1, 'minute').toDate());
- }
- }, [currentStartTime]);
-
- useEffect(() => {
- if (nextStartTimeTemp) {
- getQueryCountDataForNext({
- startTime: nextStartTimeTemp,
- endTime: dayjs(nextStartTimeTemp).add(1, 'minute').toDate(),
- streamName: subLogQuery.get().streamName,
- access: subLogQuery.get().access,
- });
- }
- }, [nextStartTimeTemp]);
-
- useEffect(() => {
- if (
- queryCountResForNext &&
- queryCountResForNext[0].totalcurrentcount === 0 &&
- nextStartTimeTemp &&
- nextStartTimeTemp >= subLogQuery.get().startTime
- ) {
- setNextStartTimeTemp(new Date(dayjs(nextStartTimeTemp).subtract(1, 'minute').toDate()));
- } else if (queryCountResForNext && queryCountResForNext[0].totalcurrentcount !== 0 &&nextStartTimeTemp &&
- nextStartTimeTemp >= subLogQuery.get().startTime) {
- setNextStartTime(nextStartTimeTemp);
- }
- }, [queryCountResForNext]);
-
- useEffect(() => {
- if (prevStartTimeTemp) {
- getQueryCountDataForPrev({
- startTime: prevStartTimeTemp,
- endTime: dayjs(prevStartTimeTemp).add(1, 'minute').toDate(),
- streamName: subLogQuery.get().streamName,
- access: subLogQuery.get().access,
- });
- }
- }, [prevStartTimeTemp]);
-
- useEffect(() => {
- if (
- queryCountResForPrev &&
- queryCountResForPrev[0].totalcurrentcount === 0 &&
- prevStartTimeTemp &&
- prevStartTimeTemp <= subLogQuery.get().endTime
- ) {
- setPrevStartTimeTemp(new Date(dayjs(prevStartTimeTemp).add(1, 'minute').toDate()));
- } else if (
- queryCountResForPrev &&
- queryCountResForPrev[0].totalcurrentcount !== 0 &&
- prevStartTimeTemp &&
- prevStartTimeTemp <= subLogQuery.get().endTime
- ) {
- setPrevStartTime(prevStartTimeTemp);
- }
- }, [queryCountResForPrev]);
-
- return (
- <>
-
- {
- goToPage(page, pageLogData?.limit || 1);
- }}>
-
-
- {
- if (prevStartTime) {
- setCurrentStartTime(prevStartTime);
- setCurrentCount(queryCountResForPrev[0].totalcurrentcount)
- }
- }}
- />
-
-
-
-
-
- {
- if (nextStartTime) {
- setCurrentStartTime(nextStartTime);
- setCurrentCount(queryCountResForNext[0].totalcurrentcount)
- }
- }}
- disabled={Boolean(!nextStartTime)}
- />
-
-
-
- >
- );
-};
-
-export default CustomPagination;
diff --git a/src/pages/Logs/HeaderPagination.tsx b/src/pages/Logs/HeaderPagination.tsx
new file mode 100644
index 00000000..5d57697e
--- /dev/null
+++ b/src/pages/Logs/HeaderPagination.tsx
@@ -0,0 +1,236 @@
+import { useGetQueryCount } from '@/hooks/useGetQueryCount';
+import useMountedState from '@/hooks/useMountedState';
+import { useHeaderContext } from '@/layouts/MainLayout/Context';
+import { Carousel } from '@mantine/carousel';
+import { Box, Button, Text } from '@mantine/core';
+import dayjs from 'dayjs';
+
+import { FC, useEffect, useRef } from 'react';
+import FillCarousel from './CarouselSlide';
+import { useLogsPageContext } from './Context';
+import Loading from '@/components/Loading';
+
+const Limit = 10000;
+const gapOptions = [1, 5, 10, 15, 20, 30, 60];
+
+const HeaderPagination: FC = () => {
+ const {
+ state: { subLogQuery },
+ } = useHeaderContext();
+ const [headDate, setHeadDate] = useMountedState(null);
+
+ const [endDatePointer, setEndDatePointer] = useMountedState(null);
+ const [gapTemp, setGapTemp] = useMountedState(0);
+ const [gapMinute, setGapMinute] = useMountedState(0);
+ const [upperLimit, setUpperLimit] = useMountedState(20);
+ const slots = useRef<
+ | {
+ gapMinute: number;
+ endtime: Date;
+ id: number;
+ }[]
+ | null
+ >(null);
+
+ const {
+ data: queryCountRes,
+ error: queryCountError,
+ loading: queryCountLoading,
+ getQueryCountData,
+ resetData: resetQueryCountData,
+ } = useGetQueryCount();
+ const {
+ state: { subGapTime },
+ } = useLogsPageContext();
+
+ const getMinuteCount = (minute: number) => {
+ if (endDatePointer) {
+ const startTime = dayjs(endDatePointer).subtract(minute, 'minute').toDate();
+ if (subLogQuery.get().streamName) {
+ getQueryCountData({
+ startTime: startTime,
+ endTime: endDatePointer,
+ streamName: subLogQuery.get().streamName,
+ access: subLogQuery.get().access,
+ });
+ }
+ }
+ };
+
+ useEffect(() => {
+ const logQueryListener = subLogQuery.subscribe((query) => {
+ if (query.endTime) {
+ let tempDate = new Date(query.endTime);
+ tempDate.setSeconds(0, 0);
+ resetQueryCountData();
+ subGapTime.set(null);
+ setGapTemp(0);
+ setGapMinute(0);
+ slots.current = null;
+ setUpperLimit(20);
+ setEndDatePointer(tempDate);
+ }
+ });
+ if (subLogQuery.get().endTime) {
+ let tempDate = new Date(subLogQuery.get().endTime);
+ tempDate.setSeconds(0, 0);
+ setEndDatePointer(tempDate);
+ getMinuteCount(gapOptions[gapTemp]);
+ }
+
+ return () => {
+ logQueryListener();
+ };
+ }, []);
+
+ useEffect(() => {
+ if (endDatePointer) {
+ getMinuteCount(gapOptions[gapTemp]);
+ }
+ }, [endDatePointer]);
+
+ useEffect(() => {
+ if (queryCountRes) {
+ if (
+ queryCountRes[0].totalcurrentcount < Limit &&
+ gapTemp !== gapOptions.length - 1 &&
+ gapOptions[gapTemp + 1] < dayjs(subLogQuery.get().endTime).diff(dayjs(subLogQuery.get().startTime), 'minute')
+ ) {
+ setGapTemp(gapTemp + 1);
+ getMinuteCount(gapOptions[gapTemp + 1]);
+ } else if (
+ queryCountRes[0].totalcurrentcount < Limit &&
+ gapTemp <= gapOptions.length - 1 &&
+ gapOptions[gapTemp + 1] >= dayjs(subLogQuery.get().endTime).diff(dayjs(subLogQuery.get().startTime), 'minute')
+ ) {
+ setGapMinute(gapOptions[gapTemp]);
+ } else if (queryCountRes[0].totalcurrentcount >= Limit || gapTemp === gapOptions.length - 1) {
+ setGapMinute(gapOptions[gapTemp]);
+ }
+ }
+ }, [queryCountRes]);
+
+ useEffect(() => {
+ if (gapMinute !== 0) {
+ const tempSlots = [];
+ for (
+ let i = dayjs(subLogQuery.get().endTime).toDate(), j = 1;
+ i > subLogQuery.get().startTime && j <= upperLimit;
+ i = dayjs(i).subtract(gapMinute, 'minute').toDate(), j++
+ ) {
+ tempSlots.push({
+ gapMinute: gapMinute,
+ endtime: i,
+ id: j,
+ });
+ }
+ slots.current = tempSlots;
+ }
+ }, [gapMinute]);
+
+ const loadMore = () => {
+ if (
+ subLogQuery.get().endTime &&
+ slots.current &&
+ slots.current.length > 0 &&
+ slots.current[slots.current.length - 1].endtime > subLogQuery.get().startTime
+ ) {
+ setUpperLimit(upperLimit + 20);
+ for (
+ let i = dayjs(slots.current[slots.current.length - 1].endtime).toDate(),
+ j = slots.current[slots.current.length - 1].id + 1;
+ dayjs(i).subtract(gapMinute, 'minute').toDate() > subLogQuery.get().startTime && j <= upperLimit + 20;
+ i = dayjs(i).subtract(gapMinute, 'minute').toDate(), j++
+ ) {
+ slots.current.push({
+ gapMinute: gapMinute,
+ endtime: i,
+ id: j,
+ });
+ }
+ }
+ };
+
+ const onSlideChange = (index: number) => {
+ if (slots.current && slots.current.length - 1 >= index * 9) {
+ setHeadDate(dayjs(slots.current[index * 9].endtime).toDate());
+ }
+ };
+
+ return (
+
+ {gapMinute === 0 || queryCountLoading ? (
+
+ ) : (
+ <>
+
+ {' '}
+ Loaded events for {dayjs(headDate).format('DD-MM-YYYY')}. Showing {gapMinute} minute intervals.
+
+
+
+ {slots.current?.map((slot) => (
+
+ ))}
+
+
+
+
+
+ >
+ )}
+ {queryCountError && {queryCountError} }
+
+ );
+};
+
+export default HeaderPagination;
diff --git a/src/pages/Logs/LogTable.tsx b/src/pages/Logs/LogTable.tsx
index f5ba75a7..2c3ffc1c 100644
--- a/src/pages/Logs/LogTable.tsx
+++ b/src/pages/Logs/LogTable.tsx
@@ -1,8 +1,21 @@
-import Loading from '@/components/Loading';
import { Tbody, Thead } from '@/components/Table';
import { useGetLogStreamSchema } from '@/hooks/useGetLogStreamSchema';
import { useQueryLogs } from '@/hooks/useQueryLogs';
-import { Box, Center, Checkbox, Menu, ScrollArea, Table, px, ActionIcon, Text, Flex, Button } from '@mantine/core';
+import {
+ Box,
+ Center,
+ Checkbox,
+ Menu,
+ ScrollArea,
+ Table,
+ px,
+ ActionIcon,
+ Text,
+ Flex,
+ Button,
+ Pagination,
+ Loader,
+} from '@mantine/core';
import { useCallback, useEffect, useMemo, useRef } from 'react';
import type { FC } from 'react';
import { LOG_QUERY_LIMITS, useLogsPageContext } from './Context';
@@ -20,14 +33,12 @@ import FilterPills from './FilterPills';
import { useHeaderContext } from '@/layouts/MainLayout/Context';
import dayjs from 'dayjs';
import { SortOrder } from '@/@types/parseable/api/query';
-import { useGetQueryCount } from '@/hooks/useGetQueryCount';
-import CustomPagination from './CustomPagination';
const skipFields = ['p_metadata', 'p_tags'];
const LogTable: FC = () => {
const {
- state: { subLogStreamError },
+ state: { subLogStreamError, subGapTime },
} = useLogsPageContext();
const {
state: { subLogSearch, subLogQuery, subRefreshInterval, subLogSelectedTimeRange },
@@ -37,17 +48,6 @@ const LogTable: FC = () => {
const [logStreamError, setLogStreamError] = useMountedState(null);
const [columnToggles, setColumnToggles] = useMountedState |