SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat: loading is added in the button (#1927)
Palash Gupta126c9238bad3
diff --git a/frontend/src/container/LogControls/config.ts b/frontend/src/container/LogControls/config.tsnew file mode 100644index 0000000000..7d3b0f71ee--- /dev/null+++ b/frontend/src/container/LogControls/config.ts@@ -0,0 +1 @@+export const ITEMS_PER_PAGE_OPTIONS = [25, 50, 100, 200];diff --git a/frontend/src/container/LogControls/index.tsx b/frontend/src/container/LogControls/index.tsxindex ef8b8819a8..319b9b5f0d 100644--- a/frontend/src/container/LogControls/index.tsx+++ b/frontend/src/container/LogControls/index.tsx@@ -4,7 +4,7 @@ import {RightOutlined,} from '@ant-design/icons';import { Button, Divider, Select } from 'antd';-import React, { memo } from 'react';+import React, { memo, useMemo } from 'react';import { useDispatch, useSelector } from 'react-redux';import { AppState } from 'store/reducers';import {@@ -15,16 +15,19 @@ import {} from 'types/actions/logs';import { ILogsReducer } from 'types/reducer/logs';+import { ITEMS_PER_PAGE_OPTIONS } from './config';import { Container } from './styles';const { Option } = Select;-const ITEMS_PER_PAGE_OPTIONS = [25, 50, 100, 200];-function LogControls(): JSX.Element | null {- const { logLinesPerPage, liveTail } = useSelector<AppState, ILogsReducer>(- (state) => state.logs,- );+ const {+ logLinesPerPage,+ liveTail,+ isLoading: isLogsLoading,+ isLoadingAggregate,+ logs,+ } = useSelector<AppState, ILogsReducer>((state) => state.logs);const dispatch = useDispatch();const handleLogLinesPerPageChange = (e: number): void => {@@ -51,29 +54,58 @@ function LogControls(): JSX.Element | null {});};+ const isLoading = isLogsLoading || isLoadingAggregate;++ const isNextAndPreviousDisabled = useMemo(+ () =>+ isLoading ||+ logLinesPerPage === 0 ||+ logs.length === 0 ||+ logs.length < logLinesPerPage,+ [isLoading, logLinesPerPage, logs.length],+ );+if (liveTail !== 'STOPPED') {return null;}+return (<Container>- <Button size="small" type="link" onClick={handleGoToLatest}>+ <Button+ loading={isLoading}+ size="small"+ type="link"+ onClick={handleGoToLatest}+ ><FastBackwardOutlined /> Go to latest</Button><Divider type="vertical" />- <Button size="small" type="link" onClick={handleNavigatePrevious}>+ <Button+ loading={isLoading}+ size="small"+ type="link"+ disabled={isNextAndPreviousDisabled}+ onClick={handleNavigatePrevious}+ ><LeftOutlined /> Previous</Button>- <Button size="small" type="link" onClick={handleNavigateNext}>+ <Button+ loading={isLoading}+ size="small"+ type="link"+ disabled={isNextAndPreviousDisabled}+ onClick={handleNavigateNext}+ >Next <RightOutlined /></Button><Select- style={{ width: 120 }}+ loading={isLoading}value={logLinesPerPage}onChange={handleLogLinesPerPageChange}>- {ITEMS_PER_PAGE_OPTIONS.map((count) => {- return <Option key={count} value={count}>{`${count} / page`}</Option>;- })}+ {ITEMS_PER_PAGE_OPTIONS.map((count) => (+ <Option key={count} value={count}>{`${count} / page`}</Option>+ ))}</Select></Container>);diff --git a/frontend/src/container/LogsSearchFilter/index.tsx b/frontend/src/container/LogsSearchFilter/index.tsxindex 5b0136627f..5f2c6d482d 100644--- a/frontend/src/container/LogsSearchFilter/index.tsx+++ b/frontend/src/container/LogsSearchFilter/index.tsx@@ -16,7 +16,12 @@ import { getLogs } from 'store/actions/logs/getLogs';import { getLogsAggregate } from 'store/actions/logs/getLogsAggregate';import { AppState } from 'store/reducers';import AppActions from 'types/actions';-import { FLUSH_LOGS, TOGGLE_LIVE_TAIL } from 'types/actions/logs';+import {+ FLUSH_LOGS,+ SET_LOADING,+ SET_LOADING_AGGREGATE,+ TOGGLE_LIVE_TAIL,+} from 'types/actions/logs';import { GlobalReducer } from 'types/reducer/globalTime';import { ILogsReducer } from 'types/reducer/logs';@@ -121,7 +126,17 @@ function SearchFilter({const urlQueryString = urlQuery.get('q');useEffect(() => {+ dispatch({+ type: SET_LOADING,+ payload: true,+ });+ dispatch({+ type: SET_LOADING_AGGREGATE,+ payload: true,+ });+const debouncedHandleSearch = debounce(handleSearch, 600);+debouncedHandleSearch(urlQueryString || '');return (): void => {