Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hooks/useQueryLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getQueryLogs, getQueryResult } from '@/api/query';
import { StatusCodes } from 'http-status-codes';
import useMountedState from './useMountedState';
import { useCallback, useEffect, useRef } from 'react';
import { useLogsStore, logsStoreReducers } from '@/pages/Stream/providers/LogsProvider';
import { useLogsStore, logsStoreReducers, LOAD_LIMIT } from '@/pages/Stream/providers/LogsProvider';
import { useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
import { useQueryResult } from './useQueryResult';
import _ from 'lodash';
Expand Down Expand Up @@ -76,7 +76,7 @@ export const useQueryLogs = () => {
streamName: currentStream || '',
startTime: timeRange.startTime,
endTime: timeRange.endTime,
limit: 9000,
limit: LOAD_LIMIT,
pageOffset: currentOffset,
};
const getQueryData = async (logsQuery: QueryLogs = defaultQueryOpts) => {
Expand Down
10 changes: 5 additions & 5 deletions src/pages/Stream/Views/Explore/StaticLogTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { usePagination } from '@mantine/hooks';
import tableStyles from '../../styles/Logs.module.css';
import { LOGS_PRIMARY_TOOLBAR_HEIGHT, LOGS_SECONDARY_TOOLBAR_HEIGHT, PRIMARY_HEADER_HEIGHT } from '@/constants/theme';
import { HumanizeNumber } from '@/utils/formatBytes';
import { useLogsStore, logsStoreReducers, LOG_QUERY_LIMITS } from '../../providers/LogsProvider';
import { useLogsStore, logsStoreReducers, LOG_QUERY_LIMITS, LOAD_LIMIT } from '../../providers/LogsProvider';
import { useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
import _ from 'lodash';
import IconButton from '@/components/Button/IconButton';
Expand Down Expand Up @@ -200,7 +200,7 @@ const LoadingView = () => {
const Footer = (props: { loaded: boolean }) => {
const [tableOpts, setLogsStore] = useLogsStore((store) => store.tableOpts);
const [filteredData] = useLogsStore((store) => store.data.filteredData);
const { totalPages, currentOffset, currentPage, perPage, headers } = tableOpts;
const { totalPages, currentOffset, currentPage, perPage, headers, totalCount } = tableOpts;
const onPageChange = useCallback((page: number) => {
setLogsStore((store) => setPageAndPageData(store, page));
}, []);
Expand All @@ -209,7 +209,7 @@ const Footer = (props: { loaded: boolean }) => {
const onChangeOffset = useCallback(
(key: 'prev' | 'next') => {
if (key === 'prev') {
const targetOffset = currentOffset - 9000;
const targetOffset = currentOffset - LOAD_LIMIT;
if (currentOffset < 0) return;

if (targetOffset === 0 && currentOffset > 0) {
Expand All @@ -218,7 +218,7 @@ const Footer = (props: { loaded: boolean }) => {
}
setLogsStore((store) => setCurrentOffset(store, targetOffset));
} else {
const targetOffset = currentOffset + 9000;
const targetOffset = currentOffset + LOAD_LIMIT;
setLogsStore((store) => setCurrentOffset(store, targetOffset));
}
},
Expand Down Expand Up @@ -281,7 +281,7 @@ const Footer = (props: { loaded: boolean }) => {
onClick={() => {
onChangeOffset('next');
}}
disabled={false} // do not rmv
disabled={!(currentOffset + LOAD_LIMIT < totalCount)}
/>
</Group>
</Pagination.Root>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Stream/providers/FilterProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { LogStreamSchemaData } from '@/@types/parseable/api/stream';
import { generateRandomId } from '@/utils';
import initContext from '@/utils/initContext';
import { Field, RuleGroupType, RuleType, formatQuery } from 'react-querybuilder';
import { LOAD_LIMIT } from './LogsProvider';

export const textFieldOperators = [
{ value: '=', label: 'equals to' },
Expand Down Expand Up @@ -231,7 +232,7 @@ const toggleSubmitBtn = (_store: FilterStore, val: boolean) => {
const parseQuery = (query: QueryType, currentStream: string) => {
// todo - custom rule processor to prevent converting number strings into numbers for text fields
const where = formatQuery(query, { format: 'sql', parseNumbers: true, quoteFieldNamesWith: ['"', '"'] });
const parsedQuery = `select * from ${currentStream} where ${where} limit 9000`;
const parsedQuery = `select * from ${currentStream} where ${where} limit ${LOAD_LIMIT}`;
return { where, parsedQuery };
};

Expand Down
6 changes: 3 additions & 3 deletions src/pages/Stream/providers/LogsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import _ from 'lodash';
import { sanitizeCSVData } from '@/utils/exportHelpers';

export const DEFAULT_FIXED_DURATIONS = FIXED_DURATIONS[0];
export const LOG_QUERY_LIMITS = [30, 50, 100, 150, 200];
export const LOAD_LIMIT = 9000;
export const LOG_QUERY_LIMITS = [50, 100, 150, 200];
export const LOAD_LIMIT = 1000;

type ReducerOutput = Partial<LogsStore>;

Expand Down Expand Up @@ -280,7 +280,7 @@ const initialState: LogsStore = {
disabledColumns: [],
pinnedColumns: [],
pageData: [],
perPage: 30,
perPage: 50,
totalCount: 0,
displayedCount: 0,
totalPages: 0,
Expand Down