mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
* refactor: page container * refactor: table page header * feat: new feature toggles list in project overview * feat: sortable enviromnents in project overview * feat: project overview toggles search * feat: project overview features column actions * project overview table column sizing * project overview feature actions permissions * project overview archive feature action * project overview toggle state strategy fallback * remove previous project overview implementation * fix: remove additional prop in sortable table * fix: stale feature refetch * improvements after review * feat: manage visible columns in project overview * improve project overview columns selection * fix: simplify columns * Revert "remove previous project overview implementation" This reverts commit 98b051ff6a5a4fb8a9a0921b661514e15a00249a. * restore legacy project overview table
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { VFC } from 'react';
|
|
import { Dialogue } from 'component/common/Dialogue/Dialogue';
|
|
import useFeatureApi from 'hooks/api/actions/useFeatureApi/useFeatureApi';
|
|
import useToast from 'hooks/useToast';
|
|
import { formatUnknownError } from 'utils/formatUnknownError';
|
|
|
|
interface IFeatureArchiveDialogProps {
|
|
isOpen: boolean;
|
|
onConfirm: () => void;
|
|
onClose: () => void;
|
|
projectId: string;
|
|
featureId: string;
|
|
}
|
|
|
|
export const FeatureArchiveDialog: VFC<IFeatureArchiveDialogProps> = ({
|
|
isOpen,
|
|
onClose,
|
|
onConfirm,
|
|
projectId,
|
|
featureId,
|
|
}) => {
|
|
const { archiveFeatureToggle } = useFeatureApi();
|
|
const { setToastData, setToastApiError } = useToast();
|
|
|
|
const archiveToggle = async () => {
|
|
try {
|
|
await archiveFeatureToggle(projectId, featureId);
|
|
setToastData({
|
|
text: 'Your feature toggle has been archived',
|
|
type: 'success',
|
|
title: 'Feature archived',
|
|
});
|
|
onConfirm();
|
|
onClose();
|
|
} catch (error: unknown) {
|
|
setToastApiError(formatUnknownError(error));
|
|
onClose();
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Dialogue
|
|
onClick={() => archiveToggle()}
|
|
open={isOpen}
|
|
onClose={onClose}
|
|
primaryButtonText="Archive toggle"
|
|
secondaryButtonText="Cancel"
|
|
title="Archive feature toggle"
|
|
>
|
|
Are you sure you want to archive this feature toggle?
|
|
</Dialogue>
|
|
);
|
|
};
|