feat: modified resize table component (#2175)

* fix: Removed Strict mode to stop render twice

* feat: modified resize table component
This commit is contained in:
Chintan Sudani 2023-02-03 18:06:26 +05:30 committed by GitHub
parent 152846f554
commit 62b2462e03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 164 additions and 267 deletions

View File

@ -1,12 +1,14 @@
import { Table } from 'antd';
import type { TableProps } from 'antd/es/table';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState } from 'react';
import { ResizeCallbackData } from 'react-resizable'; import { ResizeCallbackData } from 'react-resizable';
function ResizeTableWrapper({ import ResizableHeader from './ResizableHeader';
children,
columns, // eslint-disable-next-line @typescript-eslint/no-explicit-any
}: ResizeTableWrapperProps): JSX.Element { function ResizeTable({ columns, ...restprops }: TableProps<any>): JSX.Element {
const [columnsData, setColumns] = useState<ColumnsType>(columns); const [columnsData, setColumns] = useState<ColumnsType>(columns || []);
const handleResize = useCallback( const handleResize = useCallback(
(index: number) => ( (index: number) => (
@ -35,13 +37,15 @@ function ResizeTableWrapper({
[columnsData, handleResize], [columnsData, handleResize],
); );
return <> {React.cloneElement(children, { columns: mergeColumns })}</>; return (
<Table
// eslint-disable-next-line react/jsx-props-no-spreading
{...restprops}
components={{ header: { cell: ResizableHeader } }}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
columns={mergeColumns as ColumnsType<any>}
/>
);
} }
interface ResizeTableWrapperProps { export default ResizeTable;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
columns: ColumnsType<any>;
children: JSX.Element;
}
export default ResizeTableWrapper;

View File

@ -0,0 +1,4 @@
import ResizableHeader from './ResizableHeader';
import ResizeTable from './ResizeTable';
export { ResizableHeader, ResizeTable };

View File

@ -1,4 +0,0 @@
import ResizableHeader from './ResizableHeader';
import ResizeTableWrapper from './ResizeTableWrapper';
export { ResizableHeader, ResizeTableWrapper };

View File

@ -1,10 +1,7 @@
/* eslint-disable react/display-name */ /* eslint-disable react/display-name */
import { Button, notification, Table } from 'antd'; import { Button, notification } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import useComponentPermission from 'hooks/useComponentPermission'; import useComponentPermission from 'hooks/useComponentPermission';
import history from 'lib/history'; import history from 'lib/history';
@ -69,13 +66,7 @@ function AlertChannels({ allChannels }: AlertChannelsProps): JSX.Element {
return ( return (
<> <>
{Element} {Element}
<ResizeTableWrapper columns={columns}> <ResizeTable columns={columns} dataSource={channels} rowKey="id" />
<Table
components={{ header: { cell: ResizableHeader } }}
dataSource={channels}
rowKey="id"
/>
</ResizeTableWrapper>
</> </>
); );
} }

View File

@ -5,7 +5,6 @@ import {
Input, Input,
notification, notification,
Space, Space,
Table,
TableProps, TableProps,
Tooltip, Tooltip,
Typography, Typography,
@ -16,10 +15,7 @@ import { ColumnsType } from 'antd/lib/table';
import { FilterConfirmProps } from 'antd/lib/table/interface'; import { FilterConfirmProps } from 'antd/lib/table/interface';
import getAll from 'api/errors/getAll'; import getAll from 'api/errors/getAll';
import getErrorCounts from 'api/errors/getErrorCounts'; import getErrorCounts from 'api/errors/getErrorCounts';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import useUrlQuery from 'hooks/useUrlQuery'; import useUrlQuery from 'hooks/useUrlQuery';
@ -392,23 +388,21 @@ function AllErrors(): JSX.Element {
return ( return (
<> <>
{NotificationElement} {NotificationElement}
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
tableLayout="fixed" tableLayout="fixed"
dataSource={data?.payload as Exception[]} dataSource={data?.payload as Exception[]}
components={{ header: { cell: ResizableHeader } }} rowKey="firstSeen"
rowKey="firstSeen" loading={isLoading || false || errorCountResponse.status === 'loading'}
loading={isLoading || false || errorCountResponse.status === 'loading'} pagination={{
pagination={{ pageSize: getUpdatedPageSize,
pageSize: getUpdatedPageSize, responsive: true,
responsive: true, current: getUpdatedOffset / 10 + 1,
current: getUpdatedOffset / 10 + 1, position: ['bottomLeft'],
position: ['bottomLeft'], total: errorCountResponse.data?.payload || 0,
total: errorCountResponse.data?.payload || 0, }}
}} onChange={onChangeHandler}
onChange={onChangeHandler} />
/>
</ResizeTableWrapper>
</> </>
); );
} }

View File

@ -1,10 +1,7 @@
import { Button, Divider, notification, Space, Table, Typography } from 'antd'; import { Button, Divider, notification, Space, Typography } from 'antd';
import getNextPrevId from 'api/errors/getNextPrevId'; import getNextPrevId from 'api/errors/getNextPrevId';
import Editor from 'components/Editor'; import Editor from 'components/Editor';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import { getNanoSeconds } from 'container/AllError/utils'; import { getNanoSeconds } from 'container/AllError/utils';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import history from 'lib/history'; import history from 'lib/history';
@ -176,13 +173,7 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
<EditorContainer> <EditorContainer>
<Space direction="vertical"> <Space direction="vertical">
<ResizeTableWrapper columns={columns}> <ResizeTable columns={columns} tableLayout="fixed" dataSource={data} />
<Table
components={{ header: { cell: ResizableHeader } }}
tableLayout="fixed"
dataSource={data}
/>
</ResizeTableWrapper>
</Space> </Space>
</EditorContainer> </EditorContainer>
</> </>

View File

@ -1,9 +1,5 @@
import { Table } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { License } from 'types/api/licenses/def'; import { License } from 'types/api/licenses/def';
@ -39,15 +35,7 @@ function ListLicenses({ licenses }: ListLicensesProps): JSX.Element {
}, },
]; ];
return ( return <ResizeTable columns={columns} rowKey="id" dataSource={licenses} />;
<ResizeTableWrapper columns={columns}>
<Table
rowKey="id"
dataSource={licenses}
components={{ header: { cell: ResizableHeader } }}
/>
</ResizeTableWrapper>
);
} }
interface ListLicensesProps { interface ListLicensesProps {

View File

@ -1,11 +1,8 @@
/* eslint-disable react/display-name */ /* eslint-disable react/display-name */
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { notification, Table, Typography } from 'antd'; import { notification, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import TextToolTip from 'components/TextToolTip'; import TextToolTip from 'components/TextToolTip';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import useComponentPermission from 'hooks/useComponentPermission'; import useComponentPermission from 'hooks/useComponentPermission';
@ -172,13 +169,7 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
</Button> </Button>
)} )}
</ButtonContainer> </ButtonContainer>
<ResizeTableWrapper columns={columns}> <ResizeTable columns={columns} rowKey="id" dataSource={data} />
<Table
rowKey="id"
components={{ header: { cell: ResizableHeader } }}
dataSource={data}
/>
</ResizeTableWrapper>
</> </>
); );
} }

