mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
PR comments
This commit is contained in:
parent
a5094b1fc0
commit
fb2005a2df
@ -9,7 +9,7 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
TableSearch,
|
TableSearch,
|
||||||
} from 'component/common/Table';
|
} from 'component/common/Table';
|
||||||
import { useFlexLayout, useSortBy, useTable } from 'react-table';
|
import {SortingRule, useFlexLayout, useSortBy, useTable} from 'react-table';
|
||||||
import { SearchHighlightProvider } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext';
|
import { SearchHighlightProvider } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext';
|
||||||
import { useMediaQuery } from '@mui/material';
|
import { useMediaQuery } from '@mui/material';
|
||||||
import { sortTypes } from 'utils/sortTypes';
|
import { sortTypes } from 'utils/sortTypes';
|
||||||
@ -32,16 +32,17 @@ import { formatUnknownError } from 'utils/formatUnknownError';
|
|||||||
import { useSearch } from 'hooks/useSearch';
|
import { useSearch } from 'hooks/useSearch';
|
||||||
import { FeatureArchivedCell } from '../../common/Table/cells/FeatureArchivedCell/FeatureArchivedCell';
|
import { FeatureArchivedCell } from '../../common/Table/cells/FeatureArchivedCell/FeatureArchivedCell';
|
||||||
import { useVirtualizedRange } from 'hooks/useVirtualizedRange';
|
import { useVirtualizedRange } from 'hooks/useVirtualizedRange';
|
||||||
|
import { URLSearchParamsInit } from 'react-router-dom';
|
||||||
|
|
||||||
export interface IFeaturesArchiveTableProps {
|
export interface IFeaturesArchiveTableProps {
|
||||||
archivedFeatures: FeatureSchema[];
|
archivedFeatures: FeatureSchema[];
|
||||||
title: string;
|
title: string;
|
||||||
refetch: any;
|
refetch: () => void;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
storedParams: any;
|
storedParams: SortingRule<string>;
|
||||||
setStoredParams: any;
|
setStoredParams: (newValue: (SortingRule<string> | ((prev: SortingRule<string>) => SortingRule<string>))) => SortingRule<string>;
|
||||||
searchParams: any;
|
searchParams: URLSearchParams;
|
||||||
setSearchParams: any;
|
setSearchParams: (nextInit: URLSearchParamsInit, navigateOptions?: ({replace?: boolean | undefined, state?: any} | undefined)) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ArchiveTable = ({
|
export const ArchiveTable = ({
|
||||||
@ -74,7 +75,6 @@ export const ArchiveTable = ({
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
title: "And we're back!",
|
title: "And we're back!",
|
||||||
text: 'The feature toggle has been revived.',
|
text: 'The feature toggle has been revived.',
|
||||||
confetti: true,
|
|
||||||
});
|
});
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
setToastApiError(formatUnknownError(e));
|
setToastApiError(formatUnknownError(e));
|
||||||
@ -164,6 +164,7 @@ export const ArchiveTable = ({
|
|||||||
accessor: 'description',
|
accessor: 'description',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
//eslint-disable-next-line
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -244,41 +245,6 @@ export const ArchiveTable = ({
|
|||||||
const [firstRenderedIndex, lastRenderedIndex] =
|
const [firstRenderedIndex, lastRenderedIndex] =
|
||||||
useVirtualizedRange(rowHeight);
|
useVirtualizedRange(rowHeight);
|
||||||
|
|
||||||
const renderRows = () => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{rows.map((row, index) => {
|
|
||||||
const isVirtual =
|
|
||||||
index < firstRenderedIndex || index > lastRenderedIndex;
|
|
||||||
|
|
||||||
if (isVirtual) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
prepareRow(row);
|
|
||||||
return (
|
|
||||||
<TableRow hover {...row.getRowProps()}>
|
|
||||||
{row.cells.map(cell => (
|
|
||||||
<TableCell
|
|
||||||
{...cell.getCellProps({
|
|
||||||
style: {
|
|
||||||
flex: cell.column.minWidth
|
|
||||||
? '1 0 auto'
|
|
||||||
: undefined,
|
|
||||||
},
|
|
||||||
})}
|
|
||||||
className={classes.cell}
|
|
||||||
>
|
|
||||||
{cell.render('Cell')}
|
|
||||||
</TableCell>
|
|
||||||
))}
|
|
||||||
</TableRow>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContent
|
<PageContent
|
||||||
isLoading={loading}
|
isLoading={loading}
|
||||||
@ -315,7 +281,34 @@ export const ArchiveTable = ({
|
|||||||
headerGroups={headerGroups as any}
|
headerGroups={headerGroups as any}
|
||||||
/>
|
/>
|
||||||
<TableBody {...getTableBodyProps()}>
|
<TableBody {...getTableBodyProps()}>
|
||||||
{renderRows()}
|
{rows.map((row, index) => {
|
||||||
|
const isVirtual =
|
||||||
|
index < firstRenderedIndex || index > lastRenderedIndex;
|
||||||
|
|
||||||
|
if (isVirtual) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareRow(row);
|
||||||
|
return (
|
||||||
|
<TableRow hover {...row.getRowProps()}>
|
||||||
|
{row.cells.map(cell => (
|
||||||
|
<TableCell
|
||||||
|
{...cell.getCellProps({
|
||||||
|
style: {
|
||||||
|
flex: cell.column.minWidth
|
||||||
|
? '1 0 auto'
|
||||||
|
: undefined,
|
||||||
|
},
|
||||||
|
})}
|
||||||
|
className={classes.cell}
|
||||||
|
>
|
||||||
|
{cell.render('Cell')}
|
||||||
|
</TableCell>
|
||||||
|
))}
|
||||||
|
</TableRow>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
</Table>
|
</Table>
|
||||||
</SearchHighlightProvider>
|
</SearchHighlightProvider>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { SyntheticEvent, VFC } from 'react';
|
import { SyntheticEvent, VFC } from 'react';
|
||||||
import { ActionCell } from '../../../common/Table/cells/ActionCell/ActionCell';
|
import { ActionCell } from 'component/common/Table/cells/ActionCell/ActionCell';
|
||||||
import { Undo } from '@mui/icons-material';
|
import { Undo } from '@mui/icons-material';
|
||||||
import PermissionIconButton from '../../../common/PermissionIconButton/PermissionIconButton';
|
import PermissionIconButton from 'component/common/PermissionIconButton/PermissionIconButton';
|
||||||
import { UPDATE_FEATURE } from '../../../providers/AccessProvider/permissions';
|
import { UPDATE_FEATURE } from 'component/providers/AccessProvider/permissions';
|
||||||
|
|
||||||
interface IReviveArchivedFeatureCell {
|
interface IReviveArchivedFeatureCell {
|
||||||
onRevive: () => void;
|
onRevive: () => void;
|
||||||
|
@ -23,7 +23,7 @@ export const FeaturesArchiveTable = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ArchiveTable
|
<ArchiveTable
|
||||||
title={'Archived'}
|
title='Archived'
|
||||||
archivedFeatures={archivedFeatures}
|
archivedFeatures={archivedFeatures}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
searchParams={searchParams}
|
searchParams={searchParams}
|
||||||
|
@ -27,7 +27,7 @@ export const ProjectFeaturesArchiveTable = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ArchiveTable
|
<ArchiveTable
|
||||||
title={'Project Features Archive'}
|
title='Project Features Archive'
|
||||||
archivedFeatures={archivedFeatures}
|
archivedFeatures={archivedFeatures}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
searchParams={searchParams}
|
searchParams={searchParams}
|
||||||
|
@ -27,7 +27,7 @@ export const FeatureArchivedCell: VFC<IFeatureArchivedCellProps> = ({
|
|||||||
arrow
|
arrow
|
||||||
>
|
>
|
||||||
<Typography noWrap variant="body2" data-loading>
|
<Typography noWrap variant="body2" data-loading>
|
||||||
<TimeAgo date={new Date(archivedAt)} title={''} />
|
<TimeAgo date={new Date(archivedAt)} />
|
||||||
</Typography>
|
</Typography>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user