1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-19 01:17:18 +02:00
unleash.unleash/frontend/src/component/archive/ArchiveListContainer.tsx
Tymoteusz Czech 1772997d28 Feature list table ()
* experiment with generic table

* feat: example implementation of sortable table interfaces

* add enhanced table header

Co-authored-by: Nuno Góis <github@nunogois.com>

* table cleanup

Co-authored-by: Nuno Góis
Co-authored-by: Fredrik Strand Oseberg

* useSort hook interface surface

Co-authored-by: Nuno Góis <github@nunogois.com>

* sort handler initial implementation

Co-authored-by: Tymoteusz Czech <Tymek@users.noreply.github.com>

* new table unified components

* feature flags table components

Co-authored-by: Nuno Góis <github@nunogois.com>

* feat: new table sort hook

* feat: table sort

* useSearch hook implementation

* update new sort hook tests

* sortable headers hook

* feat: add sort to other table features

* move experimental table hooks to a directory

* update new table header styles

* fix: header, tableActions

* add some details like pagination and highlighter so we keep them in mind

* feature table cells

* update new table sort logic

* new pagination

* fix formatting and remove unused component

* fix: adapt useSearch default search to text instead of regex (PR )

* fix: update table title based on visible rows

* fix: remove test route

* refactor: move table experiment files

* features table experimentation

* feat: enhanced feature flags table

* fix: features default sort

* feat: enhanced table loading

* fix: table theme after mui5 update

* features list placeholder

* add react-table

* update snapshots after theme change

* remove unused files

* fix: improve features table after review

* refactor: rename feature type cell variables

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: Tymoteusz Czech <Tymek@users.noreply.github.com>
2022-05-05 15:34:46 +02:00

51 lines
1.7 KiB
TypeScript

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
/>
);
};