mirror of
https://github.com/tale/headplane.git
synced 2026-09-04 03:05:41 +00:00
fix: clicking a machine name in users page redirects
This commit is contained in:
@@ -6,14 +6,19 @@ interface Props {
|
|||||||
name: string
|
name: string
|
||||||
value: string
|
value: string
|
||||||
isCopyable?: boolean
|
isCopyable?: boolean
|
||||||
|
link?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Attribute({ name, value, isCopyable }: Props) {
|
export default function Attribute({ name, value, link, isCopyable }: Props) {
|
||||||
const canCopy = isCopyable ?? false
|
const canCopy = isCopyable ?? false
|
||||||
return (
|
return (
|
||||||
<dl className="flex gap-1 text-sm w-full">
|
<dl className="flex gap-1 text-sm w-full">
|
||||||
<dt className="w-1/2 shrink-0 min-w-0 truncate text-gray-700 dark:text-gray-300 py-1">
|
<dt className="w-1/2 shrink-0 min-w-0 truncate text-gray-700 dark:text-gray-300 py-1">
|
||||||
{name}
|
{link ? (
|
||||||
|
<a className="hover:underline" href={link}>
|
||||||
|
{name}
|
||||||
|
</a>
|
||||||
|
) : name}
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
{canCopy
|
{canCopy
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||||
import { type DataRef, DndContext, useDraggable, useDroppable } from '@dnd-kit/core'
|
import { DataRef, DndContext, useDraggable, useDroppable } from '@dnd-kit/core'
|
||||||
import { PersonIcon } from '@primer/octicons-react'
|
import { PersonIcon } from '@primer/octicons-react'
|
||||||
import { type ActionFunctionArgs, json, type LoaderFunctionArgs } from '@remix-run/node'
|
import { ActionFunctionArgs, json, LoaderFunctionArgs } from '@remix-run/node'
|
||||||
import { useActionData, useLoaderData, useSubmit } from '@remix-run/react'
|
import { useActionData, useLoaderData, useSubmit } from '@remix-run/react'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { ClientOnly } from 'remix-utils/client-only'
|
import { ClientOnly } from 'remix-utils/client-only'
|
||||||
@@ -10,7 +10,7 @@ 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 { toast } from '~/components/Toaster'
|
import { toast } from '~/components/Toaster'
|
||||||
import { type Machine, type User } from '~/types'
|
import { Machine, 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'
|
||||||
@@ -299,6 +299,7 @@ function MachineChip({ machine }: { readonly machine: Machine }) {
|
|||||||
<StatusCircle isOnline={machine.online} className="w-4 h-4 px-1 w-fit" />
|
<StatusCircle isOnline={machine.online} className="w-4 h-4 px-1 w-fit" />
|
||||||
<Attribute
|
<Attribute
|
||||||
name={machine.givenName}
|
name={machine.givenName}
|
||||||
|
link={`machines/${machine.id}`}
|
||||||
value={machine.ipAddresses[0]}
|
value={machine.ipAddresses[0]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user