Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6e46d30b7 |
@@ -8,7 +8,6 @@ import type { ColumnDef } from '@tanstack/react-table'
|
|||||||
import type { Filter, FilterFieldConfig } from '@/components/reui/filters'
|
import type { Filter, FilterFieldConfig } from '@/components/reui/filters'
|
||||||
import {
|
import {
|
||||||
CloudIcon,
|
CloudIcon,
|
||||||
MapPinIcon,
|
|
||||||
PlusIcon,
|
PlusIcon,
|
||||||
RefreshCwIcon,
|
RefreshCwIcon,
|
||||||
ServerIcon,
|
ServerIcon,
|
||||||
@@ -75,12 +74,16 @@ const formSchema = z.object({
|
|||||||
type FormValues = z.infer<typeof formSchema>
|
type FormValues = z.infer<typeof formSchema>
|
||||||
|
|
||||||
const ROLES: { value: NodeRole; label: string }[] = [
|
const ROLES: { value: NodeRole; label: string }[] = [
|
||||||
{ value: 'hub', label: 'hub' },
|
{ value: 'hub', label: 'Hub' },
|
||||||
{ value: 'gw', label: 'gw' },
|
{ value: 'gw', label: 'Gateway' },
|
||||||
{ value: 'edge', label: 'edge' },
|
{ value: 'edge', label: 'Edge' },
|
||||||
{ value: 'ix', label: 'ix' },
|
{ value: 'ix', label: 'IX' },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const ROLE_LABEL: Record<NodeRole, string> = Object.fromEntries(
|
||||||
|
ROLES.map((r) => [r.value, r.label]),
|
||||||
|
) as Record<NodeRole, string>
|
||||||
|
|
||||||
function NodesPage() {
|
function NodesPage() {
|
||||||
const qc = useQueryClient()
|
const qc = useQueryClient()
|
||||||
const { data: nodes = [], isLoading, isError, error, refetch } = useQuery(
|
const { data: nodes = [], isLoading, isError, error, refetch } = useQuery(
|
||||||
@@ -302,7 +305,10 @@ function NodesPage() {
|
|||||||
key: 'locationCode',
|
key: 'locationCode',
|
||||||
label: 'Локация',
|
label: 'Локация',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: locations.map((l) => ({ value: l.code, label: l.code })),
|
options: locations.map((l) => ({
|
||||||
|
value: l.code,
|
||||||
|
label: l.name,
|
||||||
|
})),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'role',
|
key: 'role',
|
||||||
@@ -340,16 +346,35 @@ function NodesPage() {
|
|||||||
{
|
{
|
||||||
accessorKey: 'locationCode',
|
accessorKey: 'locationCode',
|
||||||
header: 'Локация',
|
header: 'Локация',
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => {
|
||||||
<span className="flex items-center gap-1.5 text-sm">
|
const n = row.original
|
||||||
<MapPinIcon className="size-3.5" />
|
const loc = locations.find((l) => l.id === n.locationId)
|
||||||
{row.original.locationCode ?? '—'}
|
const city = n.locationName ?? loc?.name ?? n.locationCode ?? '—'
|
||||||
</span>
|
const countryCode = loc?.country ?? undefined
|
||||||
),
|
return (
|
||||||
|
<span className="flex items-center gap-2 text-sm">
|
||||||
|
<CountryFlag code={countryCode ?? undefined} country={countryNameFromCode(countryCode)} />
|
||||||
|
<span className="font-medium">{city}</span>
|
||||||
|
{n.locationCode ? (
|
||||||
|
<span className="text-muted-foreground font-mono text-xs">
|
||||||
|
{n.locationCode}
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'role',
|
accessorKey: 'role',
|
||||||
header: 'Роль',
|
header: 'Роль',
|
||||||
|
cell: ({ row }) => {
|
||||||
|
const role = row.original.role as NodeRole
|
||||||
|
return (
|
||||||
|
<span className="text-sm">
|
||||||
|
{ROLE_LABEL[role] ?? row.original.role}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'ip',
|
id: 'ip',
|
||||||
|
|||||||
Reference in New Issue
Block a user