Skip to content

Commit

Permalink
remove sort field
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Nov 1, 2024
1 parent 6c92b96 commit 4fab8e8
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions ui/app/mirrors/[mirrorId]/syncStatusTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import SelectTheme from '@/app/styles/select';
import TimeLabel from '@/components/TimeComponent';
import {
CDCBatch,
Expand All @@ -14,7 +13,6 @@ import { ProgressCircle } from '@/lib/ProgressCircle';
import { Table, TableCell, TableRow } from '@/lib/Table';
import moment from 'moment';
import { useCallback, useEffect, useState } from 'react';
import ReactSelect from 'react-select';
import { RowDataFormatter } from './rowsDisplay';

type SyncStatusTableProps = { mirrorName: string };
Expand Down Expand Up @@ -47,18 +45,7 @@ function TimeWithDurationOrRunning({
}

const ROWS_PER_PAGE = 5;
const sortOptions = [
{ value: 'batchId', label: 'Batch ID' },
{ value: 'startTime', label: 'Start Time' },
{ value: 'endTime', label: 'End Time' },
{ value: 'numRows', label: 'Rows Synced' },
];

export const SyncStatusTable = ({ mirrorName }: SyncStatusTableProps) => {
const [sortField, setSortField] = useState<
'startTime' | 'endTime' | 'numRows' | 'batchId'
>('batchId');

const [totalPages, setTotalPages] = useState(1);
const [currentPage, setCurrentPage] = useState(1);
const [ascending, setAscending] = useState(false);
Expand All @@ -70,7 +57,6 @@ export const SyncStatusTable = ({ mirrorName }: SyncStatusTableProps) => {
const req: GetCDCBatchesRequest = {
flowJobName: mirrorName,
limit: ROWS_PER_PAGE,
// TODO sortField
beforeId: beforeId,
afterId: afterId,
ascending,
Expand All @@ -90,7 +76,7 @@ export const SyncStatusTable = ({ mirrorName }: SyncStatusTableProps) => {
};

fetchData();
}, [mirrorName, sortField, beforeId, afterId]);
}, [mirrorName, beforeId, afterId]);

Check warning on line 79 in ui/app/mirrors/[mirrorId]/syncStatusTable.tsx

View workflow job for this annotation

GitHub Actions / ESLint

ui/app/mirrors/[mirrorId]/syncStatusTable.tsx#L79

React Hook useEffect has a missing dependency: 'ascending'. Either include it or remove the dependency array (react-hooks/exhaustive-deps)

const nextPage = useCallback(() => {
if (batches.length === 0) {
Expand Down Expand Up @@ -130,27 +116,6 @@ export const SyncStatusTable = ({ mirrorName }: SyncStatusTableProps) => {
>
<Icon name='refresh' />
</Button>
<div style={{ minWidth: '10em' }}>
<ReactSelect
options={sortOptions}
value={{
value: sortField,
label: sortOptions.find((opt) => opt.value === sortField)
?.label,
}}
onChange={(val, _) => {
const sortVal =
(val?.value as
| 'startTime'
| 'endTime'
| 'numRows'
| 'batchId') ?? 'batchId';
setSortField(sortVal);
}}
defaultValue={{ value: 'batchId', label: 'Batch ID' }}
theme={SelectTheme}
/>
</div>
<button
className='IconButton'
onClick={() => {
Expand Down

0 comments on commit 4fab8e8

Please sign in to comment.