Apply new eslint rules; default to prettier for styling
This commit is contained in:
parent
f22cce8881
commit
dc84af9937
218 changed files with 3876 additions and 3564 deletions
|
@ -10,8 +10,8 @@ import { Button } from '@/components/elements/button/index';
|
|||
import { Dialog } from '@/components/elements/dialog';
|
||||
|
||||
export default () => {
|
||||
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
||||
const [ modalVisible, setModalVisible ] = useState(false);
|
||||
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const { addFlash, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
|
||||
|
||||
const reinstall = () => {
|
||||
|
@ -24,7 +24,7 @@ export default () => {
|
|||
message: 'Your server has begun the reinstallation process.',
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
addFlash({ key: 'settings', type: 'error', message: httpErrorToHuman(error) });
|
||||
|
@ -49,8 +49,8 @@ export default () => {
|
|||
you wish to continue?
|
||||
</Dialog.Confirm>
|
||||
<p css={tw`text-sm`}>
|
||||
Reinstalling your server will stop it, and then re-run the installation script that initially
|
||||
set it up.
|
||||
Reinstalling your server will stop it, and then re-run the installation script that initially set it
|
||||
up.
|
||||
<strong css={tw`font-medium`}>
|
||||
Some files may be deleted or modified during this process, please back up your data before
|
||||
continuing.
|
||||
|
|
|
@ -21,18 +21,11 @@ const RenameServerBox = () => {
|
|||
|
||||
return (
|
||||
<TitledGreyBox title={'Change Server Name'} css={tw`relative`}>
|
||||
<SpinnerOverlay visible={isSubmitting}/>
|
||||
<SpinnerOverlay visible={isSubmitting} />
|
||||
<Form css={tw`mb-0`}>
|
||||
<Field
|
||||
id={'name'}
|
||||
name={'name'}
|
||||
label={'Server Name'}
|
||||
type={'text'}
|
||||
/>
|
||||
<Field id={'name'} name={'name'} label={'Server Name'} type={'text'} />
|
||||
<div css={tw`mt-6 text-right`}>
|
||||
<Button type={'submit'}>
|
||||
Save
|
||||
</Button>
|
||||
<Button type={'submit'}>Save</Button>
|
||||
</div>
|
||||
</Form>
|
||||
</TitledGreyBox>
|
||||
|
@ -40,15 +33,15 @@ const RenameServerBox = () => {
|
|||
};
|
||||
|
||||
export default () => {
|
||||
const server = ServerContext.useStoreState(state => state.server.data!);
|
||||
const setServer = ServerContext.useStoreActions(actions => actions.server.setServer);
|
||||
const server = ServerContext.useStoreState((state) => state.server.data!);
|
||||
const setServer = ServerContext.useStoreActions((actions) => actions.server.setServer);
|
||||
const { addError, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
|
||||
|
||||
const submit = ({ name }: Values, { setSubmitting }: FormikHelpers<Values>) => {
|
||||
clearFlashes('settings');
|
||||
renameServer(server.uuid, name)
|
||||
.then(() => setServer({ ...server, name }))
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
addError({ key: 'settings', message: httpErrorToHuman(error) });
|
||||
})
|
||||
|
@ -65,7 +58,7 @@ export default () => {
|
|||
name: string().required().min(1),
|
||||
})}
|
||||
>
|
||||
<RenameServerBox/>
|
||||
<RenameServerBox />
|
||||
</Formik>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -16,15 +16,15 @@ import { ip } from '@/lib/formatters';
|
|||
import { Button } from '@/components/elements/button/index';
|
||||
|
||||
export default () => {
|
||||
const username = useStoreState(state => state.user.data!.username);
|
||||
const id = ServerContext.useStoreState(state => state.server.data!.id);
|
||||
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
||||
const node = ServerContext.useStoreState(state => state.server.data!.node);
|
||||
const sftp = ServerContext.useStoreState(state => state.server.data!.sftpDetails, isEqual);
|
||||
const username = useStoreState((state) => state.user.data!.username);
|
||||
const id = ServerContext.useStoreState((state) => state.server.data!.id);
|
||||
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||
const node = ServerContext.useStoreState((state) => state.server.data!.node);
|
||||
const sftp = ServerContext.useStoreState((state) => state.server.data!.sftpDetails, isEqual);
|
||||
|
||||
return (
|
||||
<ServerContentBlock title={'Settings'}>
|
||||
<FlashMessageRender byKey={'settings'} css={tw`mb-4`}/>
|
||||
<FlashMessageRender byKey={'settings'} css={tw`mb-4`} />
|
||||
<div css={tw`md:flex`}>
|
||||
<div css={tw`w-full md:flex-1 md:mr-10`}>
|
||||
<Can action={'file.sftp'}>
|
||||
|
@ -32,21 +32,13 @@ export default () => {
|
|||
<div>
|
||||
<Label>Server Address</Label>
|
||||
<CopyOnClick text={`sftp://${ip(sftp.ip)}:${sftp.port}`}>
|
||||
<Input
|
||||
type={'text'}
|
||||
value={`sftp://${ip(sftp.ip)}:${sftp.port}`}
|
||||
readOnly
|
||||
/>
|
||||
<Input type={'text'} value={`sftp://${ip(sftp.ip)}:${sftp.port}`} readOnly />
|
||||
</CopyOnClick>
|
||||
</div>
|
||||
<div css={tw`mt-6`}>
|
||||
<Label>Username</Label>
|
||||
<CopyOnClick text={`${username}.${id}`}>
|
||||
<Input
|
||||
type={'text'}
|
||||
value={`${username}.${id}`}
|
||||
readOnly
|
||||
/>
|
||||
<Input type={'text'} value={`${username}.${id}`} readOnly />
|
||||
</CopyOnClick>
|
||||
</div>
|
||||
<div css={tw`mt-6 flex items-center`}>
|
||||
|
@ -81,11 +73,11 @@ export default () => {
|
|||
<div css={tw`w-full mt-6 md:flex-1 md:mt-0`}>
|
||||
<Can action={'settings.rename'}>
|
||||
<div css={tw`mb-6 md:mb-10`}>
|
||||
<RenameServerBox/>
|
||||
<RenameServerBox />
|
||||
</div>
|
||||
</Can>
|
||||
<Can action={'settings.reinstall'}>
|
||||
<ReinstallServerBox/>
|
||||
<ReinstallServerBox />
|
||||
</Can>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue