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';
|
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-03-28 23:47:32 +00:00
|
|
|
<FlashMessageRender byKey={'settings'} className={'mb-4'}/>
|
|
|
|
<div className={'md:flex'}>
|
2020-03-30 05:05:30 +00:00
|
|
|
<Can action={'file.sftp'}>
|
2020-04-03 21:43:24 +00:00
|
|
|
<div className={'w-full md:flex-1 md:max-w-1/2 md:mr-10'}>
|
|
|
|
<TitledGreyBox title={'SFTP Details'}>
|
|
|
|
<div>
|
|
|
|
<label className={'input-dark-label'}>Server Address</label>
|
|
|
|
<input
|
|
|
|
type={'text'}
|
|
|
|
className={'input-dark'}
|
|
|
|
value={`sftp://${server.sftpDetails.ip}:${server.sftpDetails.port}`}
|
|
|
|
readOnly={true}
|
|
|
|
/>
|
2020-03-30 05:05:30 +00:00
|
|
|
</div>
|
2020-04-03 21:43:24 +00:00
|
|
|
<div className={'mt-6'}>
|
|
|
|
<label className={'input-dark-label'}>Username</label>
|
|
|
|
<input
|
|
|
|
type={'text'}
|
|
|
|
className={'input-dark'}
|
|
|
|
value={`${user.username}.${server.id}`}
|
|
|
|
readOnly={true}
|
|
|
|
/>
|
2020-03-30 05:05:30 +00:00
|
|
|
</div>
|
2020-04-03 21:43:24 +00:00
|
|
|
<div className={'mt-6 flex items-center'}>
|
|
|
|
<div className={'flex-1'}>
|
|
|
|
<div className={'border-l-4 border-cyan-500 p-3'}>
|
|
|
|
<p className={'text-xs text-neutral-200'}>
|
|
|
|
Your SFTP password is the same as the password you use to access this panel.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={'ml-4'}>
|
|
|
|
<a
|
|
|
|
href={`sftp://${user.username}.${server.id}@${server.sftpDetails.ip}:${server.sftpDetails.port}`}
|
|
|
|
className={'btn btn-sm btn-secondary'}
|
|
|
|
>
|
|
|
|
Launch SFTP
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</TitledGreyBox>
|
2019-12-07 23:58:37 +00:00
|
|
|
</div>
|
2020-03-30 05:05:30 +00:00
|
|
|
</Can>
|
2020-04-03 21:43:24 +00:00
|
|
|
<div className={'w-full mt-6 md:flex-1 md:max-w-1/2 md:mt-0'}>
|
|
|
|
<Can action={'settings.rename'}>
|
|
|
|
<div className={'mb-6 md:mb-10'}>
|
|
|
|
<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
|
|
|
);
|
|
|
|
};
|