mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
removed unused code
This commit is contained in:
parent
b6beae95cc
commit
e53baaf718
@ -1,50 +0,0 @@
|
|||||||
import { useFeaturesArchive } from 'hooks/api/getters/useFeaturesArchive/useFeaturesArchive';
|
|
||||||
import { FeatureToggleList } from '../feature/FeatureToggleList/FeatureToggleArchiveList';
|
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
|
||||||
import { useFeaturesFilter } from 'hooks/useFeaturesFilter';
|
|
||||||
import { useFeatureArchiveApi } from 'hooks/api/actions/useFeatureArchiveApi/useReviveFeatureApi';
|
|
||||||
import useToast from 'hooks/useToast';
|
|
||||||
import { useFeaturesSort } from 'hooks/useFeaturesSort';
|
|
||||||
|
|
||||||
export const ArchiveListContainer = () => {
|
|
||||||
const { setToastData, setToastApiError } = useToast();
|
|
||||||
const { uiConfig } = useUiConfig();
|
|
||||||
const { reviveFeature } = useFeatureArchiveApi();
|
|
||||||
|
|
||||||
const {
|
|
||||||
archivedFeatures = [],
|
|
||||||
refetchArchived,
|
|
||||||
loading,
|
|
||||||
} = useFeaturesArchive();
|
|
||||||
|
|
||||||
const { filtered, filter, setFilter } = useFeaturesFilter(archivedFeatures);
|
|
||||||
const { sorted, sort, setSort } = useFeaturesSort(filtered);
|
|
||||||
|
|
||||||
const onRevive = (feature: string) => {
|
|
||||||
reviveFeature(feature)
|
|
||||||
.then(refetchArchived)
|
|
||||||
.then(() =>
|
|
||||||
setToastData({
|
|
||||||
type: 'success',
|
|
||||||
title: "And we're back!",
|
|
||||||
text: 'The feature toggle has been revived.',
|
|
||||||
confetti: true,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.catch(e => setToastApiError(e.toString()));
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FeatureToggleList
|
|
||||||
features={sorted}
|
|
||||||
loading={loading}
|
|
||||||
onRevive={onRevive}
|
|
||||||
flags={uiConfig.flags}
|
|
||||||
filter={filter}
|
|
||||||
setFilter={setFilter}
|
|
||||||
sort={sort}
|
|
||||||
setSort={setSort}
|
|
||||||
isArchive
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
@ -165,8 +165,6 @@ export const ArchiveTable = ({
|
|||||||
getSearchContext,
|
getSearchContext,
|
||||||
} = useSearch(columns, searchValue, archivedFeatures);
|
} = useSearch(columns, searchValue, archivedFeatures);
|
||||||
|
|
||||||
debugger;
|
|
||||||
|
|
||||||
const data = useMemo(
|
const data = useMemo(
|
||||||
() => (loading ? featuresPlaceholder : searchedData),
|
() => (loading ? featuresPlaceholder : searchedData),
|
||||||
[searchedData, loading]
|
[searchedData, loading]
|
||||||
@ -238,7 +236,7 @@ export const ArchiveTable = ({
|
|||||||
const renderRows = () => {
|
const renderRows = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{rows.map((row) => {
|
{rows.map(row => {
|
||||||
prepareRow(row);
|
prepareRow(row);
|
||||||
return (
|
return (
|
||||||
<TableRow hover {...row.getRowProps()}>
|
<TableRow hover {...row.getRowProps()}>
|
||||||
@ -263,7 +261,6 @@ export const ArchiveTable = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContent
|
<PageContent
|
||||||
isLoading={loading}
|
isLoading={loading}
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
import { FC } from 'react';
|
|
||||||
import { useProjectFeaturesArchive } from 'hooks/api/getters/useProjectFeaturesArchive/useProjectFeaturesArchive';
|
|
||||||
import { FeatureToggleList } from '../feature/FeatureToggleList/FeatureToggleArchiveList';
|
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
|
||||||
import { useFeaturesFilter } from 'hooks/useFeaturesFilter';
|
|
||||||
import { useFeatureArchiveApi } from 'hooks/api/actions/useFeatureArchiveApi/useReviveFeatureApi';
|
|
||||||
import useToast from 'hooks/useToast';
|
|
||||||
import { useFeaturesSort } from 'hooks/useFeaturesSort';
|
|
||||||
|
|
||||||
interface IProjectFeaturesArchiveList {
|
|
||||||
projectId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ProjectFeaturesArchiveList: FC<IProjectFeaturesArchiveList> = ({
|
|
||||||
projectId,
|
|
||||||
}) => {
|
|
||||||
const { setToastData, setToastApiError } = useToast();
|
|
||||||
const { uiConfig } = useUiConfig();
|
|
||||||
const { reviveFeature } = useFeatureArchiveApi();
|
|
||||||
|
|
||||||
const {
|
|
||||||
archivedFeatures = [],
|
|
||||||
refetchArchived,
|
|
||||||
loading,
|
|
||||||
} = useProjectFeaturesArchive(projectId);
|
|
||||||
|
|
||||||
const { filtered, filter, setFilter } = useFeaturesFilter(archivedFeatures);
|
|
||||||
const { sorted, sort, setSort } = useFeaturesSort(filtered);
|
|
||||||
|
|
||||||
const onRevive = (feature: string) => {
|
|
||||||
reviveFeature(feature)
|
|
||||||
.then(refetchArchived)
|
|
||||||
.then(() =>
|
|
||||||
setToastData({
|
|
||||||
type: 'success',
|
|
||||||
title: "And we're back!",
|
|
||||||
text: 'The feature toggle has been revived.',
|
|
||||||
confetti: true,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.catch(e => setToastApiError(e.toString()));
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FeatureToggleList
|
|
||||||
features={sorted}
|
|
||||||
loading={loading}
|
|
||||||
onRevive={onRevive}
|
|
||||||
flags={uiConfig.flags}
|
|
||||||
filter={filter}
|
|
||||||
setFilter={setFilter}
|
|
||||||
sort={sort}
|
|
||||||
setSort={setSort}
|
|
||||||
isArchive
|
|
||||||
inProject={Boolean(projectId)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,9 +1,9 @@
|
|||||||
import React, {VFC} from 'react';
|
import React, { VFC } from 'react';
|
||||||
import TimeAgo from 'react-timeago';
|
import TimeAgo from 'react-timeago';
|
||||||
import {Tooltip, Typography} from '@mui/material';
|
import { Tooltip, Typography } from '@mui/material';
|
||||||
import {formatDateYMD} from '../../../../../utils/formatDate';
|
import { formatDateYMD } from '../../../../../utils/formatDate';
|
||||||
import {TextCell} from '../TextCell/TextCell';
|
import { TextCell } from '../TextCell/TextCell';
|
||||||
import {useLocationSettings} from "../../../../../hooks/useLocationSettings";
|
import { useLocationSettings } from '../../../../../hooks/useLocationSettings';
|
||||||
|
|
||||||
interface IFeatureArchivedCellProps {
|
interface IFeatureArchivedCellProps {
|
||||||
value?: string | Date | null;
|
value?: string | Date | null;
|
||||||
@ -20,7 +20,10 @@ export const FeatureArchivedCell: VFC<IFeatureArchivedCellProps> = ({
|
|||||||
<TextCell>
|
<TextCell>
|
||||||
{archivedAt && (
|
{archivedAt && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={`Archived on: ${formatDateYMD(archivedAt, locationSettings.locale)}`}
|
title={`Archived on: ${formatDateYMD(
|
||||||
|
archivedAt,
|
||||||
|
locationSettings.locale
|
||||||
|
)}`}
|
||||||
arrow
|
arrow
|
||||||
>
|
>
|
||||||
<Typography noWrap variant="body2" data-loading>
|
<Typography noWrap variant="body2" data-loading>
|
||||||
|
Loading…
Reference in New Issue
Block a user