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

create environment guidance dialog

This commit is contained in:
Youssef 2021-12-06 12:27:01 +01:00
parent abd158d129
commit 54d39882c3
2 changed files with 28 additions and 1 deletions

View File

@ -55,4 +55,8 @@ export const useStyles = makeStyles(theme => ({
overflow: 'hidden', overflow: 'hidden',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}, },
infoText:{
marginBottom: '10px',
fontSize: theme.fontSizes.bodySize,
},
})); }));

View File

@ -1,4 +1,4 @@
import { useRef } from 'react'; import { useRef, useState } from 'react';
import { TableCell, TableRow } from '@material-ui/core'; import { TableCell, TableRow } from '@material-ui/core';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
@ -17,6 +17,7 @@ import useProject from '../../../../hooks/api/getters/useProject/useProject';
import { UPDATE_FEATURE } from '../../../providers/AccessProvider/permissions'; import { UPDATE_FEATURE } from '../../../providers/AccessProvider/permissions';
import PermissionSwitch from '../../../common/PermissionSwitch/PermissionSwitch'; import PermissionSwitch from '../../../common/PermissionSwitch/PermissionSwitch';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import Dialogue from '../../../common/Dialogue';
interface IFeatureToggleListNewItemProps { interface IFeatureToggleListNewItemProps {
name: string; name: string;
@ -46,6 +47,7 @@ const FeatureToggleListNewItem = ({
const styles = useStyles(); const styles = useStyles();
const history = useHistory(); const history = useHistory();
const ref = useRef(null); const ref = useRef(null);
const [showInfoBox, setShowInfoBox] = useState(false);
const onClick = (e: SyntheticEvent) => { const onClick = (e: SyntheticEvent) => {
if (!ref.current?.contains(e.target)) { if (!ref.current?.contains(e.target)) {
@ -64,6 +66,7 @@ const FeatureToggleListNewItem = ({
refetch(); refetch();
}) })
.catch(e => { .catch(e => {
setShowInfoBox(true);
setToastData({ setToastData({
show: true, show: true,
type: 'error', type: 'error',
@ -145,6 +148,26 @@ const FeatureToggleListNewItem = ({
})} })}
</TableRow> </TableRow>
{toast} {toast}
<Dialogue
open={showInfoBox}
maxWidth="sm"
onClick={() => console.log('hi')}
onClose={() => setShowInfoBox(false)}
title="You need to add a strategy to your toggle"
primaryButtonText="Take me directly to add strategy"
secondaryButtonText="Cancel"
>
<p className={styles.infoText}>
Before you can enable the toggle in the environment, you
need to add an execution strategy.
</p>
<p className={styles.infoText}>
You can add the execution strategy by selecting the toggle,
open the environment accordion and add the execution
strategy.
</p>
</Dialogue>
</> </>
); );
}; };