View File

@ -1,19 +1,8 @@
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { import { Card, Dropdown, Menu, Row, TableColumnProps, Typography } from 'antd';
Card,
Dropdown,
Menu,
Row,
Table,
TableColumnProps,
Typography,
} from 'antd';
import createDashboard from 'api/dashboard/create'; import createDashboard from 'api/dashboard/create';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import TextToolTip from 'components/TextToolTip'; import TextToolTip from 'components/TextToolTip';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import SearchFilter from 'container/ListOfDashboard/SearchFilter'; import SearchFilter from 'container/ListOfDashboard/SearchFilter';
@ -281,21 +270,19 @@ function ListOfAllDashboard(): JSX.Element {
uploadedGrafana={uploadedGrafana} uploadedGrafana={uploadedGrafana}
onModalHandler={(): void => onModalHandler(false)} onModalHandler={(): void => onModalHandler(false)}
/> />
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
pagination={{ pagination={{
pageSize: 9, pageSize: 9,
defaultPageSize: 9, defaultPageSize: 9,
}} }}
showHeader showHeader
bordered bordered
sticky sticky
loading={loading} loading={loading}
components={{ header: { cell: ResizableHeader } }} dataSource={data}
dataSource={data} showSorterTooltip
showSorterTooltip />
/>
</ResizeTableWrapper>
</TableContainer> </TableContainer>
</Card> </Card>
); );

