diff --git a/frontend/src/container/GridCardLayout/GridCard/index.tsx b/frontend/src/container/GridCardLayout/GridCard/index.tsx index 976f58b8f0..0f30a189cf 100644 --- a/frontend/src/container/GridCardLayout/GridCard/index.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/index.tsx @@ -14,6 +14,7 @@ import { memo, useEffect, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { UpdateTimeInterval } from 'store/actions'; import { AppState } from 'store/reducers'; +import { DataSource } from 'types/common/queryBuilder'; import { GlobalReducer } from 'types/reducer/globalTime'; import { getGraphType } from 'utils/getGraphType'; import { getSortedSeriesData } from 'utils/getSortedSeriesData'; @@ -113,6 +114,7 @@ function GridCardGraph({ }; } updatedQuery.builder.queryData[0].pageSize = 10; + const initialDataSource = updatedQuery.builder.queryData[0].dataSource; return { query: updatedQuery, graphType: PANEL_TYPES.LIST, @@ -123,6 +125,10 @@ function GridCardGraph({ offset: 0, limit: updatedQuery.builder.queryData[0].limit || 0, }, + selectColumns: + initialDataSource === DataSource.LOGS + ? widget.selectedLogFields + : widget.selectedTracesFields, }, fillGaps: widget.fillSpans, }; diff --git a/frontend/src/container/NewWidget/index.tsx b/frontend/src/container/NewWidget/index.tsx index e03c740ad9..e2324764fd 100644 --- a/frontend/src/container/NewWidget/index.tsx +++ b/frontend/src/container/NewWidget/index.tsx @@ -559,6 +559,29 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element { // eslint-disable-next-line react-hooks/exhaustive-deps }, [onSaveDashboard]); + useEffect(() => { + if (selectedGraph === PANEL_TYPES.LIST) { + const initialDataSource = currentQuery.builder.queryData[0].dataSource; + if (initialDataSource === DataSource.LOGS) { + setRequestData((prev) => ({ + ...prev, + tableParams: { + ...prev.tableParams, + selectColumns: selectedLogFields, + }, + })); + } else if (initialDataSource === DataSource.TRACES) { + setRequestData((prev) => ({ + ...prev, + tableParams: { + ...prev.tableParams, + selectColumns: selectedTracesFields, + }, + })); + } + } + }, [selectedLogFields, selectedTracesFields, currentQuery, selectedGraph]); + return (
diff --git a/frontend/src/container/TracesTableComponent/TracesTableComponent.tsx b/frontend/src/container/TracesTableComponent/TracesTableComponent.tsx index 2f5a82ca7d..17cc675f39 100644 --- a/frontend/src/container/TracesTableComponent/TracesTableComponent.tsx +++ b/frontend/src/container/TracesTableComponent/TracesTableComponent.tsx @@ -43,6 +43,7 @@ function TracesTableComponent({ setRequestData((prev) => ({ ...prev, tableParams: { + ...prev.tableParams, pagination, }, }));