ui(admin): remove api key components

This commit is contained in:
Matthew Penner 2021-07-28 11:56:25 -06:00
parent b8b481b57b
commit f1be653486
3 changed files with 0 additions and 199 deletions

View file

@ -1,21 +0,0 @@
import React from 'react';
import tw from 'twin.macro';
import AdminContentBlock from '@/components/admin/AdminContentBlock';
import NewApiKeyButton from '@/components/admin/api/NewApiKeyButton';
export default () => {
return (
<AdminContentBlock title={'API Keys'}>
<div css={tw`w-full flex flex-row items-center mb-8`}>
<div css={tw`flex flex-col flex-shrink`} style={{ minWidth: '0' }}>
<h2 css={tw`text-2xl text-neutral-50 font-header font-medium`}>API Keys</h2>
<p css={tw`text-base text-neutral-400 whitespace-nowrap overflow-ellipsis overflow-hidden`}>Control access credentials for managing this Panel via the API.</p>
</div>
<div css={tw`flex ml-auto pl-4`}>
<NewApiKeyButton />
</div>
</div>
</AdminContentBlock>
);
};

View file

@ -1,172 +0,0 @@
import React, { useState } from 'react';
import Button from '@/components/elements/Button';
import Field from '@/components/elements/Field';
import Modal from '@/components/elements/Modal';
import FlashMessageRender from '@/components/FlashMessageRender';
import useFlash from '@/plugins/useFlash';
import { Form, Formik, FormikHelpers } from 'formik';
import tw from 'twin.macro';
import { object } from 'yup';
interface Values {
description: string,
}
const schema = object().shape({
});
export default () => {
const [ visible, setVisible ] = useState(false);
const { clearFlashes } = useFlash();
const submit = (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
clearFlashes('api:create');
setSubmitting(true);
setTimeout(() => {
setVisible(false);
}, 500);
};
return (
<>
<Formik
onSubmit={submit}
initialValues={{ description: '' }}
validationSchema={schema}
>
{
({ isSubmitting, resetForm }) => (
<Modal
visible={visible}
dismissable={!isSubmitting}
showSpinnerOverlay={isSubmitting}
onDismissed={() => {
resetForm();
setVisible(false);
}}
>
<FlashMessageRender byKey={'api:create'} css={tw`mb-6`}/>
<h2 css={tw`text-2xl mb-6`}>New API Key</h2>
<Form css={tw`m-0`}>
<Field
type={'string'}
id={'description'}
name={'description'}
label={'Description'}
description={'A descriptive note for this API Key.'}
/>
<div css={tw`w-full flex flex-col mt-6`}>
<div css={tw`h-10 w-full flex flex-row items-center bg-neutral-900 rounded-t-md px-4`}>
<p css={tw`text-sm text-neutral-300 uppercase`}>Permissions</p>
<div css={tw`flex flex-row space-x-4 ml-auto`}>
<span css={tw`text-xs text-neutral-300 cursor-pointer`}>None</span>
<span css={tw`text-xs text-neutral-300 cursor-pointer`}>Read</span>
<span css={tw`text-xs text-neutral-300 cursor-pointer`}>Write</span>
</div>
</div>
<div css={tw`w-full flex flex-col bg-neutral-700 rounded-b-md py-1 px-4`}>
<div css={tw`w-full flex flex-row items-center py-1`}>
<p css={tw`text-sm text-neutral-200`}>Allocations</p>
<div css={tw`flex space-x-6 ml-auto`}>
<div css={tw`flex pr-1`}>
<input type={'radio'} name={'allocations'} css={tw`h-5 w-5`} value={'0'}/>
</div>
<div css={tw`flex`}>
<input type={'radio'} name={'allocations'} css={tw`h-5 w-5`} value={'1'}/>
</div>
<div css={tw`flex pr-1`}>
<input type={'radio'} name={'allocations'} css={tw`h-5 w-5`} value={'2'}/>
</div>
</div>
</div>
<div css={tw`w-full flex flex-row items-center py-1`}>
<p css={tw`text-sm text-neutral-200`}>Databases</p>
<div css={tw`flex space-x-6 ml-auto`}>
<div css={tw`flex pr-1`}>
<input type={'radio'} name={'databases'} css={tw`h-5 w-5`} value={'0'}/>
</div>
<div css={tw`flex`}>
<input type={'radio'} name={'databases'} css={tw`h-5 w-5`} value={'1'}/>
</div>
<div css={tw`flex pr-1`}>
<input type={'radio'} name={'databases'} css={tw`h-5 w-5`} value={'2'}/>
</div>
</div>
</div>
<div css={tw`w-full flex flex-row items-center py-1`}>
<p css={tw`text-sm text-neutral-200`}>Eggs</p>
<div css={tw`flex space-x-6 ml-auto`}>
<div css={tw`flex pr-1`}>
<input type={'radio'} name={'eggs'} css={tw`h-5 w-5`} value={'0'}/>
</div>
<div css={tw`flex`}>
<input type={'radio'} name={'eggs'} css={tw`h-5 w-5`} value={'1'}/>
</div>
<div css={tw`flex pr-1`}>
<input type={'radio'} name={'eggs'} css={tw`h-5 w-5`} value={'2'}/>
</div>
</div>
</div>
<div css={tw`w-full flex flex-row items-center py-1`}>
<p css={tw`text-sm text-neutral-200`}>Locations</p>
<div css={tw`flex space-x-6 ml-auto`}>
<div css={tw`flex pr-1`}>
<input type={'radio'} name={'locations'} css={tw`h-5 w-5`} value={'0'}/>
</div>
<div css={tw`flex`}>
<input type={'radio'} name={'locations'} css={tw`h-5 w-5`} value={'1'}/>
</div>
<div css={tw`flex pr-1`}>
<input type={'radio'} name={'locations'} css={tw`h-5 w-5`} value={'2'}/>
</div>
</div>
</div>
</div>
</div>
<div css={tw`flex flex-wrap justify-end mt-6`}>
<Button
type={'button'}
isSecondary
css={tw`w-full sm:w-auto sm:mr-2`}
onClick={() => setVisible(false)}
>
Cancel
</Button>
<Button css={tw`w-full mt-4 sm:w-auto sm:mt-0`} type={'submit'}>
Create API Key
</Button>
</div>
</Form>
</Modal>
)
}
</Formik>
<Button type={'button'} size={'large'} css={tw`h-10 px-4 py-0 whitespace-nowrap`} onClick={() => setVisible(true)}>
New API Key
</Button>
</>
);
};