View File

@ -1,11 +1,8 @@
import { blue, orange } from '@ant-design/colors'; import { blue, orange } from '@ant-design/colors';
import { Input, Table } from 'antd'; import { Input } from 'antd';
import AddToQueryHOC from 'components/Logs/AddToQueryHOC'; import AddToQueryHOC from 'components/Logs/AddToQueryHOC';
import CopyClipboardHOC from 'components/Logs/CopyClipboardHOC'; import CopyClipboardHOC from 'components/Logs/CopyClipboardHOC';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import flatten from 'flat'; import flatten from 'flat';
import { fieldSearchFilter } from 'lib/logs/fieldSearch'; import { fieldSearchFilter } from 'lib/logs/fieldSearch';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
@ -97,15 +94,12 @@ function TableView({ logData }: TableViewProps): JSX.Element | null {
value={fieldSearchInput} value={fieldSearchInput}
onChange={(e): void => setFieldSearchInput(e.target.value)} onChange={(e): void => setFieldSearchInput(e.target.value)}
/> />
<ResizeTableWrapper columns={columns as never}> <ResizeTable
<Table columns={columns as never}
// scroll={{ x: true }} tableLayout="fixed"
tableLayout="fixed" dataSource={dataSource}
dataSource={dataSource} pagination={false}
components={{ header: { cell: ResizableHeader } }} />
pagination={false}
/>
</ResizeTableWrapper>
</div> </div>
); );
} }

View File

@ -1,9 +1,6 @@
import { Table, Tooltip, Typography } from 'antd'; import { Tooltip, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import { METRICS_PAGE_QUERY_PARAM } from 'constants/query'; import { METRICS_PAGE_QUERY_PARAM } from 'constants/query';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import history from 'lib/history'; import history from 'lib/history';
@ -99,16 +96,14 @@ function TopOperationsTable(props: TopOperationsTableProps): JSX.Element {
]; ];
return ( return (
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
showHeader showHeader
title={(): string => 'Key Operations'} title={(): string => 'Key Operations'}
tableLayout="fixed" tableLayout="fixed"
dataSource={data} dataSource={data}
components={{ header: { cell: ResizableHeader } }} rowKey="name"
rowKey="name" />
/>
</ResizeTableWrapper>
); );
} }

View File

@ -1,6 +1,6 @@
import { blue } from '@ant-design/colors'; import { blue } from '@ant-design/colors';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import { Button, Card, Input, Space, Table } from 'antd'; import { Button, Card, Input, Space } from 'antd';
import type { ColumnsType, ColumnType } from 'antd/es/table'; import type { ColumnsType, ColumnType } from 'antd/es/table';
import type { import type {
FilterConfirmProps, FilterConfirmProps,
@ -8,10 +8,7 @@ import type {
} from 'antd/es/table/interface'; } from 'antd/es/table/interface';
import localStorageGet from 'api/browser/localstorage/get'; import localStorageGet from 'api/browser/localstorage/get';
import localStorageSet from 'api/browser/localstorage/set'; import localStorageSet from 'api/browser/localstorage/set';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import { SKIP_ONBOARDING } from 'constants/onboarding'; import { SKIP_ONBOARDING } from 'constants/onboarding';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState } from 'react';
@ -149,14 +146,12 @@ function Metrics(): JSX.Element {
return ( return (
<Container> <Container>
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
loading={loading} loading={loading}
dataSource={services} dataSource={services}
components={{ header: { cell: ResizableHeader } }} rowKey="serviceName"
rowKey="serviceName" />
/>
</ResizeTableWrapper>
</Container> </Container>
); );
} }

View File

