diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.styles.ts b/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.styles.ts index e54129a369..2ccd335291 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.styles.ts +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.styles.ts @@ -17,26 +17,12 @@ export const useStyles = makeStyles()(theme => ({ minWidth: '379px', }, }, - radioGroup: { - marginBottom: theme.spacing(2), - }, - radioItem: { - marginBottom: theme.spacing(1), - }, - radio: { - marginLeft: theme.spacing(1.5), - }, label: { minWidth: '300px', [theme.breakpoints.down(600)]: { minWidth: 'auto', }, }, - buttonContainer: { - marginTop: 'auto', - display: 'flex', - justifyContent: 'flex-end', - }, cancelButton: { marginLeft: '1.5rem', }, diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.tsx index e3e02d25ec..d5265325c6 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.tsx @@ -6,6 +6,8 @@ import { RadioGroup, Typography, Box, + Link, + Alert, } from '@mui/material'; import { KeyboardArrowDownOutlined } from '@mui/icons-material'; import React from 'react'; @@ -19,7 +21,6 @@ import { ApiTokenFormErrorType } from './useApiTokenForm'; import { useStyles } from './ApiTokenForm.styles'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { TokenType } from 'interfaces/token'; -import { CorsTokenAlert } from 'component/admin/cors/CorsTokenAlert'; interface IApiTokenFormProps { username: string; @@ -93,8 +94,22 @@ const ApiTokenForm: React.FC = ({ disabled: !environment.enabled, })); + const isUnleashCloud = Boolean(uiConfig?.flags?.UNLEASH_CLOUD); + return (
+ + Please be aware of our{' '} + + fair use policy + + . + + } + />

What would you like to call this token? @@ -110,7 +125,7 @@ const ApiTokenForm: React.FC = ({ onFocus={() => clearErrors('username')} autoFocus /> - + @@ -125,18 +140,27 @@ const ApiTokenForm: React.FC = ({ } + sx={{ mb: 1 }} + control={ + + } label={ - <> - {label} - - {title} - - + + + {label} + + {title} + + + } /> ))} @@ -169,20 +193,18 @@ const ApiTokenForm: React.FC = ({ className={styles.selectInput} />

-
+ {children} -
- - - - } - /> + ); }; diff --git a/frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx b/frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx index 7526b9dffc..847ef977c6 100644 --- a/frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx +++ b/frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx @@ -1,18 +1,23 @@ -import { Typography } from '@mui/material'; +import { Alert, Box, Typography } from '@mui/material'; +import { useNavigate, Link } from 'react-router-dom'; import { useThemeStyles } from 'themes/themeStyles'; import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { UserToken } from './UserToken/UserToken'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import { TokenType } from 'interfaces/token'; interface IConfirmUserLink { open: boolean; closeConfirm: () => void; token: string; + type?: string; } export const ConfirmToken = ({ open, closeConfirm, token, + type, }: IConfirmUserLink) => { const { classes: themeStyles } = useThemeStyles(); @@ -29,6 +34,20 @@ export const ConfirmToken = ({ + + By default, all {TokenType.FRONTEND} tokens may be used + from any CORS origin. If you'd like to configure a + strict set of origins, please use the{' '} + + CORS origins configuration page + + . + + } + /> ); }; diff --git a/frontend/src/component/admin/apiToken/CreateApiToken/CreateApiToken.tsx b/frontend/src/component/admin/apiToken/CreateApiToken/CreateApiToken.tsx index 484176ccbb..471f28b26e 100644 --- a/frontend/src/component/admin/apiToken/CreateApiToken/CreateApiToken.tsx +++ b/frontend/src/component/admin/apiToken/CreateApiToken/CreateApiToken.tsx @@ -1,5 +1,6 @@ -import FormTemplate from 'component/common/FormTemplate/FormTemplate'; +import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import FormTemplate from 'component/common/FormTemplate/FormTemplate'; import ApiTokenForm from '../ApiTokenForm/ApiTokenForm'; import { CreateButton } from 'component/common/CreateButton/CreateButton'; import useApiTokensApi from 'hooks/api/actions/useApiTokensApi/useApiTokensApi'; @@ -8,7 +9,6 @@ import useToast from 'hooks/useToast'; import { useApiTokenForm } from 'component/admin/apiToken/ApiTokenForm/useApiTokenForm'; import { ADMIN } from 'component/providers/AccessProvider/permissions'; import { ConfirmToken } from '../ConfirmToken/ConfirmToken'; -import { useState } from 'react'; import { scrollToTop } from 'component/common/util'; import { formatUnknownError } from 'utils/formatUnknownError'; import { usePageTitle } from 'hooks/usePageTitle'; @@ -109,6 +109,7 @@ export const CreateApiToken = () => { open={showConfirm} closeConfirm={closeConfirm} token={token} + type={type} /> ); diff --git a/frontend/src/component/admin/cors/CorsTokenAlert.tsx b/frontend/src/component/admin/cors/CorsTokenAlert.tsx deleted file mode 100644 index bac1ebfba8..0000000000 --- a/frontend/src/component/admin/cors/CorsTokenAlert.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { TokenType } from 'interfaces/token'; -import { Link } from 'react-router-dom'; -import { Alert } from '@mui/material'; - -export const CorsTokenAlert = () => { - return ( - - By default, all {TokenType.FRONTEND} tokens may be used from any - CORS origin. If you'd like to configure a strict set of origins, - please use the{' '} - - CORS origins configuration page - - . - - ); -};