1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-10 01:16:39 +02: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 = () => { export const FeatureToggleListTable: VFC = () => {
const theme = useTheme(); const theme = useTheme();
const { environments } = useEnvironments(); const { environments } = useEnvironments();
const enabledEnvironment = environments.filter(env => env.enabled);
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md')); const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
const isMediumScreen = useMediaQuery(theme.breakpoints.down('lg')); const isMediumScreen = useMediaQuery(theme.breakpoints.down('lg'));
const [showExportDialog, setShowExportDialog] = useState(false); const [showExportDialog, setShowExportDialog] = useState(false);
@ -386,7 +387,7 @@ export const FeatureToggleListTable: VFC = () => {
showExportDialog={showExportDialog} showExportDialog={showExportDialog}
data={data} data={data}
onClose={() => setShowExportDialog(false)} onClose={() => setShowExportDialog(false)}
environments={environments} environments={enabledEnvironment}
/> />
} }
/> />

View File

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