View file

@ -8,7 +8,6 @@ import { AdminContext } from '@/state/admin';
import { NotFound } from '@/components/elements/ScreenBlock';
import OverviewContainer from '@/components/admin/overview/OverviewContainer';
import SettingsContainer from '@/components/admin/settings/SettingsContainer';
import ApiKeysContainer from '@/components/admin/api/ApiKeysContainer';
import DatabasesContainer from '@/components/admin/databases/DatabasesContainer';
import NewDatabaseContainer from '@/components/admin/databases/NewDatabaseContainer';
import DatabaseEditContainer from '@/components/admin/databases/DatabaseEditContainer';
@ -124,10 +123,6 @@ const AdminRouter = ({ location, match }: RouteComponentProps) => {
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" /><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /></svg>
<span>Settings</span>
</NavLink>
<NavLink to={`${match.url}/api`}>
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" /></svg>
<span>API Keys</span>
</NavLink>
<span>Management</span>
@ -208,7 +203,6 @@ const AdminRouter = ({ location, match }: RouteComponentProps) => {
<Switch location={location}>
<Route path={`${match.path}`} component={OverviewContainer} exact/>
<Route path={`${match.path}/settings`} component={SettingsContainer} exact/>
<Route path={`${match.path}/api`} component={ApiKeysContainer} exact/>
<Route path={`${match.path}/databases`} component={DatabasesContainer} exact/>
<Route path={`${match.path}/databases/new`} component={NewDatabaseContainer} exact/>