Add server ID and node name to debug block; closes #2852

This commit is contained in:
Dane Everitt 2020-12-25 15:52:15 -08:00
parent 9193db9d46
commit 0477e66bab
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -11,12 +11,19 @@ import Input from '@/components/elements/Input';
import Label from '@/components/elements/Label'; import Label from '@/components/elements/Label';
import { LinkButton } from '@/components/elements/Button'; import { LinkButton } from '@/components/elements/Button';
import ServerContentBlock from '@/components/elements/ServerContentBlock'; import ServerContentBlock from '@/components/elements/ServerContentBlock';
import isEqual from 'react-fast-compare';
import CopyOnClick from '@/components/elements/CopyOnClick';
export default () => { export default () => {
const username = useStoreState(state => state.user.data!.username); const username = useStoreState(state => state.user.data!.username);
const id = ServerContext.useStoreState(state => state.server.data!.id); const id = ServerContext.useStoreState(state => state.server.data!.id);
const sftpIp = ServerContext.useStoreState(state => state.server.data!.sftpDetails.ip); const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
const sftpPort = ServerContext.useStoreState(state => state.server.data!.sftpDetails.port); const node = ServerContext.useStoreState(state => state.server.data!.node);
const sftp = ServerContext.useStoreState(
state => state.server.data!.sftpDetails,
// @ts-ignore
isEqual,
);
return ( return (
<ServerContentBlock title={'Settings'}> <ServerContentBlock title={'Settings'}>
@ -29,7 +36,7 @@ export default () => {
<Label>Server Address</Label> <Label>Server Address</Label>
<Input <Input
type={'text'} type={'text'}
value={`sftp://${sftpIp}:${sftpPort}`} value={`sftp://${sftp.ip}:${sftp.port}`}
readOnly readOnly
/> />
</div> </div>
@ -52,7 +59,7 @@ export default () => {
<div css={tw`ml-4`}> <div css={tw`ml-4`}>
<LinkButton <LinkButton
isSecondary isSecondary
href={`sftp://${username}.${id}@${sftpIp}:${sftpPort}`} href={`sftp://${username}.${id}@${sftp.ip}:${sftp.port}`}
> >
Launch SFTP Launch SFTP
</LinkButton> </LinkButton>
@ -60,6 +67,18 @@ export default () => {
</div> </div>
</TitledGreyBox> </TitledGreyBox>
</Can> </Can>
<TitledGreyBox title={'Debug Information'} css={tw`mb-6 md:mb-10`}>
<div css={tw`flex items-center justify-between text-sm`}>
<p>Node</p>
<code css={tw`font-mono bg-neutral-900 rounded py-1 px-2`}>{node}</code>
</div>
<CopyOnClick text={uuid}>
<div css={tw`flex items-center justify-between mt-2 text-sm`}>
<p>Server ID</p>
<code css={tw`font-mono bg-neutral-900 rounded py-1 px-2`}>{uuid}</code>
</div>
</CopyOnClick>
</TitledGreyBox>
</div> </div>
<div css={tw`w-full mt-6 md:flex-1 md:mt-0`}> <div css={tw`w-full mt-6 md:flex-1 md:mt-0`}>
<Can action={'settings.rename'}> <Can action={'settings.rename'}>