From f833cf58ebb4ce475bd8e11f3f3505cde3956a76 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Mon, 2 Dec 2024 10:26:06 +0100 Subject: [PATCH] 1-3060: remove features export import flag (#8890) This PR removes all references to the `featuresExportImport` flag. The flag was introduced in [PR #3411](https://github.com/Unleash/unleash/pull/3411) on March 29th 2023, and the flag was archived on April 3rd. The flag has always defaulted to true. We've looked at the project that introduced the flag and have spoken to CS about it: we can find no reason to keep the flag around. So well remove it now. --- .../FeatureToggleActions.test.tsx | 6 +- .../FeatureToggleListActions.tsx | 46 ++++++-------- .../FeatureToggleListTable.tsx | 15 ++--- .../ProjectFeatureTogglesHeader.tsx | 61 +++++++------------ .../src/component/project/Project/Project.tsx | 5 +- frontend/src/interfaces/uiConfig.ts | 1 - .../export-import-controller.ts | 13 +--- .../export-import-permissions.e2e.test.ts | 4 +- .../export-import.e2e.test.ts | 4 +- src/lib/types/experimental.ts | 5 -- 10 files changed, 49 insertions(+), 111 deletions(-) diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleActions.test.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleActions.test.tsx index 180690d01b25..78bbaf3305f1 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleActions.test.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleActions.test.tsx @@ -6,11 +6,7 @@ import { testServerRoute, testServerSetup } from 'utils/testServer'; const server = testServerSetup(); test('all options are drawn', async () => { - testServerRoute(server, '/api/admin/ui-config', { - flags: { - featuresExportImport: true, - }, - }); + testServerRoute(server, '/api/admin/ui-config', {}); render( {}} />); diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleListActions.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleListActions.tsx index 357baf83410e..49591e6eaad5 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleListActions.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListActions/FeatureToggleListActions.tsx @@ -13,8 +13,6 @@ import { import Add from '@mui/icons-material/Add'; import MoreVert from '@mui/icons-material/MoreVert'; import { Link } from 'react-router-dom'; -import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; -import { useUiFlag } from 'hooks/useUiFlag'; import { CREATE_FEATURE } from 'component/providers/AccessProvider/permissions'; import { PermissionHOC } from 'component/common/PermissionHOC/PermissionHOC'; import { useCreateFeaturePath } from 'component/feature/CreateFeatureButton/useCreateFeaturePath'; @@ -40,7 +38,6 @@ export const FeatureToggleListActions: FC = ({ }: IFeatureFlagListActions) => { const { trackEvent } = usePlausibleTracker(); const [anchorEl, setAnchorEl] = useState(null); - const featuresExportImport = useUiFlag('featuresExportImport'); const createFeature = useCreateFeaturePath({ query: '', project: 'default', @@ -123,31 +120,24 @@ export const FeatureToggleListActions: FC = ({ )} - { - onExportClick(); - handleClose(); - trackEvent('search-feature-buttons', { - props: { - action: 'export', - }, - }); - }} - > - - - - - - Export - - - - } - /> + { + onExportClick(); + handleClose(); + trackEvent('search-feature-buttons', { + props: { + action: 'export', + }, + }); + }} + > + + + + + Export + + diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable.tsx index efd2d8a473a3..5c2c0eaa9086 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable.tsx @@ -339,16 +339,11 @@ export const FeatureToggleListTable: VFC = () => { } /> - setShowExportDialog(false)} - environments={enabledEnvironments} - /> - } + setShowExportDialog(false)} + environments={enabledEnvironments} /> ); diff --git a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/ProjectFeatureTogglesHeader.tsx b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/ProjectFeatureTogglesHeader.tsx index af1f3dd0f50f..844faed9eb72 100644 --- a/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/ProjectFeatureTogglesHeader.tsx +++ b/frontend/src/component/project/Project/PaginatedProjectFeatureToggles/ProjectFeatureTogglesHeader/ProjectFeatureTogglesHeader.tsx @@ -59,11 +59,11 @@ export const FlagCreationButton = ({ skipNavigationOnComplete, onSuccess, }: IFlagCreationButtonProps) => { + const { loading } = useUiConfig(); const [searchParams] = useSearchParams(); const projectId = useRequiredPathParam('projectId'); const showCreateDialog = Boolean(searchParams.get('create')); const [openCreateDialog, setOpenCreateDialog] = useState(showCreateDialog); - const { loading } = useUiConfig(); return ( <> @@ -104,7 +104,6 @@ export const ProjectFeatureTogglesHeader: FC< const [showTitle, setShowTitle] = useState(true); const theme = useTheme(); const isSmallScreen = useMediaQuery(theme.breakpoints.down('md')); - const featuresExportImportFlag = useUiFlag('featuresExportImport'); const [showExportDialog, setShowExportDialog] = useState(false); const { trackEvent } = usePlausibleTracker(); const projectOverviewRefactorFeedback = useUiFlag( @@ -168,46 +167,28 @@ export const ProjectFeatureTogglesHeader: FC< /> {actions} + + setShowExportDialog(true)} + sx={(theme) => ({ + marginRight: theme.spacing(2), + })} + > + + + + - - - setShowExportDialog(true) - } - sx={(theme) => ({ - marginRight: theme.spacing(2), - })} - > - - - - - - setShowExportDialog(false) - } - environments={ - environmentsToExport || [] - } - /> - } - /> - + setShowExportDialog(false)} + environments={environmentsToExport || []} + /> } /> { , res: Response, ): Promise { - this.verifyExportImportEnabled(); const query = req.body; const userName = extractUsername(req); @@ -134,7 +133,6 @@ class ExportImportController extends Controller { req: IAuthRequest, res: Response, ): Promise { - this.verifyExportImportEnabled(); const dto = req.body; const { user } = req; @@ -154,7 +152,6 @@ class ExportImportController extends Controller { req: IAuthRequest, res: Response, ): Promise { - this.verifyExportImportEnabled(); const { user, audit } = req; if (user instanceof ApiUser && user.type === 'admin') { @@ -171,13 +168,5 @@ class ExportImportController extends Controller { res.status(200).end(); } - - private verifyExportImportEnabled() { - if (!this.config.flagResolver.isEnabled('featuresExportImport')) { - throw new InvalidOperationError( - 'Feature export/import is not enabled', - ); - } - } } export default ExportImportController; diff --git a/src/lib/features/export-import-toggles/export-import-permissions.e2e.test.ts b/src/lib/features/export-import-toggles/export-import-permissions.e2e.test.ts index 8c83dc73c3ab..c71b18b0a102 100644 --- a/src/lib/features/export-import-toggles/export-import-permissions.e2e.test.ts +++ b/src/lib/features/export-import-toggles/export-import-permissions.e2e.test.ts @@ -249,9 +249,7 @@ beforeAll(async () => { db.stores, { experimental: { - flags: { - featuresExportImport: true, - }, + flags: {}, }, }, db.rawDatabase, diff --git a/src/lib/features/export-import-toggles/export-import.e2e.test.ts b/src/lib/features/export-import-toggles/export-import.e2e.test.ts index fe81d5d3c4a7..ab0acf26a18e 100644 --- a/src/lib/features/export-import-toggles/export-import.e2e.test.ts +++ b/src/lib/features/export-import-toggles/export-import.e2e.test.ts @@ -155,9 +155,7 @@ beforeAll(async () => { db.stores, { experimental: { - flags: { - featuresExportImport: true, - }, + flags: {}, }, }, db.rawDatabase, diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 853bb37c640d..5d49c13ae36c 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -13,7 +13,6 @@ export type IFlagKey = | 'responseTimeWithAppNameKillSwitch' | 'maintenanceMode' | 'messageBanner' - | 'featuresExportImport' | 'caseInsensitiveInOperators' | 'strictSchemaValidation' | 'personalAccessTokensKillSwitch' @@ -96,10 +95,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_MESSAGE_BANNER_PAYLOAD ?? '', }, }, - featuresExportImport: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_FEATURES_EXPORT_IMPORT, - true, - ), caseInsensitiveInOperators: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_CASE_INSENSITIVE_IN_OPERATORS, false,