Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
236 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
frontend/src/component/project/Project/Import/ImportOptions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import GeneralSelect from '../../../common/GeneralSelect/GeneralSelect'; | ||
import { KeyboardArrowDownOutlined } from '@mui/icons-material'; | ||
import React, { FC, useEffect, useState } from 'react'; | ||
import { useProjectEnvironments } from '../../../../hooks/api/getters/useProjectEnvironments/useProjectEnvironments'; | ||
import { Box, styled, Typography } from '@mui/material'; | ||
|
||
const ImportOptionsContainer = styled(Box)(({ theme }) => ({ | ||
backgroundColor: theme.palette.secondaryContainer, | ||
borderRadius: theme.shape.borderRadiusLarge, | ||
padding: theme.spacing(3), | ||
})); | ||
|
||
const ImportOptionsHeader = styled(Typography)(({ theme }) => ({ | ||
marginBottom: theme.spacing(3), | ||
fontWeight: theme.typography.fontWeightBold, | ||
})); | ||
|
||
const ImportOptionsDescription = styled(Typography)(({ theme }) => ({ | ||
marginBottom: theme.spacing(1.5), | ||
})); | ||
|
||
interface IImportOptionsProps { | ||
project: string; | ||
environment: string; | ||
onChange: (value: string) => void; | ||
} | ||
|
||
export const ImportOptions: FC<IImportOptionsProps> = ({ | ||
project, | ||
environment, | ||
onChange, | ||
}) => { | ||
const { environments } = useProjectEnvironments(project); | ||
const environmentOptions = environments | ||
.filter(environment => environment.enabled) | ||
.map(environment => ({ | ||
key: environment.name, | ||
label: environment.name, | ||
title: environment.name, | ||
})); | ||
|
||
useEffect(() => { | ||
onChange(environmentOptions[0]?.key); | ||
}, [JSON.stringify(environmentOptions)]); | ||
|
||
return ( | ||
<ImportOptionsContainer> | ||
<ImportOptionsHeader>Import options</ImportOptionsHeader> | ||
<ImportOptionsDescription> | ||
Choose the environment to import the configuration for | ||
</ImportOptionsDescription> | ||
<GeneralSelect | ||
sx={{ width: '180px' }} | ||
options={environmentOptions} | ||
onChange={onChange} | ||
label={'Environment'} | ||
value={environment} | ||
IconComponent={KeyboardArrowDownOutlined} | ||
fullWidth | ||
/> | ||
</ImportOptionsContainer> | ||
); | ||
}; |
9 changes: 0 additions & 9 deletions
9
frontend/src/component/project/Project/Import/ImportTogglesDropZone.tsx
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
frontend/src/component/project/Project/Import/StyledFileDropZone.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { styled } from '@mui/material'; | ||
import { FileDropZone } from './FileDropZone'; | ||
import React from 'react'; | ||
|
||
export const StyledFileDropZone = styled(FileDropZone)(({ theme }) => ({ | ||
padding: theme.spacing(10, 2, 2, 2), | ||
border: `1px dashed ${theme.palette.secondary.border}`, | ||
borderRadius: theme.shape.borderRadiusLarge, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
})); |