fix: remove older references to magic_dns via usernames

This commit is contained in:
Aarnav Tale 2024-10-10 10:03:21 -04:00
parent 29d91785fb
commit dd479d4117
No known key found for this signature in database
4 changed files with 14 additions and 92 deletions

View File

@ -1,11 +1,11 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { ActionFunctionArgs, type LoaderFunctionArgs } from '@remix-run/node' import { ActionFunctionArgs, LoaderFunctionArgs } from '@remix-run/node'
import { Link, useLoaderData } from '@remix-run/react' import { Link, useLoaderData } from '@remix-run/react'
import Attribute from '~/components/Attribute' import Attribute from '~/components/Attribute'
import Card from '~/components/Card' import Card from '~/components/Card'
import StatusCircle from '~/components/StatusCircle' import StatusCircle from '~/components/StatusCircle'
import { type Machine, Route, User } from '~/types' import { Machine, Route, User } from '~/types'
import { cn } from '~/utils/cn' import { cn } from '~/utils/cn'
import { loadContext } from '~/utils/config/headplane' import { loadContext } from '~/utils/config/headplane'
import { loadConfig } from '~/utils/config/headscale' import { loadConfig } from '~/utils/config/headscale'
@ -141,7 +141,7 @@ export default function Page() {
<Attribute <Attribute
isCopyable isCopyable
name="Domain" name="Domain"
value={`${machine.givenName}.${machine.user.name}.${magic}`} value={`${machine.givenName}.${magic}`}
/> />
) )
: undefined} : undefined}

View File

@ -29,8 +29,6 @@ export default function Move({ machine, state, magic, users }: MoveProps) {
</Dialog.Title> </Dialog.Title>
<Dialog.Text> <Dialog.Text>
The owner of the machine is the user associated with it. The owner of the machine is the user associated with it.
When MagicDNS is enabled, the username of the owner
will control the hostname of the machine.
</Dialog.Text> </Dialog.Text>
<Form <Form
method="POST" method="POST"
@ -54,46 +52,16 @@ export default function Move({ machine, state, magic, users }: MoveProps) {
</Select> </Select>
{magic {magic
? ( ? (
owner === machine.user.name <p className="text-sm text-gray-500 dark:text-gray-300 leading-tight">
? ( This machine is accessible by the hostname
<p className="text-sm text-gray-500 dark:text-gray-300 leading-tight"> {' '}
This machine is accessible by the hostname <Code className="text-sm">
{' '} {machine.givenName}
<Code className="text-sm"> .
{machine.givenName} {magic}
. </Code>
{owner} .
. </p>
{magic}
</Code>
.
</p>
)
: (
<p className="text-sm text-gray-500 dark:text-gray-300 leading-tight">
This machine will be accessible by the hostname
{' '}
<Code className="text-sm">
{machine.givenName}
.
{owner}
.
{magic}
</Code>
{'. '}
The hostname
{' '}
<Code className="text-sm">
{machine.givenName}
.
{machine.user.name}
.
{magic}
</Code>
{' '}
will no longer point to this machine.
</p>
)
) )
: undefined} : undefined}
<div className="mt-6 flex justify-end gap-2 mt-6"> <div className="mt-6 flex justify-end gap-2 mt-6">

View File

@ -8,10 +8,9 @@ import Dialog from '~/components/Dialog'
interface Props { interface Props {
username: string username: string
magic?: string
} }
export default function Remove({ username, magic }: Props) { export default function Remove({ username }: Props) {
const submit = useSubmit() const submit = useSubmit()
const dialogState = useState(false) const dialogState = useState(false)
@ -41,24 +40,6 @@ export default function Remove({ username, magic }: Props) {
? ?
{' '} {' '}
A deleted user cannot be recovered. A deleted user cannot be recovered.
{magic
? (
<p className="text-sm mt-8 text-ui-600 dark:text-ui-300">
{' '}
Since Magic DNS is enabled, machines
currently accessible via
{' '}
<Code>
[machine].
{username}
.
{magic}
</Code>
{' '}
will become orphaned and inaccessible.
</p>
)
: undefined}
</Dialog.Text> </Dialog.Text>
<Form <Form
method="POST" method="POST"

View File

@ -3,7 +3,6 @@ import { Form, useSubmit } from '@remix-run/react'
import { useState } from 'react' import { useState } from 'react'
import Button from '~/components/Button' import Button from '~/components/Button'
import Code from '~/components/Code'
import Dialog from '~/components/Dialog' import Dialog from '~/components/Dialog'
import TextField from '~/components/TextField' import TextField from '~/components/TextField'
@ -40,32 +39,6 @@ export default function Rename({ username, magic }: Props) {
Enter a new username for Enter a new username for
{' '} {' '}
{username} {username}
?
{magic
? (
<p className="text-sm mt-8 text-ui-600 dark:text-ui-300">
{' '}
Since Magic DNS is enabled, machines
currently accessible via
{' '}
<Code>
[machine].
{username}
.
{magic}
</Code>
{' '}
will now become accessible via
{' '}
<Code>
[machine].
.
{magic}
</Code>
.
</p>
)
: undefined}
</Dialog.Text> </Dialog.Text>
<Form <Form
method="POST" method="POST"