2019-12-07 23:58:37 +00:00
|
|
|
import React from 'react';
|
|
|
|
import TitledGreyBox from '@/components/elements/TitledGreyBox';
|
|
|
|
import { ServerContext } from '@/state/server';
|
|
|
|
import { useStoreState } from 'easy-peasy';
|
|
|
|
import { ApplicationStore } from '@/state';
|
|
|
|
import { UserData } from '@/state/user';
|
2019-12-10 06:03:10 +00:00
|
|
|
import RenameServerBox from '@/components/server/settings/RenameServerBox';
|
2020-03-28 23:47:32 +00:00
|
|
|
import FlashMessageRender from '@/components/FlashMessageRender';
|
2020-03-30 05:05:30 +00:00
|
|
|
import Can from '@/components/elements/Can';
|
2020-04-03 21:43:24 +00:00
|
|
|
import ReinstallServerBox from '@/components/server/settings/ReinstallServerBox';
|
2020-04-17 18:17:01 +00:00
|
|
|
import PageContentBlock from '@/components/elements/PageContentBlock';
|
2020-07-04 22:58:14 +00:00
|
|
|
import tw from 'twin.macro';
|
|
|
|
import Input from '@/components/elements/Input';
|
|
|
|
import Label from '@/components/elements/Label';
|
2020-07-05 01:46:09 +00:00
|
|
|
import { LinkButton } from '@/components/elements/Button';
|
2019-12-07 23:58:37 +00:00
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const user = useStoreState<ApplicationStore, UserData>(state => state.user.data!);
|
|
|
|
const server = ServerContext.useStoreState(state => state.server.data!);
|
|
|
|
|
|
|
|
return (
|
2020-04-17 18:17:01 +00:00
|
|
|
<PageContentBlock>
|
2020-07-04 22:58:14 +00:00
|
|
|
<FlashMessageRender byKey={'settings'} css={tw`mb-4`}/>
|
|
|
|
<div css={tw`md:flex`}>
|
2020-03-30 05:05:30 +00:00
|
|
|
<Can action={'file.sftp'}>
|
2020-07-04 22:58:14 +00:00
|
|
|
<div css={tw`w-full md:flex-1 md:mr-10`}>
|
2020-04-03 21:43:24 +00:00
|
|
|
<TitledGreyBox title={'SFTP Details'}>
|
|
|
|
<div>
|
2020-07-04 22:58:14 +00:00
|
|
|
<Label>Server Address</Label>
|
|
|
|
<Input
|
2020-04-03 21:43:24 +00:00
|
|
|
type={'text'}
|
|
|
|
value={`sftp://${server.sftpDetails.ip}:${server.sftpDetails.port}`}
|
2020-07-04 22:58:14 +00:00
|
|
|
readOnly
|
2020-04-03 21:43:24 +00:00
|
|
|
/>
|
2020-03-30 05:05:30 +00:00
|
|
|
</div>
|
2020-07-04 22:58:14 +00:00
|
|
|
<div css={tw`mt-6`}>
|
|
|
|
<Label>Username</Label>
|
|
|
|
<Input
|
2020-04-03 21:43:24 +00:00
|
|
|
type={'text'}
|
|
|
|
value={`${user.username}.${server.id}`}
|
2020-07-04 22:58:14 +00:00
|
|
|
readOnly
|
2020-04-03 21:43:24 +00:00
|
|
|
/>
|
2020-03-30 05:05:30 +00:00
|
|
|
</div>
|
2020-07-04 22:58:14 +00:00
|
|
|
<div css={tw`mt-6 flex items-center`}>
|
|
|
|
<div css={tw`flex-1`}>
|
|
|
|
<div css={tw`border-l-4 border-cyan-500 p-3`}>
|
|
|
|
<p css={tw`text-xs text-neutral-200`}>
|
2020-04-03 21:43:24 +00:00
|
|
|
Your SFTP password is the same as the password you use to access this panel.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-07-04 22:58:14 +00:00
|
|
|
<div css={tw`ml-4`}>
|
|
|
|
<LinkButton
|
|
|
|
isSecondary
|
2020-04-03 21:43:24 +00:00
|
|
|
href={`sftp://${user.username}.${server.id}@${server.sftpDetails.ip}:${server.sftpDetails.port}`}
|
|
|
|
>
|
|
|
|
Launch SFTP
|
2020-07-04 22:58:14 +00:00
|
|
|
</LinkButton>
|
2020-04-03 21:43:24 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</TitledGreyBox>
|
2019-12-07 23:58:37 +00:00
|
|
|
</div>
|
2020-03-30 05:05:30 +00:00
|
|
|
</Can>
|
2020-07-04 22:58:14 +00:00
|
|
|
<div css={tw`w-full mt-6 md:flex-1 md:mt-0`}>
|
2020-04-03 21:43:24 +00:00
|
|
|
<Can action={'settings.rename'}>
|
2020-07-04 22:58:14 +00:00
|
|
|
<div css={tw`mb-6 md:mb-10`}>
|
2020-04-03 21:43:24 +00:00
|
|
|
<RenameServerBox/>
|
|
|
|
</div>
|
|
|
|
</Can>
|
|
|
|
<Can action={'settings.reinstall'}>
|
|
|
|
<ReinstallServerBox/>
|
|
|
|
</Can>
|
|
|
|
</div>
|
2019-12-10 06:03:10 +00:00
|
|
|
</div>
|
2020-04-17 18:17:01 +00:00
|
|
|
</PageContentBlock>
|
2019-12-07 23:58:37 +00:00
|
|
|
);
|
|
|
|
};
|