From e467fbebb4e59ad8e99799f76f3d69854aa9f0c9 Mon Sep 17 00:00:00 2001 From: kwasniew Date: Tue, 20 Aug 2024 14:48:08 +0200 Subject: [PATCH] feat: prevent revive feature to archived project --- .../ArchivedFeatureReviveConfirm.tsx | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx index 52ea43757b9b..52a9f65a6c2b 100644 --- a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx +++ b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx @@ -5,6 +5,7 @@ import { formatUnknownError } from 'utils/formatUnknownError'; import useToast from 'hooks/useToast'; import useProjectApi from 'hooks/api/actions/useProjectApi/useProjectApi'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import useProjectOverview from '../../../../../hooks/api/getters/useProjectOverview/useProjectOverview'; interface IArchivedFeatureReviveConfirmProps { revivedFeatures: string[]; @@ -27,6 +28,7 @@ export const ArchivedFeatureReviveConfirm = ({ }: IArchivedFeatureReviveConfirmProps) => { const { setToastData, setToastApiError } = useToast(); const { reviveFeatures } = useProjectApi(); + const { project, loading } = useProjectOverview(projectId); const onReviveFeatureToggle = async () => { try { @@ -67,11 +69,23 @@ export const ArchivedFeatureReviveConfirm = ({ secondaryButtonText='Cancel' onClick={onReviveFeatureToggle} onClose={clearModal} + disabledPrimaryButton={loading || Boolean(project.archivedAt)} > - - Revived feature flags will be automatically disabled in all - environments - + + Cannot revive feature flag in archived project (Project + ID: {projectId}) + + } + elseShow={ + + Revived feature flags will be automatically disabled in + all environments + + } + /> 1}