diff --git a/web/src/routes/network/+page.svelte b/web/src/routes/network/+page.svelte index a318106..6e8f52a 100644 --- a/web/src/routes/network/+page.svelte +++ b/web/src/routes/network/+page.svelte @@ -14,6 +14,12 @@ import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '$lib/components/ui/card/index.js'; import { Input } from '$lib/components/ui/input/index.js'; import { Label } from '$lib/components/ui/label/index.js'; + import { + Select, + SelectContent, + SelectItem, + SelectTrigger + } from '$lib/components/ui/select/index.js'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '$lib/components/ui/tabs/index.js'; import { Dialog, @@ -73,6 +79,12 @@ let speakerForm = $state({ endpoint: '', role: 'operator' }); let speakerSaving = $state(false); let applyingId = $state(null); + const speakerById = $derived.by(() => new Map(speakers.map((s) => [s.id, s]))); + + function speakerLabelById(id: string | null | undefined) { + if (!id) return '—'; + return speakerById.get(id)?.endpoint ?? id; + } async function loadAll() { peersLoading = true; @@ -123,8 +135,12 @@ } } async function savePeer() { - if (!peerForm.neighbor || !peerForm.remote_asn) { - toast.error('Укажите адрес и ASN'); + if (!peerForm.neighbor.trim()) { + toast.error('Укажите адрес соседа'); + return; + } + if (!peerForm.remote_asn || peerForm.remote_asn <= 0) { + toast.error('Remote ASN должен быть больше 0'); return; } peerSaving = true; @@ -271,7 +287,7 @@ {p.session_state || '—'} - {p.bgp_speaker_id ? p.bgp_speaker_id.slice(0, 8) + '…' : '—'} + {speakerLabelById(p.bgp_speaker_id)}
@@ -325,7 +341,13 @@ {s.last_applied_revision_id ? s.last_applied_revision_id.slice(0, 8) + '…' : '—'}
- @@ -365,8 +387,26 @@
- - + +