mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-04 13:48:56 +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 { InstanceStatusBar } from 'component/common/InstanceStatus/InstanceStatusBar';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import { Dialogue } from 'component/common/Dialogue/Dialogue';
|
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 { useNavigate } from 'react-router-dom';
|
||||||
import { IInstanceStatus } from 'interfaces/instance';
|
import { IInstanceStatus } from 'interfaces/instance';
|
||||||
import { ADMIN } from 'component/providers/AccessProvider/permissions';
|
import { ADMIN } from 'component/providers/AccessProvider/permissions';
|
||||||
|
@ -68,7 +68,6 @@ export const FeatureToggleListTable: VFC = () => {
|
|||||||
const [showExportDialog, setShowExportDialog] = useState(false);
|
const [showExportDialog, setShowExportDialog] = useState(false);
|
||||||
const { features = [], loading, refetchFeatures } = useFeatures();
|
const { features = [], loading, refetchFeatures } = useFeatures();
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const { uiConfig } = useUiConfig();
|
|
||||||
const [initialState] = useState(() => ({
|
const [initialState] = useState(() => ({
|
||||||
sortBy: [
|
sortBy: [
|
||||||
{
|
{
|
||||||
@ -311,28 +310,16 @@ export const FeatureToggleListTable: VFC = () => {
|
|||||||
>
|
>
|
||||||
View archive
|
View archive
|
||||||
</Link>
|
</Link>
|
||||||
<ConditionallyRender
|
<Tooltip title="Export current selection" arrow>
|
||||||
condition={Boolean(
|
<IconButton
|
||||||
uiConfig?.flags?.featuresExportImport
|
onClick={() => setShowExportDialog(true)}
|
||||||
)}
|
sx={theme => ({
|
||||||
show={
|
marginRight: theme.spacing(2),
|
||||||
<Tooltip
|
})}
|
||||||
title="Export current selection"
|
>
|
||||||
arrow
|
<FileDownload />
|
||||||
>
|
</IconButton>
|
||||||
<IconButton
|
</Tooltip>
|
||||||
onClick={() =>
|
|
||||||
setShowExportDialog(true)
|
|
||||||
}
|
|
||||||
sx={theme => ({
|
|
||||||
marginRight: theme.spacing(2),
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
<FileDownload />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<CreateFeatureButton
|
<CreateFeatureButton
|
||||||
loading={false}
|
loading={false}
|
||||||
@ -383,16 +370,11 @@ export const FeatureToggleListTable: VFC = () => {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<ConditionallyRender
|
<ExportDialog
|
||||||
condition={Boolean(uiConfig?.flags?.featuresExportImport)}
|
showExportDialog={showExportDialog}
|
||||||
show={
|
data={data}
|
||||||
<ExportDialog
|
onClose={() => setShowExportDialog(false)}
|
||||||
showExportDialog={showExportDialog}
|
environments={enabledEnvironments}
|
||||||
data={data}
|
|
||||||
onClose={() => setShowExportDialog(false)}
|
|
||||||
environments={enabledEnvironments}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
);
|
);
|
||||||
|
@ -139,23 +139,16 @@ export const Project = () => {
|
|||||||
</StyledProjectTitle>
|
</StyledProjectTitle>
|
||||||
</StyledDiv>
|
</StyledDiv>
|
||||||
<StyledDiv>
|
<StyledDiv>
|
||||||
<ConditionallyRender
|
<PermissionIconButton
|
||||||
condition={Boolean(
|
permission={UPDATE_FEATURE}
|
||||||
uiConfig?.flags?.featuresExportImport
|
projectId={projectId}
|
||||||
)}
|
onClick={() => setModalOpen(true)}
|
||||||
show={
|
tooltipProps={{ title: 'Import' }}
|
||||||
<PermissionIconButton
|
data-testid={IMPORT_BUTTON}
|
||||||
permission={UPDATE_FEATURE}
|
data-loading
|
||||||
projectId={projectId}
|
>
|
||||||
onClick={() => setModalOpen(true)}
|
<FileUpload />
|
||||||
tooltipProps={{ title: 'Import' }}
|
</PermissionIconButton>
|
||||||
data-testid={IMPORT_BUTTON}
|
|
||||||
data-loading
|
|
||||||
>
|
|
||||||
<FileUpload />
|
|
||||||
</PermissionIconButton>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={!isOss()}
|
condition={!isOss()}
|
||||||
show={
|
show={
|
||||||
|
@ -583,29 +583,21 @@ export const ProjectFeatureToggles = ({
|
|||||||
setHiddenColumns={setHiddenColumns}
|
setHiddenColumns={setHiddenColumns}
|
||||||
/>
|
/>
|
||||||
<PageHeader.Divider sx={{ marginLeft: 0 }} />
|
<PageHeader.Divider sx={{ marginLeft: 0 }} />
|
||||||
<ConditionallyRender
|
<Tooltip
|
||||||
condition={Boolean(
|
title="Export toggles visible in the table below"
|
||||||
uiConfig?.flags?.featuresExportImport
|
arrow
|
||||||
)}
|
>
|
||||||
show={
|
<IconButton
|
||||||
<Tooltip
|
onClick={() =>
|
||||||
title="Export toggles visible in the table below"
|
setShowExportDialog(true)
|
||||||
arrow
|
}
|
||||||
>
|
sx={theme => ({
|
||||||
<IconButton
|
marginRight: theme.spacing(2),
|
||||||
onClick={() =>
|
})}
|
||||||
setShowExportDialog(true)
|
>
|
||||||
}
|
<FileDownload />
|
||||||
sx={theme => ({
|
</IconButton>
|
||||||
marginRight:
|
</Tooltip>
|
||||||
theme.spacing(2),
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
<FileDownload />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<StyledResponsiveButton
|
<StyledResponsiveButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
navigate(getCreateTogglePath(projectId))
|
navigate(getCreateTogglePath(projectId))
|
||||||
@ -712,10 +704,7 @@ export const ProjectFeatureToggles = ({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={
|
condition={!loading}
|
||||||
Boolean(uiConfig?.flags?.featuresExportImport) &&
|
|
||||||
!loading
|
|
||||||
}
|
|
||||||
show={
|
show={
|
||||||
<ExportDialog
|
<ExportDialog
|
||||||
showExportDialog={showExportDialog}
|
showExportDialog={showExportDialog}
|
||||||
|
@ -4,7 +4,6 @@ import { FileDownload } from '@mui/icons-material';
|
|||||||
import type { FeatureSchema } from 'openapi';
|
import type { FeatureSchema } from 'openapi';
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
|
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
|
||||||
import { ArchiveButton } from './ArchiveButton';
|
import { ArchiveButton } from './ArchiveButton';
|
||||||
import { MoreActions } from './MoreActions';
|
import { MoreActions } from './MoreActions';
|
||||||
import { ManageTags } from './ManageTags';
|
import { ManageTags } from './ManageTags';
|
||||||
@ -19,7 +18,6 @@ interface IProjectFeaturesBatchActionsProps {
|
|||||||
export const ProjectFeaturesBatchActions: FC<
|
export const ProjectFeaturesBatchActions: FC<
|
||||||
IProjectFeaturesBatchActionsProps
|
IProjectFeaturesBatchActionsProps
|
||||||
> = ({ selectedIds, data, projectId }) => {
|
> = ({ selectedIds, data, projectId }) => {
|
||||||
const { uiConfig } = useUiConfig();
|
|
||||||
const [showExportDialog, setShowExportDialog] = useState(false);
|
const [showExportDialog, setShowExportDialog] = useState(false);
|
||||||
const { trackEvent } = usePlausibleTracker();
|
const { trackEvent } = usePlausibleTracker();
|
||||||
const selectedData = useMemo(
|
const selectedData = useMemo(
|
||||||
@ -56,17 +54,12 @@ export const ProjectFeaturesBatchActions: FC<
|
|||||||
</Button>
|
</Button>
|
||||||
<ManageTags projectId={projectId} data={selectedData} />
|
<ManageTags projectId={projectId} data={selectedData} />
|
||||||
<MoreActions projectId={projectId} data={selectedData} />
|
<MoreActions projectId={projectId} data={selectedData} />
|
||||||
<ConditionallyRender
|
<ExportDialog
|
||||||
condition={Boolean(uiConfig?.flags?.featuresExportImport)}
|
showExportDialog={showExportDialog}
|
||||||
show={
|
data={selectedData}
|
||||||
<ExportDialog
|
onClose={() => setShowExportDialog(false)}
|
||||||
showExportDialog={showExportDialog}
|
environments={environments}
|
||||||
data={selectedData}
|
onConfirm={trackExport}
|
||||||
onClose={() => setShowExportDialog(false)}
|
|
||||||
environments={environments}
|
|
||||||
onConfirm={trackExport}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -40,7 +40,6 @@ export interface IFlags {
|
|||||||
embedProxyFrontend?: boolean;
|
embedProxyFrontend?: boolean;
|
||||||
maintenanceMode?: boolean;
|
maintenanceMode?: boolean;
|
||||||
messageBanner?: boolean;
|
messageBanner?: boolean;
|
||||||
featuresExportImport?: boolean;
|
|
||||||
newProjectOverview?: boolean;
|
newProjectOverview?: boolean;
|
||||||
caseInsensitiveInOperators?: boolean;
|
caseInsensitiveInOperators?: boolean;
|
||||||
crOnVariants?: boolean;
|
crOnVariants?: boolean;
|
||||||
|
@ -75,7 +75,6 @@ exports[`should create default config 1`] = `
|
|||||||
"crOnVariants": false,
|
"crOnVariants": false,
|
||||||
"embedProxy": true,
|
"embedProxy": true,
|
||||||
"embedProxyFrontend": true,
|
"embedProxyFrontend": true,
|
||||||
"featuresExportImport": false,
|
|
||||||
"loginHistory": false,
|
"loginHistory": false,
|
||||||
"maintenanceMode": false,
|
"maintenanceMode": false,
|
||||||
"messageBanner": false,
|
"messageBanner": false,
|
||||||
@ -103,7 +102,6 @@ exports[`should create default config 1`] = `
|
|||||||
"crOnVariants": false,
|
"crOnVariants": false,
|
||||||
"embedProxy": true,
|
"embedProxy": true,
|
||||||
"embedProxyFrontend": true,
|
"embedProxyFrontend": true,
|
||||||
"featuresExportImport": false,
|
|
||||||
"loginHistory": false,
|
"loginHistory": false,
|
||||||
"maintenanceMode": false,
|
"maintenanceMode": false,
|
||||||
"messageBanner": false,
|
"messageBanner": false,
|
||||||
|
@ -21,7 +21,6 @@ import {
|
|||||||
} from '../../openapi';
|
} from '../../openapi';
|
||||||
import { IAuthRequest } from '../../routes/unleash-types';
|
import { IAuthRequest } from '../../routes/unleash-types';
|
||||||
import { extractUsername } from '../../util';
|
import { extractUsername } from '../../util';
|
||||||
import { InvalidOperationError } from '../../error';
|
|
||||||
|
|
||||||
class ExportImportController extends Controller {
|
class ExportImportController extends Controller {
|
||||||
private logger: Logger;
|
private logger: Logger;
|
||||||
@ -119,7 +118,6 @@ class ExportImportController extends Controller {
|
|||||||
req: IAuthRequest<unknown, unknown, ExportQuerySchema, unknown>,
|
req: IAuthRequest<unknown, unknown, ExportQuerySchema, unknown>,
|
||||||
res: Response,
|
res: Response,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
this.verifyExportImportEnabled();
|
|
||||||
const query = req.body;
|
const query = req.body;
|
||||||
const userName = extractUsername(req);
|
const userName = extractUsername(req);
|
||||||
const data = await this.exportImportService.export(query, userName);
|
const data = await this.exportImportService.export(query, userName);
|
||||||
@ -136,7 +134,6 @@ class ExportImportController extends Controller {
|
|||||||
req: IAuthRequest<unknown, unknown, ImportTogglesSchema, unknown>,
|
req: IAuthRequest<unknown, unknown, ImportTogglesSchema, unknown>,
|
||||||
res: Response,
|
res: Response,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
this.verifyExportImportEnabled();
|
|
||||||
const dto = req.body;
|
const dto = req.body;
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
const validation = await this.startTransaction(async (tx) =>
|
const validation = await this.startTransaction(async (tx) =>
|
||||||
@ -155,7 +152,6 @@ class ExportImportController extends Controller {
|
|||||||
req: IAuthRequest<unknown, unknown, ImportTogglesSchema, unknown>,
|
req: IAuthRequest<unknown, unknown, ImportTogglesSchema, unknown>,
|
||||||
res: Response,
|
res: Response,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
this.verifyExportImportEnabled();
|
|
||||||
const dto = req.body;
|
const dto = req.body;
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
await this.startTransaction(async (tx) =>
|
await this.startTransaction(async (tx) =>
|
||||||
@ -164,13 +160,5 @@ class ExportImportController extends Controller {
|
|||||||
|
|
||||||
res.status(200).end();
|
res.status(200).end();
|
||||||
}
|
}
|
||||||
|
|
||||||
private verifyExportImportEnabled() {
|
|
||||||
if (!this.config.flagResolver.isEnabled('featuresExportImport')) {
|
|
||||||
throw new InvalidOperationError(
|
|
||||||
'Feature export/import is not enabled',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export default ExportImportController;
|
export default ExportImportController;
|
||||||
|
@ -233,9 +233,7 @@ beforeAll(async () => {
|
|||||||
db.stores,
|
db.stores,
|
||||||
{
|
{
|
||||||
experimental: {
|
experimental: {
|
||||||
flags: {
|
flags: {},
|
||||||
featuresExportImport: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
db.rawDatabase,
|
db.rawDatabase,
|
||||||
|
@ -138,9 +138,7 @@ beforeAll(async () => {
|
|||||||
db.stores,
|
db.stores,
|
||||||
{
|
{
|
||||||
experimental: {
|
experimental: {
|
||||||
flags: {
|
flags: {},
|
||||||
featuresExportImport: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
db.rawDatabase,
|
db.rawDatabase,
|
||||||
|
@ -34,10 +34,6 @@ const flags = {
|
|||||||
process.env.UNLEASH_EXPERIMENTAL_MESSAGE_BANNER,
|
process.env.UNLEASH_EXPERIMENTAL_MESSAGE_BANNER,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
featuresExportImport: parseEnvVarBoolean(
|
|
||||||
process.env.UNLEASH_EXPERIMENTAL_FEATURES_EXPORT_IMPORT,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
caseInsensitiveInOperators: parseEnvVarBoolean(
|
caseInsensitiveInOperators: parseEnvVarBoolean(
|
||||||
process.env.UNLEASH_EXPERIMENTAL_CASE_INSENSITIVE_IN_OPERATORS,
|
process.env.UNLEASH_EXPERIMENTAL_CASE_INSENSITIVE_IN_OPERATORS,
|
||||||
false,
|
false,
|
||||||
|
@ -38,7 +38,6 @@ process.nextTick(async () => {
|
|||||||
embedProxyFrontend: true,
|
embedProxyFrontend: true,
|
||||||
anonymiseEventLog: false,
|
anonymiseEventLog: false,
|
||||||
responseTimeWithAppNameKillSwitch: false,
|
responseTimeWithAppNameKillSwitch: false,
|
||||||
featuresExportImport: true,
|
|
||||||
newProjectOverview: true,
|
newProjectOverview: true,
|
||||||
bulkOperations: true,
|
bulkOperations: true,
|
||||||
projectStatusApi: true,
|
projectStatusApi: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user