mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-05 11:00:40 +08:00

* feat: create live logs page and custom top nav * feat: add live logs where clause * fix: success button color * fix: turn back color * fix: undefined scenario * feat: get live data * fix: change color, change number format * feat: add live logs list * feat: hide view if error, clear logs * feat: add condition for disable initial loading * fix: double request * fix: render id in the where clause * fix: render where clause and live list * fix: last log padding * fix: list data loading * fix: no logs text * fix: logs list size * fix: small issues * feat: use prefetched query in live * chore: useMemo is updated * feat: add live logs list (#3341) * feat: add live logs list * feat: hide view if error, clear logs * feat: add condition for disable initial loading * fix: double request * fix: render id in the where clause * fix: render where clause and live list * fix: last log padding * fix: list data loading * fix: no logs text * fix: logs list size * fix: small issues * fix: render view with memo --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * chore: alignment is updated * fix: action column size --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com>
71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
import { LIVE_TAIL_GRAPH_INTERVAL } from 'constants/liveTail';
|
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
|
import LogsExplorerChart from 'container/LogsExplorerChart';
|
|
import { useGetExplorerQueryRange } from 'hooks/queryBuilder/useGetExplorerQueryRange';
|
|
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
|
import { useEventSource } from 'providers/EventSource';
|
|
import { useMemo } from 'react';
|
|
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
|
import { QueryData } from 'types/api/widgets/getQuery';
|
|
import { DataSource, LogsAggregatorOperator } from 'types/common/queryBuilder';
|
|
|
|
import { LiveLogsListChartProps } from './types';
|
|
|
|
function LiveLogsListChart({
|
|
className,
|
|
initialData,
|
|
}: LiveLogsListChartProps): JSX.Element {
|
|
const { stagedQuery } = useQueryBuilder();
|
|
const { isConnectionOpen } = useEventSource();
|
|
|
|
const listChartQuery: Query | null = useMemo(() => {
|
|
if (!stagedQuery) return null;
|
|
|
|
return {
|
|
...stagedQuery,
|
|
builder: {
|
|
...stagedQuery.builder,
|
|
queryData: stagedQuery.builder.queryData.map((item) => ({
|
|
...item,
|
|
disabled: false,
|
|
aggregateOperator: LogsAggregatorOperator.COUNT,
|
|
filters: {
|
|
...item.filters,
|
|
items: item.filters.items.filter((item) => item.key?.key !== 'id'),
|
|
},
|
|
})),
|
|
},
|
|
};
|
|
}, [stagedQuery]);
|
|
|
|
const { data, isFetching } = useGetExplorerQueryRange(
|
|
listChartQuery,
|
|
PANEL_TYPES.TIME_SERIES,
|
|
{
|
|
enabled: isConnectionOpen,
|
|
refetchInterval: LIVE_TAIL_GRAPH_INTERVAL,
|
|
keepPreviousData: true,
|
|
},
|
|
{ dataSource: DataSource.LOGS },
|
|
);
|
|
|
|
const chartData: QueryData[] = useMemo(() => {
|
|
if (initialData) return initialData;
|
|
|
|
if (!data) return [];
|
|
|
|
return data.payload.data.result;
|
|
}, [data, initialData]);
|
|
|
|
return (
|
|
<LogsExplorerChart
|
|
isLoading={initialData ? false : isFetching}
|
|
data={chartData}
|
|
isLabelEnabled={false}
|
|
className={className}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export default LiveLogsListChart;
|