@ -1,11 +1,8 @@
import { blue, red } from '@ant-design/colors'; import { blue, red } from '@ant-design/colors';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { Button, Modal, notification, Row, Space, Table, Tag } from 'antd'; import { Button, Modal, notification, Row, Space, Tag } from 'antd';
import { NotificationInstance } from 'antd/es/notification/interface'; import { NotificationInstance } from 'antd/es/notification/interface';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
import { connect, useSelector } from 'react-redux'; import { connect, useSelector } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux'; import { bindActionCreators, Dispatch } from 'redux';
@ -168,12 +165,7 @@ function VariablesSetting({
<PlusOutlined /> New Variables <PlusOutlined /> New Variables
</Button> </Button>
</Row> </Row>
<ResizeTableWrapper columns={columns}> <ResizeTable columns={columns} dataSource={variablesTableData} />
<Table
components={{ header: { cell: ResizableHeader } }}
dataSource={variablesTableData}
/>
</ResizeTableWrapper>
</> </>
)} )}
<Modal <Modal

View File

@ -1,13 +1,10 @@
import { LockTwoTone } from '@ant-design/icons'; import { LockTwoTone } from '@ant-design/icons';
import { Button, Modal, notification, Space, Table, Typography } from 'antd'; import { Button, Modal, notification, Space, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import deleteDomain from 'api/SAML/deleteDomain'; import deleteDomain from 'api/SAML/deleteDomain';
import listAllDomain from 'api/SAML/listAllDomain'; import listAllDomain from 'api/SAML/listAllDomain';
import updateDomain from 'api/SAML/updateDomain'; import updateDomain from 'api/SAML/updateDomain';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import TextToolTip from 'components/TextToolTip'; import TextToolTip from 'components/TextToolTip';
import { SIGNOZ_UPGRADE_PLAN_URL } from 'constants/app'; import { SIGNOZ_UPGRADE_PLAN_URL } from 'constants/app';
import { FeatureKeys } from 'constants/featureKeys'; import { FeatureKeys } from 'constants/featureKeys';
@ -275,14 +272,12 @@ function AuthDomains(): JSX.Element {
setIsSettingsOpen={setIsSettingsOpen} setIsSettingsOpen={setIsSettingsOpen}
/> />
</Modal> </Modal>
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
rowKey={(record: AuthDomain): string => record.name + v4()} rowKey={(record: AuthDomain): string => record.name + v4()}
dataSource={!SSOFlag ? notEntripriseData : []} dataSource={!SSOFlag ? notEntripriseData : []}
components={{ header: { cell: ResizableHeader } }} tableLayout="fixed"
tableLayout="fixed" />
/>
</ResizeTableWrapper>
</Space> </Space>
); );
} }
@ -327,15 +322,13 @@ function AuthDomains(): JSX.Element {
<Space direction="vertical" size="middle"> <Space direction="vertical" size="middle">
<AddDomain refetch={refetch} /> <AddDomain refetch={refetch} />
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
dataSource={tableData} dataSource={tableData}
loading={isLoading} loading={isLoading}
components={{ header: { cell: ResizableHeader } }} tableLayout="fixed"
tableLayout="fixed" rowKey={(record: AuthDomain): string => record.name + v4()}
rowKey={(record: AuthDomain): string => record.name + v4()} />
/>
</ResizeTableWrapper>
</Space> </Space>
</> </>
); );

View File

@ -1,13 +1,10 @@
import { Button, Modal, notification, Space, Table, Typography } from 'antd'; import { Button, Modal, notification, Space, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import deleteUser from 'api/user/deleteUser'; import deleteUser from 'api/user/deleteUser';
import editUserApi from 'api/user/editUser'; import editUserApi from 'api/user/editUser';
import getOrgUser from 'api/user/getOrgUser'; import getOrgUser from 'api/user/getOrgUser';
import updateRole from 'api/user/updateRole'; import updateRole from 'api/user/updateRole';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -312,15 +309,13 @@ function Members(): JSX.Element {
return ( return (
<Space direction="vertical" size="middle"> <Space direction="vertical" size="middle">
<Typography.Title level={3}>Members</Typography.Title> <Typography.Title level={3}>Members</Typography.Title>
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
tableLayout="fixed" tableLayout="fixed"
dataSource={dataSource} dataSource={dataSource}
components={{ header: { cell: ResizableHeader } }} pagination={false}
pagination={false} loading={status === 'loading'}
loading={status === 'loading'} />
/>
</ResizeTableWrapper>
</Space> </Space>
); );
} }

View File

@ -1,13 +1,10 @@
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { Button, Modal, notification, Space, Table, Typography } from 'antd'; import { Button, Modal, notification, Space, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import deleteInvite from 'api/user/deleteInvite'; import deleteInvite from 'api/user/deleteInvite';
import getPendingInvites from 'api/user/getPendingInvites'; import getPendingInvites from 'api/user/getPendingInvites';
import sendInvite from 'api/user/sendInvite'; import sendInvite from 'api/user/sendInvite';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import { INVITE_MEMBERS_HASH } from 'constants/app'; import { INVITE_MEMBERS_HASH } from 'constants/app';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
@ -272,15 +269,13 @@ function PendingInvitesContainer(): JSX.Element {
{t('invite_members')} {t('invite_members')}
</Button> </Button>
</TitleWrapper> </TitleWrapper>
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
tableLayout="fixed" tableLayout="fixed"
dataSource={dataSource} dataSource={dataSource}
components={{ header: { cell: ResizableHeader } }} pagination={false}
pagination={false} loading={getPendingInvitesResponse.status === 'loading'}
loading={getPendingInvitesResponse.status === 'loading'} />
/>
</ResizeTableWrapper>
</Space> </Space>
</div> </div>
); );

View File

@ -1,9 +1,6 @@
import { Table, TableProps, Tag, Typography } from 'antd'; import { TableProps, Tag, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import { import {
getSpanOrder, getSpanOrder,
@ -190,36 +187,36 @@ function TraceTable(): JSX.Element {
) as number; ) as number;
return ( return (
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
onChange={onChangeHandler} onChange={onChangeHandler}
dataSource={spansAggregate.data} dataSource={spansAggregate.data}
loading={loading || filterLoading} loading={loading || filterLoading}
components={{ header: { cell: ResizableHeader } }} rowKey={(record: { traceID: string; spanID: string }): string =>
rowKey={(record): string => `${record.traceID}-${record.spanID}-${v4()}`} `${record.traceID}-${record.spanID}-${v4()}`
style={{ }
cursor: 'pointer', style={{
}} cursor: 'pointer',
onRow={(record): React.HTMLAttributes<TableType> => ({ }}
onClick: (event): void => { onRow={(record: TableType): React.HTMLAttributes<TableType> => ({
event.preventDefault(); onClick: (event): void => {
event.stopPropagation(); event.preventDefault();
if (event.metaKey || event.ctrlKey) { event.stopPropagation();
window.open(getLink(record), '_blank'); if (event.metaKey || event.ctrlKey) {
} else { window.open(getLink(record), '_blank');
history.push(getLink(record)); } else {
} history.push(getLink(record));
}, }
})} },
pagination={{ })}
current: spansAggregate.currentPage, pagination={{
pageSize: spansAggregate.pageSize, current: spansAggregate.currentPage,
responsive: true, pageSize: spansAggregate.pageSize,
position: ['bottomLeft'], responsive: true,
total: totalCount, position: ['bottomLeft'],
}} total: totalCount,
/> }}
</ResizeTableWrapper> />
); );
} }

View File

@ -1,10 +1,7 @@
/* eslint-disable react/display-name */ /* eslint-disable react/display-name */
import { Table, Tag, Typography } from 'antd'; import { Tag, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { import { ResizeTable } from 'components/ResizeTable';
ResizableHeader,
ResizeTableWrapper,
} from 'components/ResizeTableWrapper';
import AlertStatus from 'container/TriggeredAlerts/TableComponents/AlertStatus'; import AlertStatus from 'container/TriggeredAlerts/TableComponents/AlertStatus';
import convertDateToAmAndPm from 'lib/convertDateToAmAndPm'; import convertDateToAmAndPm from 'lib/convertDateToAmAndPm';
import getFormattedDate from 'lib/getFormatedDate'; import getFormattedDate from 'lib/getFormatedDate';
@ -103,13 +100,11 @@ function NoFilterTable({
]; ];
return ( return (
<ResizeTableWrapper columns={columns}> <ResizeTable
<Table columns={columns}
rowKey="startsAt" rowKey="startsAt"
dataSource={filteredAlerts} dataSource={filteredAlerts}
components={{ header: { cell: ResizableHeader } }} />
/>
</ResizeTableWrapper>
); );
} }