1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

feat: improve export and import lists (#3105)

This commit is contained in:
Mateusz Kwasniewski 2023-02-14 13:53:25 +01:00 committed by GitHub
parent 0203027ee2
commit c7aafec57e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -59,6 +59,7 @@ const { value: storedParams, setValue: setStoredParams } = createLocalStorage(
export const FeatureToggleListTable: VFC = () => {
const theme = useTheme();
const { environments } = useEnvironments();
const enabledEnvironment = environments.filter(env => env.enabled);
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
const isMediumScreen = useMediaQuery(theme.breakpoints.down('lg'));
const [showExportDialog, setShowExportDialog] = useState(false);
@ -386,7 +387,7 @@ export const FeatureToggleListTable: VFC = () => {
showExportDialog={showExportDialog}
data={data}
onClose={() => setShowExportDialog(false)}
environments={environments}
environments={enabledEnvironment}
/>
}
/>

View File

@ -1,9 +1,9 @@
import GeneralSelect from 'component/common/GeneralSelect/GeneralSelect';
import { KeyboardArrowDownOutlined } from '@mui/icons-material';
import React, { FC, useEffect } from 'react';
import { useProjectEnvironments } from 'hooks/api/getters/useProjectEnvironments/useProjectEnvironments';
import { Box, styled, Typography } from '@mui/material';
import { IMPORT_ENVIRONMENT } from 'utils/testIds';
import useProject from 'hooks/api/getters/useProject/useProject';
const ImportOptionsContainer = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.secondaryContainer,
@ -31,14 +31,12 @@ export const ImportOptions: FC<IImportOptionsProps> = ({
environment,
onChange,
}) => {
const { environments } = useProjectEnvironments(project);
const environmentOptions = environments
.filter(environment => environment.enabled)
.map(environment => ({
key: environment.name,
label: environment.name,
title: environment.name,
}));
const { project: projectInfo } = useProject(project);
const environmentOptions = projectInfo.environments.map(environment => ({
key: environment,
label: environment,
title: environment,
}));
useEffect(() => {
if (environment === '' && environmentOptions[0]) {