1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-09 11:14:29 +02:00
Nuno Góis 2022-12-14 15:16:58 +00:00 committed by GitHub
parent 160b9a0604
commit fe2f2f5705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 149 additions and 135 deletions

View File

@ -28,12 +28,10 @@ export const ConfirmToken = ({
primaryButtonText="Close" primaryButtonText="Close"
title="New token created" title="New token created"
> >
<div className={themeStyles.contentSpacingYLarge}> <Typography variant="body1">
<Typography variant="body1"> Your new token has been created successfully.
Your new token has been created successfully. </Typography>
</Typography> <UserToken token={token} />
<UserToken token={token} />
</div>
<ConditionallyRender <ConditionallyRender
condition={type === TokenType.FRONTEND} condition={type === TokenType.FRONTEND}
show={ show={

View File

@ -29,7 +29,8 @@ export const UserToken = ({ token }: IUserTokenProps) => {
backgroundColor: '#efefef', backgroundColor: '#efefef',
padding: '2rem', padding: '2rem',
borderRadius: '3px', borderRadius: '3px',
margin: '1rem 0', margin: '0',
marginTop: '1rem',
display: 'flex', display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',

View File

@ -1,7 +1,7 @@
import { DELETE_API_TOKEN } from 'component/providers/AccessProvider/permissions'; import { DELETE_API_TOKEN } from 'component/providers/AccessProvider/permissions';
import { Delete } from '@mui/icons-material'; import { Delete } from '@mui/icons-material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { IconButton, Tooltip } from '@mui/material'; import { IconButton, styled, Tooltip } from '@mui/material';
import { import {
IApiToken, IApiToken,
useApiTokens, useApiTokens,
@ -12,6 +12,10 @@ import { Dialogue } from 'component/common/Dialogue/Dialogue';
import useToast from 'hooks/useToast'; import useToast from 'hooks/useToast';
import useApiTokensApi from 'hooks/api/actions/useApiTokensApi/useApiTokensApi'; import useApiTokensApi from 'hooks/api/actions/useApiTokensApi/useApiTokensApi';
const StyledUl = styled('ul')({
marginBottom: 0,
});
interface IRemoveApiTokenButtonProps { interface IRemoveApiTokenButtonProps {
token: IApiToken; token: IApiToken;
} }
@ -54,7 +58,7 @@ export const RemoveApiTokenButton = ({ token }: IRemoveApiTokenButtonProps) => {
<div> <div>
Are you sure you want to delete the following API token? Are you sure you want to delete the following API token?
<br /> <br />
<ul> <StyledUl>
<li> <li>
<strong>username</strong>:{' '} <strong>username</strong>:{' '}
<code>{token.username}</code> <code>{token.username}</code>
@ -62,7 +66,7 @@ export const RemoveApiTokenButton = ({ token }: IRemoveApiTokenButtonProps) => {
<li> <li>
<strong>type</strong>: <code>{token.type}</code> <strong>type</strong>: <code>{token.type}</code>
</li> </li>
</ul> </StyledUl>
</div> </div>
</Dialogue> </Dialogue>
</> </>

View File

@ -2,7 +2,7 @@ import { makeStyles } from 'tss-react/mui';
export const useStyles = makeStyles()(theme => ({ export const useStyles = makeStyles()(theme => ({
deleteParagraph: { deleteParagraph: {
marginTop: '2rem', marginTop: theme.spacing(3),
}, },
roleDeleteInput: { roleDeleteInput: {
marginTop: '1rem', marginTop: '1rem',

View File

@ -1,6 +1,5 @@
import { Typography } from '@mui/material'; import { Typography } from '@mui/material';
import { Alert } from '@mui/material'; import { Alert } from '@mui/material';
import { useThemeStyles } from 'themes/themeStyles';
import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { Dialogue } from 'component/common/Dialogue/Dialogue';
import { LinkField } from '../../LinkField/LinkField'; import { LinkField } from '../../LinkField/LinkField';
@ -15,7 +14,6 @@ const ConfirmUserLink = ({
closeConfirm, closeConfirm,
inviteLink, inviteLink,
}: IConfirmUserLink) => { }: IConfirmUserLink) => {
const { classes: themeStyles } = useThemeStyles();
return ( return (
<Dialogue <Dialogue
open={open} open={open}
@ -23,34 +21,30 @@ const ConfirmUserLink = ({
primaryButtonText="Close" primaryButtonText="Close"
title="Team member added" title="Team member added"
> >
<div className={themeStyles.contentSpacingYLarge}> <Typography variant="body1" sx={{ mb: 2 }}>
<Typography variant="body1"> A new team member has been added.
A new team member has been added. Please provide them with </Typography>
the following link to get started: <Typography variant="body1">
Please provide them with the following link. This will allow
them to set up their password and get started with their Unleash
account.
</Typography>
<LinkField inviteLink={inviteLink} />
<Alert severity="info" sx={{ mt: 2 }}>
<Typography variant="body2">
Want to avoid this step in the future?{' '}
{/* TODO - ADD LINK HERE ONCE IT EXISTS*/}
<a
href="https://docs.getunleash.io/docs/deploy/email"
target="_blank"
rel="noopener noreferrer"
>
If you configure an email server for Unleash
</a>{' '}
we'll automatically send informational getting started
emails to new users once you add them.
</Typography> </Typography>
<LinkField inviteLink={inviteLink} /> </Alert>
<Typography variant="body1">
Copy the link and send it to the user. This will allow them
to set up their password and get started with their Unleash
account.
</Typography>
<Alert severity="info">
<Typography variant="body2">
Want to avoid this step in the future?{' '}
{/* TODO - ADD LINK HERE ONCE IT EXISTS*/}
<a
href="https://docs.getunleash.io/docs/deploy/email"
target="_blank"
rel="noopener noreferrer"
>
If you configure an email server for Unleash
</a>{' '}
we'll automatically send informational getting started
emails to new users once you add them.
</Typography>
</Alert>
</div>
</Dialogue> </Dialogue>
); );
}; };

View File

@ -232,18 +232,17 @@ export const InviteLink: VFC<ICreateInviteLinkProps> = () => {
primaryButtonText="Close" primaryButtonText="Close"
title="Invite link created" title="Invite link created"
> >
<Box sx={{ pt: 2 }}> <Box>
<Typography variant="body1" sx={{ mb: 2 }}>
Using this link, new team members can now sign-up to
Unleash.
</Typography>
<Typography variant="body1"> <Typography variant="body1">
New team members now sign-up to Unleash. Please provide Please provide them with the following link to get
them with the following link to get started: started. This will allow them to set up their password
and get started with their Unleash account.
</Typography> </Typography>
<LinkField inviteLink={inviteLink} /> <LinkField inviteLink={inviteLink} />
<Typography variant="body1">
Copy the link and send it to the user. This will allow
them to set up their password and get started with their
Unleash account.
</Typography>
</Box> </Box>
</Dialogue> </Dialogue>
<Dialogue <Dialogue

View File

@ -41,7 +41,7 @@ export const LinkField = ({ inviteLink, small }: ILinkFieldProps) => {
py: 4, py: 4,
px: 4, px: 4,
borderRadius: theme => `${theme.shape.borderRadius}px`, borderRadius: theme => `${theme.shape.borderRadius}px`,
my: 2, mt: 2,
display: 'flex', display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',

View File

@ -15,7 +15,7 @@ interface IArchivedFeatureDeleteConfirmProps {
} }
const StyledDeleteParagraph = styled('p')(({ theme }) => ({ const StyledDeleteParagraph = styled('p')(({ theme }) => ({
marginTop: theme.spacing(4), marginTop: theme.spacing(3),
})); }));
const StyledFormInput = styled(Input)(({ theme }) => ({ const StyledFormInput = styled(Input)(({ theme }) => ({
@ -79,9 +79,7 @@ export const ArchivedFeatureDeleteConfirm = ({
<StyledDeleteParagraph> <StyledDeleteParagraph>
In order to delete this feature toggle, please enter its name in In order to delete this feature toggle, please enter its name in
the text field below: the text field below: <strong>{deletedFeature?.name}</strong>
<br />
<strong>{deletedFeature?.name}</strong>
</StyledDeleteParagraph> </StyledDeleteParagraph>
<form id={formId}> <form id={formId}>

View File

@ -1,14 +0,0 @@
import { makeStyles } from 'tss-react/mui';
export const useStyles = makeStyles()(theme => ({
dialogTitle: {
backgroundColor: theme.palette.dialogHeaderBackground,
color: theme.palette.dialogHeaderText,
height: '150px',
padding: '2rem 3rem',
clipPath: ' ellipse(130% 115px at 120% 20%)',
},
dialogContentPadding: {
padding: '2rem 3rem',
},
}));

View File

@ -5,12 +5,42 @@ import {
DialogActions, DialogActions,
DialogContent, DialogContent,
DialogTitle, DialogTitle,
styled,
} from '@mui/material'; } from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { useStyles } from './Dialogue.styles';
import { DIALOGUE_CONFIRM_ID } from 'utils/testIds'; import { DIALOGUE_CONFIRM_ID } from 'utils/testIds';
const StyledDialog = styled(Dialog)(({ theme, maxWidth }) => ({
'& .MuiDialog-paper': {
borderRadius: theme.shape.borderRadiusLarge,
maxWidth: !maxWidth ? theme.spacing(85) : undefined,
backgroundColor: 'transparent',
},
}));
const StyledDialogTitle = styled(DialogTitle)(({ theme }) => ({
backgroundColor: theme.palette.primary.main,
color: theme.palette.text.tertiaryContrast,
padding: theme.spacing(3.5, 6),
fontWeight: theme.fontWeight.medium,
}));
const StyledDialogBody = styled('div')(({ theme }) => ({
padding: theme.spacing(6),
backgroundColor: theme.palette.background.paper,
}));
const StyledDialogContent = styled(DialogContent)(({ theme }) => ({
padding: 0,
marginBottom: theme.spacing(6),
}));
const StyledDialogActions = styled(DialogActions)(({ theme }) => ({
gap: theme.spacing(2),
padding: 0,
}));
interface IDialogue { interface IDialogue {
primaryButtonText?: string; primaryButtonText?: string;
secondaryButtonText?: string; secondaryButtonText?: string;
@ -35,12 +65,11 @@ export const Dialogue: React.FC<IDialogue> = ({
primaryButtonText, primaryButtonText,
disabledPrimaryButton = false, disabledPrimaryButton = false,
secondaryButtonText, secondaryButtonText,
maxWidth = 'sm', maxWidth,
fullWidth = false, fullWidth = false,
formId, formId,
permissionButton, permissionButton,
}) => { }) => {
const { classes: styles } = useStyles();
const handleClick = formId const handleClick = formId
? (e: React.SyntheticEvent) => { ? (e: React.SyntheticEvent) => {
e.preventDefault(); e.preventDefault();
@ -50,7 +79,7 @@ export const Dialogue: React.FC<IDialogue> = ({
} }
: onClick; : onClick;
return ( return (
<Dialog <StyledDialog
open={open} open={open}
onClose={onClose} onClose={onClose}
fullWidth={fullWidth} fullWidth={fullWidth}
@ -58,50 +87,47 @@ export const Dialogue: React.FC<IDialogue> = ({
aria-describedby={'simple-modal-description'} aria-describedby={'simple-modal-description'}
maxWidth={maxWidth} maxWidth={maxWidth}
> >
<DialogTitle className={styles.dialogTitle}>{title}</DialogTitle> <StyledDialogTitle>{title}</StyledDialogTitle>
<ConditionallyRender <StyledDialogBody>
condition={Boolean(children)}
show={
<DialogContent className={styles.dialogContentPadding}>
{children}
</DialogContent>
}
/>
<DialogActions>
<ConditionallyRender <ConditionallyRender
condition={Boolean(permissionButton)} condition={Boolean(children)}
show={permissionButton!} show={<StyledDialogContent>{children}</StyledDialogContent>}
elseShow={
<ConditionallyRender
condition={Boolean(onClick)}
show={
<Button
form={formId}
color="primary"
variant="contained"
onClick={handleClick}
autoFocus={!formId}
disabled={disabledPrimaryButton}
data-testid={DIALOGUE_CONFIRM_ID}
type={formId ? 'submit' : 'button'}
>
{primaryButtonText || "Yes, I'm sure"}
</Button>
}
/>
}
/> />
<StyledDialogActions>
<ConditionallyRender
condition={Boolean(permissionButton)}
show={permissionButton!}
elseShow={
<ConditionallyRender
condition={Boolean(onClick)}
show={
<Button
form={formId}
color="primary"
variant="contained"
onClick={handleClick}
autoFocus={!formId}
disabled={disabledPrimaryButton}
data-testid={DIALOGUE_CONFIRM_ID}
type={formId ? 'submit' : 'button'}
>
{primaryButtonText || "Yes, I'm sure"}
</Button>
}
/>
}
/>
<ConditionallyRender <ConditionallyRender
condition={Boolean(onClose)} condition={Boolean(onClose)}
show={ show={
<Button onClick={onClose}> <Button onClick={onClose}>
{secondaryButtonText || 'No, take me back'} {secondaryButtonText || 'No, take me back'}
</Button> </Button>
} }
/> />
</DialogActions> </StyledDialogActions>
</Dialog> </StyledDialogBody>
</StyledDialog>
); );
}; };

View File

@ -4,6 +4,5 @@ export const useStyles = makeStyles()(theme => ({
container: { container: {
display: 'grid', display: 'grid',
gap: theme.spacing(2), gap: theme.spacing(2),
paddingTop: theme.spacing(2),
}, },
})); }));

View File

@ -5,11 +5,19 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { Dialogue } from 'component/common/Dialogue/Dialogue';
import { useStyles } from './FeatureSettingsProjectConfirm.styles'; import { useStyles } from './FeatureSettingsProjectConfirm.styles';
import { arraysHaveSameItems } from 'utils/arraysHaveSameItems'; import { arraysHaveSameItems } from 'utils/arraysHaveSameItems';
import { Alert, List, ListItem } from '@mui/material'; import { Alert, List, ListItem, styled } from '@mui/material';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { IChangeRequest } from 'component/changeRequest/changeRequest.types'; import { IChangeRequest } from 'component/changeRequest/changeRequest.types';
import { useRequiredPathParam } from 'hooks/useRequiredPathParam'; import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
const StyledAlert = styled(Alert)(({ theme }) => ({
marginBottom: theme.spacing(1),
}));
const StyledList = styled(List)({
padding: 0,
});
interface IFeatureSettingsProjectConfirm { interface IFeatureSettingsProjectConfirm {
projectId: string; projectId: string;
open: boolean; open: boolean;
@ -55,28 +63,28 @@ const FeatureSettingsProjectConfirm = ({
secondaryButtonText="Cancel" secondaryButtonText="Cancel"
> >
<div className={styles.container}> <div className={styles.container}>
<Alert severity="success"> <StyledAlert severity="success">
This feature toggle is compatible with the new This feature toggle is compatible with the new
project. project.
</Alert> </StyledAlert>
<p>
Are you sure you want to change the project for this
toggle?
</p>
</div> </div>
<p>
Are you sure you want to change the project for this
toggle?
</p>
</Dialogue> </Dialogue>
} }
elseShow={ elseShow={
<Dialogue <Dialogue
open={open} open={open}
onClose={onClose} onClick={onClose}
title="Confirm change project" title="Confirm change project"
secondaryButtonText="OK" primaryButtonText="OK"
> >
<div className={styles.container}> <div className={styles.container}>
<Alert severity="warning"> <StyledAlert severity="warning">
Incompatible project environments Incompatible project environments
</Alert> </StyledAlert>
<p> <p>
In order to move a feature toggle between two In order to move a feature toggle between two
projects, both projects must have the exact same projects, both projects must have the exact same
@ -92,7 +100,7 @@ const FeatureSettingsProjectConfirm = ({
feature toggle is currently referenced feature toggle is currently referenced
in the following change requests: in the following change requests:
</p> </p>
<List> <StyledList>
{changeRequests?.map(changeRequest => { {changeRequests?.map(changeRequest => {
return ( return (
<ListItem <ListItem
@ -107,7 +115,7 @@ const FeatureSettingsProjectConfirm = ({
</ListItem> </ListItem>
); );
})} })}
</List> </StyledList>
</> </>
} }
/> />

View File

@ -1,9 +1,6 @@
import { makeStyles } from 'tss-react/mui'; import { makeStyles } from 'tss-react/mui';
export const useStyles = makeStyles()(theme => ({ export const useStyles = makeStyles()(theme => ({
deleteParagraph: {
marginTop: '2rem',
},
deleteInput: { deleteInput: {
marginTop: '1rem', marginTop: '1rem',
}, },

View File

@ -43,7 +43,7 @@ export const SegmentDeleteConfirm = ({
onClose={handleCancel} onClose={handleCancel}
formId={formId} formId={formId}
> >
<p className={styles.deleteParagraph}> <p>
In order to delete this segment, please enter the name of the In order to delete this segment, please enter the name of the
segment in the field below: <strong>{segment?.name}</strong> segment in the field below: <strong>{segment?.name}</strong>
</p> </p>

View File

@ -1,4 +1,3 @@
import React from 'react';
import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { Dialogue } from 'component/common/Dialogue/Dialogue';
import { useStyles } from '../SegmentDeleteConfirm/SegmentDeleteConfirm.styles'; import { useStyles } from '../SegmentDeleteConfirm/SegmentDeleteConfirm.styles';
import { ISegment } from 'interfaces/segment'; import { ISegment } from 'interfaces/segment';
@ -6,6 +5,11 @@ import { IFeatureStrategy } from 'interfaces/strategy';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { formatEditStrategyPath } from 'component/feature/FeatureStrategy/FeatureStrategyEdit/FeatureStrategyEdit'; import { formatEditStrategyPath } from 'component/feature/FeatureStrategy/FeatureStrategyEdit/FeatureStrategyEdit';
import { formatStrategyName } from 'utils/strategyNames'; import { formatStrategyName } from 'utils/strategyNames';
import { styled } from '@mui/material';
const StyledUl = styled('ul')({
marginBottom: 0,
});
interface ISegmentDeleteUsedSegmentProps { interface ISegmentDeleteUsedSegmentProps {
segment: ISegment; segment: ISegment;
@ -33,7 +37,7 @@ export const SegmentDeleteUsedSegment = ({
The following feature toggles are using the{' '} The following feature toggles are using the{' '}
<strong>{segment.name}</strong> segment for their strategies: <strong>{segment.name}</strong> segment for their strategies:
</p> </p>
<ul> <StyledUl>
{strategies?.map(strategy => ( {strategies?.map(strategy => (
<li key={strategy.id}> <li key={strategy.id}>
<Link <Link
@ -52,7 +56,7 @@ export const SegmentDeleteUsedSegment = ({
</Link> </Link>
</li> </li>
))} ))}
</ul> </StyledUl>
</Dialogue> </Dialogue>
); );
}; };