diff --git a/frontend/src/container/NewWidget/index.tsx b/frontend/src/container/NewWidget/index.tsx
index 4c37252a54..399ab16f19 100644
--- a/frontend/src/container/NewWidget/index.tsx
+++ b/frontend/src/container/NewWidget/index.tsx
@@ -74,6 +74,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
setToScrollWidgetId,
selectedRowWidgetId,
setSelectedRowWidgetId,
+ columnWidths,
} = useDashboard();
const { t } = useTranslation(['dashboard']);
@@ -238,8 +239,10 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
selectedLogFields,
selectedTracesFields,
isLogScale,
+ columnWidths: columnWidths?.[selectedWidget?.id],
};
});
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [
columnUnits,
currentQuery,
@@ -260,6 +263,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
combineHistogram,
stackedBarChart,
isLogScale,
+ columnWidths,
]);
const closeModal = (): void => {
diff --git a/frontend/src/container/PanelWrapper/TablePanelWrapper.tsx b/frontend/src/container/PanelWrapper/TablePanelWrapper.tsx
index 58ddaef5a8..88da74fc6b 100644
--- a/frontend/src/container/PanelWrapper/TablePanelWrapper.tsx
+++ b/frontend/src/container/PanelWrapper/TablePanelWrapper.tsx
@@ -26,6 +26,7 @@ function TablePanelWrapper({
searchTerm={searchTerm}
openTracesButton={openTracesButton}
onOpenTraceBtnClick={onOpenTraceBtnClick}
+ widgetId={widget.id}
// eslint-disable-next-line react/jsx-props-no-spreading
{...GRID_TABLE_CONFIG}
/>
diff --git a/frontend/src/container/PanelWrapper/__tests__/__snapshots__/TablePanelWrapper.test.tsx.snap b/frontend/src/container/PanelWrapper/__tests__/__snapshots__/TablePanelWrapper.test.tsx.snap
index 0f1a725125..0c77a340a4 100644
--- a/frontend/src/container/PanelWrapper/__tests__/__snapshots__/TablePanelWrapper.test.tsx.snap
+++ b/frontend/src/container/PanelWrapper/__tests__/__snapshots__/TablePanelWrapper.test.tsx.snap
@@ -9,6 +9,8 @@ exports[`Table panel wrappper tests table should render fine with the query resp
width: 0.625rem;
height: 100%;
cursor: col-resize;
+ margin-left: 4px;
+ margin-right: 4px;
}
.c0 {
@@ -54,7 +56,7 @@ exports[`Table panel wrappper tests table should render fine with the query resp
class="query-table"
>
@@ -143,12 +145,12 @@ exports[`Table panel wrappper tests table should render fine with the query resp
|
@@ -209,7 +211,7 @@ exports[`Table panel wrappper tests table should render fine with the query resp
|
@@ -221,7 +223,7 @@ exports[`Table panel wrappper tests table should render fine with the query resp
style="overflow-x: auto; overflow-y: hidden;"
>
['sticky'];
searchTerm?: string;
+ widgetId?: string;
};
diff --git a/frontend/src/container/QueryTable/QueryTable.tsx b/frontend/src/container/QueryTable/QueryTable.tsx
index e438070173..16376eb040 100644
--- a/frontend/src/container/QueryTable/QueryTable.tsx
+++ b/frontend/src/container/QueryTable/QueryTable.tsx
@@ -24,6 +24,7 @@ export function QueryTable({
dataSource,
sticky,
searchTerm,
+ widgetId,
...props
}: QueryTableProps): JSX.Element {
const { isDownloadEnabled = false, fileName = '' } = downloadOption || {};
@@ -95,8 +96,10 @@ export function QueryTable({
columns={tableColumns}
tableLayout="fixed"
dataSource={filterTable === null ? newDataSource : filterTable}
- scroll={{ x: true }}
+ scroll={{ x: 'max-content' }}
pagination={paginationConfig}
+ widgetId={widgetId}
+ shouldPersistColumnWidths
sticky={sticky}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
diff --git a/frontend/src/container/TracesTableComponent/TracesTableComponent.tsx b/frontend/src/container/TracesTableComponent/TracesTableComponent.tsx
index 182aa1d881..f71ddc0fd9 100644
--- a/frontend/src/container/TracesTableComponent/TracesTableComponent.tsx
+++ b/frontend/src/container/TracesTableComponent/TracesTableComponent.tsx
@@ -1,7 +1,7 @@
import './TracesTableComponent.styles.scss';
-import { Table } from 'antd';
import OverlayScrollbar from 'components/OverlayScrollbar/OverlayScrollbar';
+import { ResizeTable } from 'components/ResizeTable';
import { SOMETHING_WENT_WRONG } from 'constants/api';
import Controls from 'container/Controls';
import { PER_PAGE_OPTIONS } from 'container/TracesExplorer/ListView/configs';
@@ -54,9 +54,14 @@ function TracesTableComponent({
const { formatTimezoneAdjustedTimestamp } = useTimezone();
- const columns = getListColumns(
- widget.selectedTracesFields || [],
- formatTimezoneAdjustedTimestamp,
+ const columns = useMemo(
+ () =>
+ getListColumns(
+ widget.selectedTracesFields || [],
+ formatTimezoneAdjustedTimestamp,
+ ),
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [widget.selectedTracesFields],
);
const dataLength =
@@ -116,16 +121,18 @@ function TracesTableComponent({
diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsx
index f2699ad76c..4fa7c3be4b 100644
--- a/frontend/src/providers/Dashboard/Dashboard.tsx
+++ b/frontend/src/providers/Dashboard/Dashboard.tsx
@@ -40,7 +40,11 @@ import { Dashboard, IDashboardVariable } from 'types/api/dashboard/getAll';
import { GlobalReducer } from 'types/reducer/globalTime';
import { v4 as generateUUID } from 'uuid';
-import { DashboardSortOrder, IDashboardContext } from './types';
+import {
+ DashboardSortOrder,
+ IDashboardContext,
+ WidgetColumnWidths,
+} from './types';
import { sortLayout } from './util';
const DashboardContext = createContext
({
@@ -74,6 +78,8 @@ const DashboardContext = createContext({
selectedRowWidgetId: '',
setSelectedRowWidgetId: () => {},
isDashboardFetching: false,
+ columnWidths: {},
+ setColumnWidths: () => {},
});
interface Props {
@@ -408,6 +414,8 @@ export function DashboardProvider({
}
};
+ const [columnWidths, setColumnWidths] = useState({});
+
const value: IDashboardContext = useMemo(
() => ({
toScrollWidgetId,
@@ -435,6 +443,8 @@ export function DashboardProvider({
selectedRowWidgetId,
setSelectedRowWidgetId,
isDashboardFetching,
+ columnWidths,
+ setColumnWidths,
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[
@@ -457,6 +467,8 @@ export function DashboardProvider({
selectedRowWidgetId,
setSelectedRowWidgetId,
isDashboardFetching,
+ columnWidths,
+ setColumnWidths,
],
);
diff --git a/frontend/src/providers/Dashboard/types.ts b/frontend/src/providers/Dashboard/types.ts
index c5e5cbca14..13ab53f8e8 100644
--- a/frontend/src/providers/Dashboard/types.ts
+++ b/frontend/src/providers/Dashboard/types.ts
@@ -10,6 +10,10 @@ export interface DashboardSortOrder {
search: string;
}
+export type WidgetColumnWidths = {
+ [widgetId: string]: Record;
+};
+
export interface IDashboardContext {
isDashboardSliderOpen: boolean;
isDashboardLocked: boolean;
@@ -48,4 +52,6 @@ export interface IDashboardContext {
selectedRowWidgetId: string | null;
setSelectedRowWidgetId: React.Dispatch>;
isDashboardFetching: boolean;
+ columnWidths: WidgetColumnWidths;
+ setColumnWidths: React.Dispatch>;
}
diff --git a/frontend/src/types/api/dashboard/getAll.ts b/frontend/src/types/api/dashboard/getAll.ts
index 8cfd6f7f9a..d531338eae 100644
--- a/frontend/src/types/api/dashboard/getAll.ts
+++ b/frontend/src/types/api/dashboard/getAll.ts
@@ -109,6 +109,7 @@ export interface IBaseWidget {
selectedLogFields: IField[] | null;
selectedTracesFields: BaseAutocompleteData[] | null;
isLogScale?: boolean;
+ columnWidths?: Record;
}
export interface Widgets extends IBaseWidget {
query: Query;