From 9abe859e60aa7146745bb4aca9103a13e9168b24 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Mon, 27 Mar 2023 12:31:19 +0200 Subject: [PATCH] chore: remove export import flag (#3371) --- .../common/InstanceStatus/InstanceStatus.tsx | 2 +- .../FeatureToggleListTable.tsx | 48 ++++++------------- .../src/component/project/Project/Project.tsx | 27 ++++------- .../ProjectFeatureToggles.tsx | 43 +++++++---------- .../ProjectFeaturesBatchActions.tsx | 19 +++----- frontend/src/interfaces/uiConfig.ts | 1 - .../__snapshots__/create-config.test.ts.snap | 2 - .../export-import-controller.ts | 12 ----- .../export-import-permissions.e2e.test.ts | 4 +- .../export-import.e2e.test.ts | 4 +- src/lib/types/experimental.ts | 4 -- src/server-dev.ts | 1 - 12 files changed, 50 insertions(+), 117 deletions(-) diff --git a/frontend/src/component/common/InstanceStatus/InstanceStatus.tsx b/frontend/src/component/common/InstanceStatus/InstanceStatus.tsx index d8625a84dc..25282e2077 100644 --- a/frontend/src/component/common/InstanceStatus/InstanceStatus.tsx +++ b/frontend/src/component/common/InstanceStatus/InstanceStatus.tsx @@ -3,7 +3,7 @@ import React, { FC, VFC, useEffect, useState, useContext } from 'react'; import { InstanceStatusBar } from 'component/common/InstanceStatus/InstanceStatusBar'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { Dialogue } from 'component/common/Dialogue/Dialogue'; -import { Typography, useTheme } from '@mui/material'; +import { Typography } from '@mui/material'; import { useNavigate } from 'react-router-dom'; import { IInstanceStatus } from 'interfaces/instance'; import { ADMIN } from 'component/providers/AccessProvider/permissions'; diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable.tsx index a77ab7a2f2..9cdea15fcb 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleListTable.tsx @@ -68,7 +68,6 @@ export const FeatureToggleListTable: VFC = () => { const [showExportDialog, setShowExportDialog] = useState(false); const { features = [], loading, refetchFeatures } = useFeatures(); const [searchParams, setSearchParams] = useSearchParams(); - const { uiConfig } = useUiConfig(); const [initialState] = useState(() => ({ sortBy: [ { @@ -311,28 +310,16 @@ export const FeatureToggleListTable: VFC = () => { > View archive - - - setShowExportDialog(true) - } - sx={theme => ({ - marginRight: theme.spacing(2), - })} - > - - - - } - /> + + setShowExportDialog(true)} + sx={theme => ({ + marginRight: theme.spacing(2), + })} + > + + + { /> } /> - setShowExportDialog(false)} - environments={enabledEnvironments} - /> - } + setShowExportDialog(false)} + environments={enabledEnvironments} /> ); diff --git a/frontend/src/component/project/Project/Project.tsx b/frontend/src/component/project/Project/Project.tsx index ce02a943d8..ce2ea40bf3 100644 --- a/frontend/src/component/project/Project/Project.tsx +++ b/frontend/src/component/project/Project/Project.tsx @@ -139,23 +139,16 @@ export const Project = () => { - setModalOpen(true)} - tooltipProps={{ title: 'Import' }} - data-testid={IMPORT_BUTTON} - data-loading - > - - - } - /> + setModalOpen(true)} + tooltipProps={{ title: 'Import' }} + data-testid={IMPORT_BUTTON} + data-loading + > + + - - - setShowExportDialog(true) - } - sx={theme => ({ - marginRight: - theme.spacing(2), - })} - > - - - - } - /> + + + setShowExportDialog(true) + } + sx={theme => ({ + marginRight: theme.spacing(2), + })} + > + + + navigate(getCreateTogglePath(projectId)) @@ -712,10 +704,7 @@ export const ProjectFeatureToggles = ({ } /> = ({ selectedIds, data, projectId }) => { - const { uiConfig } = useUiConfig(); const [showExportDialog, setShowExportDialog] = useState(false); const { trackEvent } = usePlausibleTracker(); const selectedData = useMemo( @@ -56,17 +54,12 @@ export const ProjectFeaturesBatchActions: FC< - setShowExportDialog(false)} - environments={environments} - onConfirm={trackExport} - /> - } + setShowExportDialog(false)} + environments={environments} + onConfirm={trackExport} /> ); diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index 946c87ebb0..2815aa40d3 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -40,7 +40,6 @@ export interface IFlags { embedProxyFrontend?: boolean; maintenanceMode?: boolean; messageBanner?: boolean; - featuresExportImport?: boolean; newProjectOverview?: boolean; caseInsensitiveInOperators?: boolean; crOnVariants?: boolean; diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 1327f4a52e..43c0aa7e2d 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -75,7 +75,6 @@ exports[`should create default config 1`] = ` "crOnVariants": false, "embedProxy": true, "embedProxyFrontend": true, - "featuresExportImport": false, "loginHistory": false, "maintenanceMode": false, "messageBanner": false, @@ -103,7 +102,6 @@ exports[`should create default config 1`] = ` "crOnVariants": false, "embedProxy": true, "embedProxyFrontend": true, - "featuresExportImport": false, "loginHistory": false, "maintenanceMode": false, "messageBanner": false, diff --git a/src/lib/features/export-import-toggles/export-import-controller.ts b/src/lib/features/export-import-toggles/export-import-controller.ts index dab6d3a52d..1310df1c1d 100644 --- a/src/lib/features/export-import-toggles/export-import-controller.ts +++ b/src/lib/features/export-import-toggles/export-import-controller.ts @@ -21,7 +21,6 @@ import { } from '../../openapi'; import { IAuthRequest } from '../../routes/unleash-types'; import { extractUsername } from '../../util'; -import { InvalidOperationError } from '../../error'; class ExportImportController extends Controller { private logger: Logger; @@ -119,7 +118,6 @@ class ExportImportController extends Controller { req: IAuthRequest, res: Response, ): Promise { - this.verifyExportImportEnabled(); const query = req.body; const userName = extractUsername(req); const data = await this.exportImportService.export(query, userName); @@ -136,7 +134,6 @@ class ExportImportController extends Controller { req: IAuthRequest, res: Response, ): Promise { - this.verifyExportImportEnabled(); const dto = req.body; const { user } = req; const validation = await this.startTransaction(async (tx) => @@ -155,7 +152,6 @@ class ExportImportController extends Controller { req: IAuthRequest, res: Response, ): Promise { - this.verifyExportImportEnabled(); const dto = req.body; const { user } = req; await this.startTransaction(async (tx) => @@ -164,13 +160,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 cbd114f258..618e3281fb 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 @@ -233,9 +233,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 924fc8eaa2..8b0b2a2e72 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 @@ -138,9 +138,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 d0f0053a9f..f727a75330 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -34,10 +34,6 @@ const flags = { process.env.UNLEASH_EXPERIMENTAL_MESSAGE_BANNER, false, ), - featuresExportImport: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_FEATURES_EXPORT_IMPORT, - false, - ), caseInsensitiveInOperators: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_CASE_INSENSITIVE_IN_OPERATORS, false, diff --git a/src/server-dev.ts b/src/server-dev.ts index bd525a63ea..da331be67e 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -38,7 +38,6 @@ process.nextTick(async () => { embedProxyFrontend: true, anonymiseEventLog: false, responseTimeWithAppNameKillSwitch: false, - featuresExportImport: true, newProjectOverview: true, bulkOperations: true, projectStatusApi: true,