mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
chore: remove export import flag (#3371)
This commit is contained in:
parent
69a473cceb
commit
9abe859e60
@ -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';
|
||||
|
@ -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
|
||||
</Link>
|
||||
<ConditionallyRender
|
||||
condition={Boolean(
|
||||
uiConfig?.flags?.featuresExportImport
|
||||
)}
|
||||
show={
|
||||
<Tooltip
|
||||
title="Export current selection"
|
||||
arrow
|
||||
>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
setShowExportDialog(true)
|
||||
}
|
||||
sx={theme => ({
|
||||
marginRight: theme.spacing(2),
|
||||
})}
|
||||
>
|
||||
<FileDownload />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
}
|
||||
/>
|
||||
<Tooltip title="Export current selection" arrow>
|
||||
<IconButton
|
||||
onClick={() => setShowExportDialog(true)}
|
||||
sx={theme => ({
|
||||
marginRight: theme.spacing(2),
|
||||
})}
|
||||
>
|
||||
<FileDownload />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
|
||||
<CreateFeatureButton
|
||||
loading={false}
|
||||
@ -383,16 +370,11 @@ export const FeatureToggleListTable: VFC = () => {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<ConditionallyRender
|
||||
condition={Boolean(uiConfig?.flags?.featuresExportImport)}
|
||||
show={
|
||||
<ExportDialog
|
||||
showExportDialog={showExportDialog}
|
||||
data={data}
|
||||
onClose={() => setShowExportDialog(false)}
|
||||
environments={enabledEnvironments}
|
||||
/>
|
||||
}
|
||||
<ExportDialog
|
||||
showExportDialog={showExportDialog}
|
||||
data={data}
|
||||
onClose={() => setShowExportDialog(false)}
|
||||
environments={enabledEnvironments}
|
||||
/>
|
||||
</PageContent>
|
||||
);
|
||||
|
@ -139,23 +139,16 @@ export const Project = () => {
|
||||
</StyledProjectTitle>
|
||||
</StyledDiv>
|
||||
<StyledDiv>
|
||||
<ConditionallyRender
|
||||
condition={Boolean(
|
||||
uiConfig?.flags?.featuresExportImport
|
||||
)}
|
||||
show={
|
||||
<PermissionIconButton
|
||||
permission={UPDATE_FEATURE}
|
||||
projectId={projectId}
|
||||
onClick={() => setModalOpen(true)}
|
||||
tooltipProps={{ title: 'Import' }}
|
||||
data-testid={IMPORT_BUTTON}
|
||||
data-loading
|
||||
>
|
||||
<FileUpload />
|
||||
</PermissionIconButton>
|
||||
}
|
||||
/>
|
||||
<PermissionIconButton
|
||||
permission={UPDATE_FEATURE}
|
||||
projectId={projectId}
|
||||
onClick={() => setModalOpen(true)}
|
||||
tooltipProps={{ title: 'Import' }}
|
||||
data-testid={IMPORT_BUTTON}
|
||||
data-loading
|
||||
>
|
||||
<FileUpload />
|
||||
</PermissionIconButton>
|
||||
<ConditionallyRender
|
||||
condition={!isOss()}
|
||||
show={
|
||||
|
@ -583,29 +583,21 @@ export const ProjectFeatureToggles = ({
|
||||
setHiddenColumns={setHiddenColumns}
|
||||
/>
|
||||
<PageHeader.Divider sx={{ marginLeft: 0 }} />
|
||||
<ConditionallyRender
|
||||
condition={Boolean(
|
||||
uiConfig?.flags?.featuresExportImport
|
||||
)}
|
||||
show={
|
||||
<Tooltip
|
||||
title="Export toggles visible in the table below"
|
||||
arrow
|
||||
>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
setShowExportDialog(true)
|
||||
}
|
||||
sx={theme => ({
|
||||
marginRight:
|
||||
theme.spacing(2),
|
||||
})}
|
||||
>
|
||||
<FileDownload />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
}
|
||||
/>
|
||||
<Tooltip
|
||||
title="Export toggles visible in the table below"
|
||||
arrow
|
||||
>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
setShowExportDialog(true)
|
||||
}
|
||||
sx={theme => ({
|
||||
marginRight: theme.spacing(2),
|
||||
})}
|
||||
>
|
||||
<FileDownload />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<StyledResponsiveButton
|
||||
onClick={() =>
|
||||
navigate(getCreateTogglePath(projectId))
|
||||
@ -712,10 +704,7 @@ export const ProjectFeatureToggles = ({
|
||||
}
|
||||
/>
|
||||
<ConditionallyRender
|
||||
condition={
|
||||
Boolean(uiConfig?.flags?.featuresExportImport) &&
|
||||
!loading
|
||||
}
|
||||
condition={!loading}
|
||||
show={
|
||||
<ExportDialog
|
||||
showExportDialog={showExportDialog}
|
||||
|
@ -4,7 +4,6 @@ import { FileDownload } from '@mui/icons-material';
|
||||
import type { FeatureSchema } from 'openapi';
|
||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
import { ArchiveButton } from './ArchiveButton';
|
||||
import { MoreActions } from './MoreActions';
|
||||
import { ManageTags } from './ManageTags';
|
||||
@ -19,7 +18,6 @@ interface IProjectFeaturesBatchActionsProps {
|
||||
export const ProjectFeaturesBatchActions: FC<
|
||||
IProjectFeaturesBatchActionsProps
|
||||
> = ({ 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<
|
||||
</Button>
|
||||
<ManageTags projectId={projectId} data={selectedData} />
|
||||
<MoreActions projectId={projectId} data={selectedData} />
|
||||
<ConditionallyRender
|
||||
condition={Boolean(uiConfig?.flags?.featuresExportImport)}
|
||||
show={
|
||||
<ExportDialog
|
||||
showExportDialog={showExportDialog}
|
||||
data={selectedData}
|
||||
onClose={() => setShowExportDialog(false)}
|
||||
environments={environments}
|
||||
onConfirm={trackExport}
|
||||
/>
|
||||
}
|
||||
<ExportDialog
|
||||
showExportDialog={showExportDialog}
|
||||
data={selectedData}
|
||||
onClose={() => setShowExportDialog(false)}
|
||||
environments={environments}
|
||||
onConfirm={trackExport}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
@ -40,7 +40,6 @@ export interface IFlags {
|
||||
embedProxyFrontend?: boolean;
|
||||
maintenanceMode?: boolean;
|
||||
messageBanner?: boolean;
|
||||
featuresExportImport?: boolean;
|
||||
newProjectOverview?: boolean;
|
||||
caseInsensitiveInOperators?: boolean;
|
||||
crOnVariants?: boolean;
|
||||
|
@ -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,
|
||||
|
@ -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<unknown, unknown, ExportQuerySchema, unknown>,
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
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<unknown, unknown, ImportTogglesSchema, unknown>,
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
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<unknown, unknown, ImportTogglesSchema, unknown>,
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
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;
|
||||
|
@ -233,9 +233,7 @@ beforeAll(async () => {
|
||||
db.stores,
|
||||
{
|
||||
experimental: {
|
||||
flags: {
|
||||
featuresExportImport: true,
|
||||
},
|
||||
flags: {},
|
||||
},
|
||||
},
|
||||
db.rawDatabase,
|
||||
|
@ -138,9 +138,7 @@ beforeAll(async () => {
|
||||
db.stores,
|
||||
{
|
||||
experimental: {
|
||||
flags: {
|
||||
featuresExportImport: true,
|
||||
},
|
||||
flags: {},
|
||||
},
|
||||
},
|
||||
db.rawDatabase,
|
||||
|
@ -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,
|
||||
|
@ -38,7 +38,6 @@ process.nextTick(async () => {
|
||||
embedProxyFrontend: true,
|
||||
anonymiseEventLog: false,
|
||||
responseTimeWithAppNameKillSwitch: false,
|
||||
featuresExportImport: true,
|
||||
newProjectOverview: true,
|
||||
bulkOperations: true,
|
||||
projectStatusApi: true,
|
||||
|
Loading…
Reference in New Issue
Block a user