diff --git a/frontend/src/component/archive/ArchiveTable/ArchiveTable.test.tsx b/frontend/src/component/archive/ArchiveTable/ArchiveTable.test.tsx
index 7e8083122e..10901aeaf9 100644
--- a/frontend/src/component/archive/ArchiveTable/ArchiveTable.test.tsx
+++ b/frontend/src/component/archive/ArchiveTable/ArchiveTable.test.tsx
@@ -1,7 +1,7 @@
import { ArchiveTable } from './ArchiveTable';
import { render } from 'utils/testRenderer';
import { useState } from 'react';
-import { screen, fireEvent } from '@testing-library/react';
+import { screen, fireEvent, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {
DELETE_FEATURE,
@@ -63,9 +63,12 @@ const setupApi = () => {
200,
);
- testServerRoute(server, '/api/admin/ui-config', {
+ testServerRoute(server, '/api/admin/projects/default/overview', {
environment: 'Open Source',
});
+ testServerRoute(server, '/api/admin/ui-config', {
+ archivedAt: null,
+ });
};
test('should load the table', async () => {
@@ -95,6 +98,9 @@ test('should show confirm dialog when reviving flag', async () => {
const reviveFlagsButton = screen.getByRole('button', {
name: /Revive feature flag/i,
});
+ await waitFor(async () => {
+ expect(reviveFlagsButton).toBeEnabled();
+ });
fireEvent.click(reviveFlagsButton);
await screen.findByText("And we're back!");
diff --git a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx
index 52ea43757b..9fa0ffd358 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}