1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

Fix PR comments

This commit is contained in:
andreas-unleash 2022-06-07 13:23:15 +03:00
parent 4ddf69436e
commit 63f147b492
4 changed files with 16 additions and 10 deletions

View File

@ -43,22 +43,22 @@ export interface IFeaturesArchiveTableProps {
archivedFeatures: FeatureSchema[]; archivedFeatures: FeatureSchema[];
refetch: any; refetch: any;
loading: boolean; loading: boolean;
inProject: boolean;
storedParams: any; storedParams: any;
setStoredParams: any; setStoredParams: any;
searchParams: any; searchParams: any;
setSearchParams: any; setSearchParams: any;
title: string;
} }
export const ArchiveTable = ({ export const ArchiveTable = ({
archivedFeatures = [], archivedFeatures = [],
loading, loading,
inProject,
refetch, refetch,
storedParams, storedParams,
setStoredParams, setStoredParams,
searchParams, searchParams,
setSearchParams, setSearchParams,
title,
}: IFeaturesArchiveTableProps) => { }: IFeaturesArchiveTableProps) => {
const rowHeight = theme.shape.tableRowHeight; const rowHeight = theme.shape.tableRowHeight;
const { classes } = useStyles(); const { classes } = useStyles();
@ -201,9 +201,7 @@ export const ArchiveTable = ({
isLoading={loading} isLoading={loading}
header={ header={
<PageHeader <PageHeader
title={`${ title={`${title} (${
inProject ? 'Project Features Archive' : 'Archived'
} (${
rows.length < data.length rows.length < data.length
? `${rows.length} of ${data.length}` ? `${rows.length} of ${data.length}`
: data.length : data.length
@ -321,6 +319,7 @@ function getColumns(onRevive: (feature: string) => Promise<void>) {
disableGlobalFilter: true, disableGlobalFilter: true,
Cell: ({ row: { original } }: any) => ( Cell: ({ row: { original } }: any) => (
<ReviveArchivedFeatureCell <ReviveArchivedFeatureCell
project={original.project}
onRevive={() => onRevive(original.name)} onRevive={() => onRevive(original.name)}
/> />
), ),

View File

@ -1,20 +1,27 @@
import { VFC } from 'react'; import { VFC } from 'react';
import { ActionCell } from '../../../common/Table/cells/ActionCell/ActionCell'; import { ActionCell } from '../../../common/Table/cells/ActionCell/ActionCell';
import { Undo } from '@mui/icons-material'; import { Undo } from '@mui/icons-material';
import { IconButton } from '@mui/material'; import PermissionIconButton from '../../../common/PermissionIconButton/PermissionIconButton';
import { ADMIN } from '../../../providers/AccessProvider/permissions';
interface IReviveArchivedFeatureCell { interface IReviveArchivedFeatureCell {
onRevive: any; onRevive: any;
project: string;
} }
export const ReviveArchivedFeatureCell: VFC<IReviveArchivedFeatureCell> = ({ export const ReviveArchivedFeatureCell: VFC<IReviveArchivedFeatureCell> = ({
onRevive, onRevive,
project,
}) => { }) => {
return ( return (
<ActionCell> <ActionCell>
<IconButton onClick={onRevive}> <PermissionIconButton
onClick={onRevive}
projectId={project}
permission={ADMIN}
>
<Undo /> <Undo />
</IconButton> </PermissionIconButton>
</ActionCell> </ActionCell>
); );
}; };

View File

@ -23,6 +23,7 @@ export const FeaturesArchiveTable = () => {
return ( return (
<ArchiveTable <ArchiveTable
title={'Archived'}
archivedFeatures={archivedFeatures} archivedFeatures={archivedFeatures}
loading={loading} loading={loading}
searchParams={searchParams} searchParams={searchParams}
@ -30,7 +31,6 @@ export const FeaturesArchiveTable = () => {
storedParams={storedParams} storedParams={storedParams}
setStoredParams={setStoredParams} setStoredParams={setStoredParams}
refetch={refetchArchived} refetch={refetchArchived}
inProject={false}
/> />
); );
}; };

View File

@ -27,6 +27,7 @@ export const ProjectFeaturesArchiveTable = ({
return ( return (
<ArchiveTable <ArchiveTable
title={'Project Features Archive'}
archivedFeatures={archivedFeatures} archivedFeatures={archivedFeatures}
loading={loading} loading={loading}
searchParams={searchParams} searchParams={searchParams}
@ -34,7 +35,6 @@ export const ProjectFeaturesArchiveTable = ({
storedParams={storedParams} storedParams={storedParams}
setStoredParams={setStoredParams} setStoredParams={setStoredParams}
refetch={refetchArchived} refetch={refetchArchived}
inProject={true}
/> />
); );
}; };